|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jsecurity.realm.CachingRealm
org.jsecurity.realm.AuthenticatingRealm
org.jsecurity.realm.AuthorizingRealm
org.jsecurity.realm.ldap.AbstractLdapRealm
org.jsecurity.realm.activedirectory.ActiveDirectoryRealm
public class ActiveDirectoryRealm
An Realm that authenticates with an active directory LDAP
server to determine the roles for a particular user. This implementation
queries for the user's groups and then maps the group names to roles using the
groupRolesMap.
| Field Summary |
|---|
| Fields inherited from class org.jsecurity.realm.ldap.AbstractLdapRealm |
|---|
principalSuffix, searchBase, systemPassword, systemUsername, url |
| Constructor Summary | |
|---|---|
ActiveDirectoryRealm()
|
|
| Method Summary | |
|---|---|
protected AuthenticationInfo |
buildAuthenticationInfo(String username,
char[] password)
|
protected AuthorizationInfo |
buildAuthorizationInfo(Set<String> roleNames)
|
protected Collection<String> |
getRoleNamesForGroups(Collection<String> groupNames)
This method is called by the default implementation to translate Active Directory group names to role names. |
protected AuthenticationInfo |
queryForAuthenticationInfo(AuthenticationToken token,
LdapContextFactory ldapContextFactory)
Builds an AuthenticationInfo object by querying the active directory LDAP context for the
specified username. |
protected AuthorizationInfo |
queryForAuthorizationInfo(PrincipalCollection principals,
LdapContextFactory ldapContextFactory)
Builds an AuthorizationInfo object by querying the active directory LDAP context for the
groups that a user is a member of. |
void |
setGroupRolesMap(Map<String,String> groupRolesMap)
|
| Methods inherited from class org.jsecurity.realm.ldap.AbstractLdapRealm |
|---|
afterAuthorizationCacheSet, doGetAuthenticationInfo, doGetAuthorizationInfo, setLdapContextFactory, setPrincipalSuffix, setSearchBase, setSystemPassword, setSystemUsername, setUrl |
| Methods inherited from class org.jsecurity.realm.AuthenticatingRealm |
|---|
getAuthenticationInfo, getAuthenticationTokenClass, getCredentialsMatcher, setAuthenticationTokenClass, setCredentialsMatcher, supports |
| Methods inherited from class org.jsecurity.realm.CachingRealm |
|---|
getCacheManager, getName, setCacheManager, setName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ActiveDirectoryRealm()
| Method Detail |
|---|
public void setGroupRolesMap(Map<String,String> groupRolesMap)
protected AuthenticationInfo queryForAuthenticationInfo(AuthenticationToken token,
LdapContextFactory ldapContextFactory)
throws NamingException
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.
queryForAuthenticationInfo in class AbstractLdapRealmtoken - the authentication token provided by the user.ldapContextFactory - the factory used to build connections to the LDAP server.
AuthenticationInfo instance containing information retrieved from LDAP.
NamingException - if any LDAP errors occur during the search.
protected AuthenticationInfo buildAuthenticationInfo(String username,
char[] password)
protected AuthorizationInfo queryForAuthorizationInfo(PrincipalCollection principals,
LdapContextFactory ldapContextFactory)
throws NamingException
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.
queryForAuthorizationInfo in class AbstractLdapRealmprincipals - the principal of the Subject whose account is being retrieved.ldapContextFactory - the factory used to create LDAP connections.
NamingException - if an error occurs when searching the LDAP server.protected AuthorizationInfo buildAuthorizationInfo(Set<String> roleNames)
protected Collection<String> getRoleNamesForGroups(Collection<String> groupNames)
groupRolesMap to map group names to role names.
groupNames - the group names that apply to the current user.
|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||