|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectno.feide.moria.store.MoriaCacheStore
public final class MoriaCacheStore
Distributed store implementation using JBoss Cache.
| Field Summary | |
|---|---|
private static java.lang.String |
CACHE_CONFIG_PROPERTY_NAME
The name of the configuration file property. |
private static java.lang.String |
DATA_ATTRIBUTE
The common hashmap key for the data attributes (MoriaAuthnAttempt & CachedUserData). |
private java.lang.Boolean |
isConfigured
The configured state of the store. |
private no.feide.moria.log.MessageLogger |
messageLogger
The logger used by this class. |
private java.lang.String |
nodeId
The node identificator for this node ( |
private static java.lang.String |
PRINCIPAL_ATTRIBUTE
The common hashmap key for the principal. |
private static java.lang.String |
REAL_TTL_PERCENTAGE_PROPERTY_NAME
The name of the ttl percentage property. |
private org.jboss.cache.TreeCache |
store
The cache instance. |
private static java.lang.String |
TICKET_TYPE_ATTRIBUTE
The common hashmap key for the ticket type. |
private java.util.Map |
ticketDefaultTTLs
Map containing the default ttl values. |
private java.util.Map |
ticketTTLs
Map to contain the ticket ttl values. |
private static java.lang.String |
TTL_ATTRIBUTE
The common hashmap key for the time to live. |
private static java.lang.String |
USERORG_ATTRIBUTE
The common hashmap key for the userorg attribute. |
| Constructor Summary | |
|---|---|
MoriaCacheStore()
Constructs a new instance. |
|
| Method Summary | |
|---|---|
java.lang.String |
cacheUserData(java.util.HashMap attributes,
java.lang.String userorg)
Creates a new CachedUserData object in the store and associates it with an SSO ticket which is returned. |
java.lang.String |
createAuthnAttempt(java.lang.String[] requestedAttributes,
java.lang.String responseURLPrefix,
java.lang.String responseURLPostfix,
boolean forceInteractiveAuthentication,
java.lang.String servicePrincipal)
Creates an authentication attempt based on a service request. |
java.lang.String |
createProxyTicket(java.lang.String tgTicketId,
java.lang.String servicePrincipal,
java.lang.String targetServicePrincipal)
Creates a new proxy ticket from a TGT and associates the new ticket with the same user data as the TGT. |
java.lang.String |
createServiceTicket(java.lang.String loginTicketId)
Creates a service ticket that the service will use when requesting user attributes after a successful authentication. |
java.lang.String |
createTicketGrantingTicket(java.lang.String ssoTicketId,
java.lang.String targetServicePrincipal)
Creates a new ticket granting ticket, using an sso ticket. |
MoriaAuthnAttempt |
getAuthnAttempt(java.lang.String ticketId,
boolean keep,
java.lang.String servicePrincipal)
Gets the authentication attempt associated with the ticket given as argument. |
(package private) MoriaTicket |
getFromStore(MoriaTicketType[] ticketTypes,
java.lang.String ticketId)
Retrieves a ticket instance which may be one of a number of types. |
(package private) MoriaTicket |
getFromStore(MoriaTicketType ticketType,
java.lang.String ticketId)
Retrieves a ticket instance from the store. |
java.lang.String |
getTicketServicePrincipal(java.lang.String ticketId,
MoriaTicketType ticketType)
Returns the service principal for the ticket. |
java.lang.String |
getTicketUserorg(java.lang.String ticketId,
MoriaTicketType ticketType)
Gets the userorg of a ticket. |
CachedUserData |
getUserData(java.lang.String ticketId,
java.lang.String servicePrincipal)
Returns the userdata associated with the incoming ticket, which must be either a proxy ticket, an SSO ticket or ticket granting ticket. |
private void |
insertIntoStore(MoriaTicket ticket)
Inserts an authentication attempt or cached user data into the cache. |
private void |
removeFromStore(MoriaTicket ticket)
Removes a ticket, and possibly a connected userdata or authnAttempt from the cache. |
void |
removeSSOTicket(java.lang.String ssoTicketId)
Removes an SSO ticket from the store. |
void |
setConfig(java.util.Properties properties)
Configures the store. |
void |
setTicketUserorg(java.lang.String ticketId,
MoriaTicketType ticketType,
java.lang.String userorg)
Sets the userorg of a ticket. |
void |
setTransientAttributes(java.lang.String loginTicketId,
java.util.HashMap transientAttributes)
Sets transient attributes stored with authentication attempt in an SSO context, which implies that not all cached (for potential SSO attributes) should be included. |
void |
setTransientSSOAttributes(java.lang.String loginTicketId,
java.lang.String ssoTicketId,
java.lang.String[] ssoEnabledAttributeNames)
Sets transient attributes stored with authentication attempt, copied from a cached user data object. |
void |
stop()
Stops this instance of the store. |
private void |
validateTicket(MoriaTicket ticket,
MoriaTicketType[] ticketTypes,
java.lang.String servicePrincipal)
Check validity of ticket against a set of types and expiry time. |
private void |
validateTicket(MoriaTicket ticket,
MoriaTicketType ticketType,
java.lang.String servicePrincipal)
Checks validity of ticket against type and expiry time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private org.jboss.cache.TreeCache store
private java.lang.Boolean isConfigured
private no.feide.moria.log.MessageLogger messageLogger
private java.util.Map ticketTTLs
private final java.util.Map ticketDefaultTTLs
private static final java.lang.String TICKET_TYPE_ATTRIBUTE
private static final java.lang.String TTL_ATTRIBUTE
private static final java.lang.String PRINCIPAL_ATTRIBUTE
private java.lang.String nodeId
private static final java.lang.String DATA_ATTRIBUTE
private static final java.lang.String USERORG_ATTRIBUTE
private static final java.lang.String CACHE_CONFIG_PROPERTY_NAME
private static final java.lang.String REAL_TTL_PERCENTAGE_PROPERTY_NAME
| Constructor Detail |
|---|
public MoriaCacheStore()
throws MoriaStoreException
MoriaStoreException - If creation of JBoss TreeCache fails.| Method Detail |
|---|
public void setConfig(java.util.Properties properties)
throws MoriaStoreConfigurationException
no.feide.moria.store.cacheconf and
no.feide.moria.store.real_ttl_percentage to be set. The
former must point to a JBossCache specific configuration file, the latter
contain a value between 1 and 100. The method will return without
actually executing and thus maintain the current state if called more
than once per object instance.
setConfig in interface MoriaStoreproperties - The properties used to configure the store.
MoriaStoreConfigurationException - If something fails during the process of starting the store.
java.lang.IllegalArgumentException - If properties is null.
java.lang.NullPointerException - If defaultTTL is null.MoriaStore.setConfig(java.util.Properties)public void stop()
stop in interface MoriaStoreMoriaStore.stop()
public java.lang.String createAuthnAttempt(java.lang.String[] requestedAttributes,
java.lang.String responseURLPrefix,
java.lang.String responseURLPostfix,
boolean forceInteractiveAuthentication,
java.lang.String servicePrincipal)
throws MoriaStoreException
createAuthnAttempt in interface MoriaStorerequestedAttributes - The user attributes the requesting service asks for.responseURLPrefix - The forward part of the url the client is to be redirected to.responseURLPostfix - The end part of the url the client is to be redirected to.forceInteractiveAuthentication - If the user should be forced to login interactively. I.e.
disable support for single sign-on.servicePrincipal - The id of the service doing the request.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If any of the arguments are null, and if responseURLPrefix or
servicePrincipal are zero length.MoriaStore.createAuthnAttempt(java.lang.String[],
java.lang.String, java.lang.String, boolean, java.lang.String)
public MoriaAuthnAttempt getAuthnAttempt(java.lang.String ticketId,
boolean keep,
java.lang.String servicePrincipal)
throws InvalidTicketException,
NonExistentTicketException,
MoriaStoreException
getAuthnAttempt in interface MoriaStoreticketId - The ticket ID. Must be a non-empty string.keep - If false, the ticket will be removed from the
store before returning. Otherwise keep the ticket.servicePrincipal - The principal used by the service to authenticate itself to
Moria. May be null.
java.lang.IllegalArgumentException - If ticket ID is null or an empty string.
NonExistentTicketException - If the ticket does not exist in the store.
InvalidTicketException - If the ticket is not associated with an authentication
attempt.
MoriaStoreException - If the operation fails.MoriaStore.getAuthnAttempt(java.lang.String,
boolean, java.lang.String)
public java.lang.String cacheUserData(java.util.HashMap attributes,
java.lang.String userorg)
throws MoriaStoreException
cacheUserData in interface MoriaStoreattributes - The attribute map to be cached.userorg - The userorg that is to be associated with the ticket.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If attributes is null, or userorg is null or an empty string.MoriaStore.cacheUserData(java.util.HashMap,
String)
public CachedUserData getUserData(java.lang.String ticketId,
java.lang.String servicePrincipal)
throws NonExistentTicketException,
InvalidTicketException,
MoriaStoreException
getUserData in interface MoriaStoreticketId - A ticket to identify a userdata object (SSO, TGT or PROXY).servicePrincipal - The name of the service requesting the data,
InvalidTicketException - If the incoming ticket is not of the correct type or has an
invalid principal.
NonExistentTicketException - If ticket does not exist.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If ticketId is null or zero length, or SSO ticket principal
is null or zero length.MoriaStore.getUserData(java.lang.String,
java.lang.String)
public java.lang.String createServiceTicket(java.lang.String loginTicketId)
throws InvalidTicketException,
NonExistentTicketException,
MoriaStoreException
createServiceTicket in interface MoriaStoreloginTicketId - A login ticket associated with an authentication attempt.
InvalidTicketException - If the supplied ticket is not a login ticket.
NonExistentTicketException - If ticket does not exist.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If loginTicketId is null or zero length.MoriaStore.createServiceTicket(java.lang.String)
public java.lang.String createTicketGrantingTicket(java.lang.String ssoTicketId,
java.lang.String targetServicePrincipal)
throws InvalidTicketException,
NonExistentTicketException,
MoriaStoreException
createTicketGrantingTicket in interface MoriaStoressoTicketId - An sso ticket that is already associated with a cached
userdata object.targetServicePrincipal - The id of the service that will use the TGT.
InvalidTicketException - If the argument ticket is not an SSO ticket or has an invalid
principal.
NonExistentTicketException - If ticket does not exist.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If any of the arguments are null or zero length.MoriaStore.createTicketGrantingTicket(java.lang.String,
java.lang.String)
public java.lang.String createProxyTicket(java.lang.String tgTicketId,
java.lang.String servicePrincipal,
java.lang.String targetServicePrincipal)
throws InvalidTicketException,
NonExistentTicketException,
MoriaStoreException
createProxyTicket in interface MoriaStoretgTicketId - A TGT issued earlier to a service.servicePrincipal - The id of the service making the request.targetServicePrincipal - The id of the service that will use the proxy ticket.
InvalidTicketException - If the incoming ticket is not a TGT or has an invalid
principal.
NonExistentTicketException - If ticket does not exist.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If any of the arguments are null or zero length.MoriaStore.createProxyTicket(java.lang.String,
java.lang.String, java.lang.String)
public void setTransientAttributes(java.lang.String loginTicketId,
java.util.HashMap transientAttributes)
throws InvalidTicketException,
NonExistentTicketException,
MoriaStoreException
setTransientAttributes in interface MoriaStoreloginTicketId - Ticket that identifies the AuthnAttempt that the attributes
will be associated with.transientAttributes - Attributes which are to be stored with the authentication
attempt.
InvalidTicketException - If ticket is found invalid.
NonExistentTicketException - If ticket does not exist.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If loginTicketId is null or zero length, or
transientAttributes is null.MoriaStore.setTransientAttributes(java.lang.String,
java.util.HashMap)
public void setTransientSSOAttributes(java.lang.String loginTicketId,
java.lang.String ssoTicketId,
java.lang.String[] ssoEnabledAttributeNames)
throws InvalidTicketException,
NonExistentTicketException,
MoriaStoreException
setTransientSSOAttributes in interface MoriaStoreloginTicketId - Ticket that identifies the AuthnAttempt that the attributes
will be associated with.ssoTicketId - Ticket associated with a set of cached user data.ssoEnabledAttributeNames - The names of those attributes which should be stored with the
authentication attempt. Only those transient (cached)
attributes named in this parameter will be stored.
InvalidTicketException - If either ticket is found invalid.
NonExistentTicketException - If either ticket does not exist.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If either ticket id is null or zero length.MoriaStore.setTransientSSOAttributes(java.lang.String,
java.lang.String, java.lang.String[])
public void removeSSOTicket(java.lang.String ssoTicketId)
throws NonExistentTicketException,
MoriaStoreException
removeSSOTicket in interface MoriaStoressoTicketId - The ID of the ticket to remove.
NonExistentTicketException - If ticket given by ssoTicketId does not exist,
or is empty.
MoriaStoreException - If the operation fails.MoriaStore.removeSSOTicket(java.lang.String)
public java.lang.String getTicketServicePrincipal(java.lang.String ticketId,
MoriaTicketType ticketType)
throws InvalidTicketException,
NonExistentTicketException,
MoriaStoreException
getTicketServicePrincipal in interface MoriaStoreticketId - The ticket id.ticketType - The ticket type.
InvalidTicketException - If the ticket is invalid.
NonExistentTicketException - If ticket does not exist.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If ticketId is null or zero length.MoriaTicket.getServicePrincipal()
public void setTicketUserorg(java.lang.String ticketId,
MoriaTicketType ticketType,
java.lang.String userorg)
throws InvalidTicketException,
NonExistentTicketException,
MoriaStoreException
setTicketUserorg in interface MoriaStoreticketId - The ticket id.ticketType - The ticket type.userorg - The userorg of the user creating the ticket.
InvalidTicketException - if the ticket is invalid.
NonExistentTicketException - If ticket does not exist.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If ticketId is null or zero length.MoriaStore.setTicketUserorg(String,
MoriaTicketType, String)
public java.lang.String getTicketUserorg(java.lang.String ticketId,
MoriaTicketType ticketType)
throws InvalidTicketException,
NonExistentTicketException,
MoriaStoreException
getTicketUserorg in interface MoriaStoreticketId - the ticket id.ticketType - the ticket type.
InvalidTicketException - If the ticket is invalid.
NonExistentTicketException - If ticket does not exist.
MoriaStoreException - If the operation fails.
java.lang.IllegalArgumentException - If ticketId is null or zero length.MoriaStore.getTicketUserorg(String,
MoriaTicketType)
private void validateTicket(MoriaTicket ticket,
MoriaTicketType ticketType,
java.lang.String servicePrincipal)
throws InvalidTicketException
ticket - Ticket to be checked.ticketType - The expected type of the ticket.servicePrincipal - The service expected to be associated with this ticket.
java.lang.IllegalArgumentException - If ticket is null, or ticketType is null or zero length.
InvalidTicketException - If ticket is found invalid.
private void validateTicket(MoriaTicket ticket,
MoriaTicketType[] ticketTypes,
java.lang.String servicePrincipal)
throws InvalidTicketException
ticket - Ticket to be checked.ticketTypes - Array of valid types for the ticket.servicePrincipal - The service that is using the ticket. May be null if no
service is available.
java.lang.IllegalArgumentException - If ticket is null, or ticketType is null or zero length.
InvalidTicketException - If the ticket is found to be invalid.
MoriaTicket getFromStore(MoriaTicketType[] ticketTypes,
java.lang.String ticketId)
throws MoriaStoreException
ticketTypes - Array of potential ticket types for the ticket id.ticketId - Id of the ticket to be retrieved.
java.lang.IllegalArgumentException - If the any of arguments are null value or zero length.
MoriaStoreException - If access to the store failed in some way.
MoriaTicket getFromStore(MoriaTicketType ticketType,
java.lang.String ticketId)
throws MoriaStoreException
ticketType - The type of ticket.ticketId - The ID of the ticket.
java.lang.IllegalArgumentException - If ticketType is null, or if
ticketId is null or an empty
string.
MoriaStoreException - If operations on the underlying TreeCache
fail; acts as a wrapper.
private void insertIntoStore(MoriaTicket ticket)
throws MoriaStoreException
ticket - The ticket to connect to the inserted object.
java.lang.IllegalArgumentException - If ticket is null.
MoriaStoreException - If operations on the TreeCache fail.
private void removeFromStore(MoriaTicket ticket)
throws NonExistentTicketException,
MoriaStoreException
ticket - The ticket to be removed.
java.lang.IllegalArgumentException - If ticket is null.
NonExistentTicketException - If the ticket does not exist.
MoriaStoreException - If an exception is thrown when operating on the store.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||