Interface SecurityService

All Known Implementing Classes:
SecurityServiceImpl

public interface SecurityService
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.core.Authentication
    Returns the Authentication for the current user or null if not user is authenticated.
    Returns the username of the current user
    getUserPermission(String siteId, String username, List<NormalizedRole> roles)
    Get user permissions for given site
    boolean
    isSiteMember(String username, String siteName)
    Check if a user is a member of a site User is a member of a site if they are member of any site group.
    boolean
    Check if given user has system_admin role
  • Method Details

    • getUserPermission

      List<String> getUserPermission(String siteId, String username, List<NormalizedRole> roles) throws ExecutionException
      Get user permissions for given site
      Parameters:
      siteId - crafter site Id
      username - user
      roles - roles the user is assigned to
      Returns:
      list of user permissions
      Throws:
      ExecutionException
    • getCurrentUser

      String getCurrentUser()
      Returns the username of the current user
      Returns:
      username of the current user, or null if no user is authenticated
    • getAuthentication

      org.springframework.security.core.Authentication getAuthentication()
      Returns the Authentication for the current user or null if not user is authenticated.
      Returns:
      authentication
    • isSiteMember

      boolean isSiteMember(String username, String siteName)
      Check if a user is a member of a site User is a member of a site if they are member of any site group. A site group is any group mapped in the site's role mapping configuration file.
      Parameters:
      username - the username
      siteName - the site name
      Returns:
      true if user is a member of the site, false otherwise
    • isSystemAdmin

      boolean isSystemAdmin(String username)
      Check if given user has system_admin role
      Parameters:
      username - user
      Returns:
      true if user is system_admin, false otherwise