public class JBossCachedAuthenticationManager extends Object implements AuthenticationManager, CacheableManager<ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo>,Principal>
AuthenticationManager
implementation that uses CacheableManager
as the cache provider.Modifier and Type | Class and Description |
---|---|
static class |
JBossCachedAuthenticationManager.DomainInfo
A cache value.
|
Modifier and Type | Field and Description |
---|---|
protected ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo> |
domainCache |
Constructor and Description |
---|
JBossCachedAuthenticationManager()
Create a new JBossCachedAuthenticationManager using the
default security domain and
CallbackHandler implementation. |
JBossCachedAuthenticationManager(String securityDomain,
CallbackHandler callbackHandler)
Create a new JBossCachedAuthenticationManager.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(Principal key)
Checks if an entry exists in the cache.
|
void |
flushCache()
Flushes all entries from the cache.
|
void |
flushCache(Principal key)
Flushes one entry from the cache.
|
Subject |
getActiveSubject()
Get the currently authenticated subject.
|
Set<Principal> |
getCachedKeys()
Returns a set of keys stored in the cache.
|
String |
getSecurityDomain()
Get the security domain from which the security manager is from.
|
Principal |
getTargetPrincipal(Principal anotherDomainPrincipal,
Map<String,Object> contextMap)
Trust related usecases may require translation of a principal from another domain
to the current domain
An implementation of this interface may need to do a backdoor contact of the external
trust provider in deriving the target principal
|
boolean |
isValid(Principal principal,
Object credential)
The isValid method is invoked to see if a user identity and associated
credentials as known in the operational environment are valid proof of the
user identity.
|
boolean |
isValid(Principal principal,
Object credential,
Subject activeSubject)
The isValid method is invoked to see if a user identity and associated
credentials as known in the operational environment are valid proof of the
user identity.
|
void |
logout(Principal principal,
Subject subject)
This method must be invoked to perform the logout of the incoming principal.
|
void |
releaseModuleEntries(ClassLoader classLoader)
Release cache entries got the specified ClassLoader.
|
void |
setCache(ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo> cache)
Sets the cache.
|
void |
setDeepCopySubjectOption(Boolean flag)
Flag to specify if deep copy of subject sets needs to be
enabled
|
protected ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo> domainCache
public JBossCachedAuthenticationManager()
CallbackHandler
implementation.public JBossCachedAuthenticationManager(String securityDomain, CallbackHandler callbackHandler)
securityDomain
- name of the security domaincallbackHandler
- CallbackHandler
implementationpublic Subject getActiveSubject()
AuthenticationManager
getActiveSubject
in interface AuthenticationManager
PolicyContextHandler.getContext(String, Object)
public Principal getTargetPrincipal(Principal anotherDomainPrincipal, Map<String,Object> contextMap)
AuthenticationManager
getTargetPrincipal
in interface AuthenticationManager
anotherDomainPrincipal
- Principal that is applicable in the other domain
(Can be null - in which case the contextMap is used
solely to derive the target principal)contextMap
- Any context information (including information on the other domain
that may be relevant in deriving the target principal). Any SAML
assertions that may be relevant can be passed here.public boolean isValid(Principal principal, Object credential)
AuthenticationManager
isValid
in interface AuthenticationManager
principal
- - the user identity in the operation environmentcredential
- - the proof of user identity as known in the
operation environmentAuthenticationManager.isValid(Principal, Object, Subject)
public boolean isValid(Principal principal, Object credential, Subject activeSubject)
AuthenticationManager
isValid
in interface AuthenticationManager
principal
- - the user identity in the operation environmentcredential
- - the proof of user identity as known in the
operation environmentactiveSubject
- - the Subject which should be populated with the
validated Subject contents. A JAAS based implementation would typically
populate the activeSubject with the LoginContext.login result.public String getSecurityDomain()
BaseSecurityManager
getSecurityDomain
in interface BaseSecurityManager
public void flushCache()
CacheableManager
flushCache
in interface CacheableManager<ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo>,Principal>
public void flushCache(Principal key)
CacheableManager
flushCache
in interface CacheableManager<ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo>,Principal>
key
- Entry's key.public void setCache(ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo> cache)
CacheableManager
setCache
in interface CacheableManager<ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo>,Principal>
cache
- New cache to use.public boolean containsKey(Principal key)
CacheableManager
containsKey
in interface CacheableManager<ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo>,Principal>
key
- Entry's keypublic Set<Principal> getCachedKeys()
CacheableManager
getCachedKeys
in interface CacheableManager<ConcurrentMap<Principal,JBossCachedAuthenticationManager.DomainInfo>,Principal>
public void setDeepCopySubjectOption(Boolean flag)
flag
- public void releaseModuleEntries(ClassLoader classLoader)
classLoader
- the ClassLoader.public void logout(Principal principal, Subject subject)
AuthenticationManager
Subject
associated with
the principal is also provided, allowing implementations to perform any special cleanup based on the information
contained in the Subject
.logout
in interface AuthenticationManager
principal
- the Principal
being logged out.subject
- the Subject
associated with the principal being logged out.Copyright © 2019 JBoss by Red Hat. All rights reserved.