Class ActiveDirectoryRealm

    • Constructor Detail

      • ActiveDirectoryRealm

        public ActiveDirectoryRealm()
    • Method Detail

      • setGroupRolesMap

        public void setGroupRolesMap​(<,​> groupRolesMap)
      • queryForAuthenticationInfo

        protected AuthenticationInfo queryForAuthenticationInfo​(AuthenticationToken token,
                                                                LdapContextFactory ldapContextFactory)
                                                         throws 
        Builds an AuthenticationInfo object by querying the active directory LDAP context for the specified username. This method binds to the LDAP server using the provided username and password - which if successful, indicates that the password is correct.

        This method can be overridden by subclasses to query the LDAP server in a more complex way.

        Specified by:
        queryForAuthenticationInfo in class AbstractLdapRealm
        Parameters:
        token - the authentication token provided by the user.
        ldapContextFactory - the factory used to build connections to the LDAP server.
        Returns:
        an AuthenticationInfo instance containing information retrieved from LDAP.
        Throws:
        - if any LDAP errors occur during the search.
      • buildAuthenticationInfo

        protected  username,
                                                             char[] password)
      • queryForAuthorizationInfo

        protected AuthorizationInfo queryForAuthorizationInfo​(PrincipalCollection principals,
                                                              LdapContextFactory ldapContextFactory)
                                                       throws 
        Builds an AuthorizationInfo object by querying the active directory LDAP context for the groups that a user is a member of. The groups are then translated to role names by using the configured groupRolesMap.

        This implementation expects the principal argument to be a String username.

        Subclasses can override this method to determine authorization data (roles, permissions, etc) in a more complex way. Note that this default implementation does not support permissions, only roles.

        Specified by:
        queryForAuthorizationInfo in class AbstractLdapRealm
        Parameters:
        principals - the principal of the Subject whose account is being retrieved.
        ldapContextFactory - the factory used to create LDAP connections.
        Returns:
        the AuthorizationInfo for the given Subject principal.
        Throws:
        - if an error occurs when searching the LDAP server.
      • buildAuthorizationInfo

        protected <> roleNames)
      • getRoleNamesForUser

        protected <> getRoleNamesForUser​( username,
                                                   ldapContext)
                                           throws 
        Throws:
      • getRoleNamesForGroups

        protected <> getRoleNamesForGroups​(<> groupNames)
        This method is called by the default implementation to translate Active Directory group names to role names. This implementation uses the groupRolesMap to map group names to role names.
        Parameters:
        groupNames - the group names that apply to the current user.
        Returns:
        a collection of roles that are implied by the given role names.