Class UserAndRoleDirectoryServiceImpl

java.lang.Object
org.opencastproject.userdirectory.UserAndRoleDirectoryServiceImpl
All Implemented Interfaces:
org.opencastproject.security.api.RoleDirectoryService, org.opencastproject.security.api.UserDirectoryService, org.springframework.security.core.userdetails.UserDetailsService

public class UserAndRoleDirectoryServiceImpl extends Object implements org.opencastproject.security.api.UserDirectoryService, org.springframework.security.core.userdetails.UserDetailsService, org.opencastproject.security.api.RoleDirectoryService
Federates user and role providers, and exposes a spring UserDetailsService so user lookups can be used by spring security.
  • Field Details

    • USER_CACHE_SIZE_KEY

      public static final String USER_CACHE_SIZE_KEY
      The configuration property for the user cache size
      See Also:
    • USER_CACHE_EXPIRY_KEY

      public static final String USER_CACHE_EXPIRY_KEY
      The configuration property for the user cache expiry time
      See Also:
    • userProviders

      protected List<org.opencastproject.security.api.UserProvider> userProviders
      The list of user providers
    • roleProviders

      protected List<org.opencastproject.security.api.RoleProvider> roleProviders
      The list of role providers
    • securityService

      protected org.opencastproject.security.api.SecurityService securityService
      The security service
  • Constructor Details

    • UserAndRoleDirectoryServiceImpl

      public UserAndRoleDirectoryServiceImpl()
  • Method Details

    • activate

      protected void activate(org.osgi.service.component.ComponentContext cc)
      Callback to activate the component.
      Parameters:
      cc - the declarative services component context
    • addUserProvider

      protected void addUserProvider(org.opencastproject.security.api.UserProvider userProvider)
      Adds a user provider.
      Parameters:
      userProvider - the user provider to add
    • removeUserProvider

      protected void removeUserProvider(org.opencastproject.security.api.UserProvider userProvider)
      Remove a user provider.
      Parameters:
      userProvider - the user provider to remove
    • addRoleProvider

      protected void addRoleProvider(org.opencastproject.security.api.RoleProvider roleProvider)
      Adds a role provider.
      Parameters:
      roleProvider - the role provider to add
    • removeRoleProvider

      protected void removeRoleProvider(org.opencastproject.security.api.RoleProvider roleProvider)
      Remove a role provider.
      Parameters:
      roleProvider - the role provider to remove
    • getUsers

      public List<org.opencastproject.security.api.User> getUsers()
      Specified by:
      getUsers in interface org.opencastproject.security.api.UserDirectoryService
      See Also:
      • UserDirectoryService.getUsers()
    • loadUser

      public org.opencastproject.security.api.User loadUser(String userName) throws IllegalStateException
      Specified by:
      loadUser in interface org.opencastproject.security.api.UserDirectoryService
      Throws:
      IllegalStateException
      See Also:
      • UserDirectoryService.loadUser(java.lang.String)
    • loadUsers

      public Iterator<org.opencastproject.security.api.User> loadUsers(Collection<String> userNames)
      Specified by:
      loadUsers in interface org.opencastproject.security.api.UserDirectoryService
    • loadUserByUsername

      public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String userName) throws org.springframework.security.core.userdetails.UsernameNotFoundException
      Specified by:
      loadUserByUsername in interface org.springframework.security.core.userdetails.UserDetailsService
      Throws:
      org.springframework.security.core.userdetails.UsernameNotFoundException
      See Also:
      • UserDetailsService.loadUserByUsername(java.lang.String)
    • setSecurityService

      public void setSecurityService(org.opencastproject.security.api.SecurityService securityService)
      Sets the security service
      Parameters:
      securityService - the securityService to set
    • findUsers

      public Iterator<org.opencastproject.security.api.User> findUsers(String query, int offset, int limit)
      Specified by:
      findUsers in interface org.opencastproject.security.api.UserDirectoryService
    • findRoles

      public List<org.opencastproject.security.api.Role> findRoles(String query, org.opencastproject.security.api.Role.Target target, int offset, int limit)
      Specified by:
      findRoles in interface org.opencastproject.security.api.RoleDirectoryService
    • countUsers

      public long countUsers()
      Specified by:
      countUsers in interface org.opencastproject.security.api.UserDirectoryService
    • invalidate

      public void invalidate(String userName)
      Specified by:
      invalidate in interface org.opencastproject.security.api.UserDirectoryService