public class LdapAuthenticationToken
extends org.springframework.security.authentication.AbstractAuthenticationToken
Authentication token to use when an application needs further access to the LDAP context used to authenticate the user.
When this is the Authentication object stored in the Spring Security context, an application can retrieve the current LDAP context thusly:
LdapAuthenticationToken ldapAuth = (LdapAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); InitialLdapContext ldapContext = ldapAuth.getContext();
| Constructor and Description |
|---|
LdapAuthenticationToken(org.springframework.security.core.Authentication auth,
org.springframework.security.core.GrantedAuthority defaultAuthority)
Construct a new LdapAuthenticationToken, using an existing Authentication object and a default authority.
|
LdapAuthenticationToken(org.springframework.security.core.Authentication auth,
String defaultAuthority)
Construct a new LdapAuthenticationToken, using an existing Authentication object and a default authority.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAuthorities(Collection<? extends org.springframework.security.core.GrantedAuthority> authoritiesToAdd)
Add authorities to the list of granted authorities
|
void |
addAuthority(org.springframework.security.core.GrantedAuthority authority)
Add an authority to the list of granted authorities
|
Collection<org.springframework.security.core.GrantedAuthority> |
getAuthorities() |
InitialLdapContext |
getContext()
Retrieve the LDAP context attached to this user's authentication object.
|
Object |
getCredentials() |
Object |
getPrincipal() |
void |
setContext(InitialLdapContext context)
Attach an LDAP context to this user's authentication object.
|
public LdapAuthenticationToken(org.springframework.security.core.Authentication auth,
org.springframework.security.core.GrantedAuthority defaultAuthority)
auth - defaultAuthority - public LdapAuthenticationToken(org.springframework.security.core.Authentication auth,
String defaultAuthority)
auth - defaultAuthority - public Collection<org.springframework.security.core.GrantedAuthority> getAuthorities()
getAuthorities in interface org.springframework.security.core.AuthenticationgetAuthorities in class org.springframework.security.authentication.AbstractAuthenticationTokenpublic void addAuthority(org.springframework.security.core.GrantedAuthority authority)
authority - - authority to be addedpublic void addAuthorities(Collection<? extends org.springframework.security.core.GrantedAuthority> authoritiesToAdd)
authoritiesToAdd - - authorities to be addedpublic Object getCredentials()
public Object getPrincipal()
public InitialLdapContext getContext()
public void setContext(InitialLdapContext context)
context - the LDAP contextCopyright © 2007-2015 Ikasan. All Rights Reserved.