Class StatelessOperations
- java.lang.Object
-
- com.iplanet.dpro.session.operations.strategies.StatelessOperations
-
- All Implemented Interfaces:
SessionOperations
public class StatelessOperations extends Object implements SessionOperations
Handles client-side sessions.- Since:
- 13.0.0
-
-
Constructor Summary
Constructors Constructor Description StatelessOperations(LocalOperations localOperations, StatelessSessionManager statelessSessionManager, Blacklist<Session> sessionBlacklist, SessionLogging sessionLogging, SessionAuditor sessionAuditor, SessionChangeAuthorizer sessionChangeAuthorizer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSessionListener(Session session, String url)Add a session listener notification url.booleancheckSessionExists(SessionID sessionId)Check whether a session identified by {code sessionId} can be retrieved.StringdeferenceRestrictedID(Session session, SessionID restrictedID)Given a restricted token, returns the SSOTokenID of the master token can only be used if the requester is an app tokenvoiddestroy(Session requester, Session session)Destroys the Session by removing it and moving it to the DESTROY state.Collection<PartialSession>getMatchingSessions(CrestQuery crestQuery)This implementation will forward the query call to the local operations in order to allow the return of stateful sessions even when the request was initiated using a stateless session.StringgetRestrictedTokenId(SessionID masterSid, TokenRestriction restriction)Gets the restricted token ID for a session.SessionInfogetSessionInfo(SessionID sid, boolean reset)Get the Session Info Object from the Session ID.SearchResults<SessionInfo>getValidSessions(Session session, String pattern)Returns all sessions which are accessible using the provided session for authorization, and which match the provided filter.voidlogout(Session session)Performs the logout operation on the Session.SessionInforefresh(Session session, boolean reset)Performs a refresh of the Session and return a summary of the Session information.SessionresolveSession(SessionID sessionID)Retrieves the Session from the Session ID.voidsetExternalProperty(SSOToken clientToken, SessionID sessionId, String name, String value)Sets an external property in the session.voidsetProperty(Session session, String name, String value)Assigns the property to the Session.
-
-
-
Constructor Detail
-
StatelessOperations
@Inject public StatelessOperations(LocalOperations localOperations, StatelessSessionManager statelessSessionManager, Blacklist<Session> sessionBlacklist, SessionLogging sessionLogging, SessionAuditor sessionAuditor, SessionChangeAuthorizer sessionChangeAuthorizer)
-
-
Method Detail
-
refresh
public SessionInfo refresh(Session session, boolean reset) throws SessionException
Description copied from interface:SessionOperationsPerforms a refresh of the Session and return a summary of the Session information. This will optionally update the last modified timestamp of the Session. Note: This method is inconsistent from the other two in that it requires a Session reference. This is because of a dependency which could not be resolved without substantial refactoring in the Remote implementation.- Specified by:
refreshin interfaceSessionOperations- Parameters:
session- Reference to the Session.reset- If true, then update the last modified timestamp of the Session.- Returns:
- Null if there was an error locating the Session, otherwise non null.
- Throws:
SessionException
-
logout
public void logout(Session session) throws SessionException
Description copied from interface:SessionOperationsPerforms the logout operation on the Session. This operation is intended to destroy the Session and perform any appropriate Session related logic.- Specified by:
logoutin interfaceSessionOperations- Parameters:
session- Session to logout.- Throws:
SessionException
-
resolveSession
public Session resolveSession(SessionID sessionID) throws SessionException
Description copied from interface:SessionOperationsRetrieves the Session from the Session ID.- Specified by:
resolveSessionin interfaceSessionOperations- Parameters:
sessionID- the ID of the session to resolve- Returns:
- the Session Object
- Throws:
SessionException- if the session could not be accessed.
-
getValidSessions
public SearchResults<SessionInfo> getValidSessions(Session session, String pattern) throws SessionException
Description copied from interface:SessionOperationsReturns all sessions which are accessible using the provided session for authorization, and which match the provided filter. Will return early if size or time limits are exceeded.- Specified by:
getValidSessionsin interfaceSessionOperations- Parameters:
session- The session to use for authorization.pattern- The pattern to use to match the sessions.- Returns:
- The list of sessioninfos found, capped based on time and quantity.
- Throws:
SessionException- If the request fails.
-
getMatchingSessions
public Collection<PartialSession> getMatchingSessions(CrestQuery crestQuery) throws SessionException
This implementation will forward the query call to the local operations in order to allow the return of stateful sessions even when the request was initiated using a stateless session. Since stateless sessions are not tracked by OpenAM, it is not possible to query for them.- Specified by:
getMatchingSessionsin interfaceSessionOperations- Parameters:
crestQuery- The CREST query based on which we should look for matching sessions.- Returns:
- The collection of matching partial sessions.
- Throws:
SessionException- If the request fails.
-
destroy
public void destroy(Session requester, Session session) throws SessionException
Description copied from interface:SessionOperationsDestroys the Session by removing it and moving it to the DESTROY state. This operation is similar to the logout and uses similar behaviour.- Specified by:
destroyin interfaceSessionOperations- Parameters:
requester- The requester's non null session used to authorize the destroy operation.session- The non null session to destroy.- Throws:
SessionException- If there was an error while deleting the token.
-
setProperty
public void setProperty(Session session, String name, String value) throws SessionException
Description copied from interface:SessionOperationsAssigns the property to the Session.- Specified by:
setPropertyin interfaceSessionOperations- Parameters:
session- The session to perform the set on.name- Non null name of the property.value- Non null value.- Throws:
SessionException- SessionException if the session reached its maximum session time, or the session was destroyed, or there was an error during communication with session service, or if the property name or value was null.
-
getSessionInfo
public SessionInfo getSessionInfo(SessionID sid, boolean reset) throws SessionException
Description copied from interface:SessionOperationsGet the Session Info Object from the Session ID.- Specified by:
getSessionInfoin interfaceSessionOperations- Parameters:
sid- the Session Id of the required Session Info.reset- if true will cause the last access time on the session to be updated.- Returns:
- a Session Info object for the required session.
- Throws:
SessionException- if the session could not be accessed.
-
addSessionListener
public void addSessionListener(Session session, String url) throws SessionException
Description copied from interface:SessionOperationsAdd a session listener notification url. The url will receive a notification when session change events occur.- Specified by:
addSessionListenerin interfaceSessionOperations- Parameters:
session- the session to listen to.url- the listener notification url- Throws:
SessionException- if the session could not be accessed.
-
checkSessionExists
public boolean checkSessionExists(SessionID sessionId) throws SessionException
Description copied from interface:SessionOperationsCheck whether a session identified by {code sessionId} can be retrieved.- Specified by:
checkSessionExistsin interfaceSessionOperations- Parameters:
sessionId- the session ID to check.- Returns:
- returns true if the session is local
- Throws:
SessionException- if the session could not be accessed.
-
getRestrictedTokenId
public String getRestrictedTokenId(SessionID masterSid, TokenRestriction restriction) throws SessionException
Description copied from interface:SessionOperationsGets the restricted token ID for a session.- Specified by:
getRestrictedTokenIdin interfaceSessionOperations- Parameters:
masterSid- the master session id to get the restricted token id forrestriction- the Token Restriction type to use- Returns:
- a Restricted token ID as a String
- Throws:
SessionException- if the session could not be accessed.
-
deferenceRestrictedID
public String deferenceRestrictedID(Session session, SessionID restrictedID) throws SessionException
Description copied from interface:SessionOperationsGiven a restricted token, returns the SSOTokenID of the master token can only be used if the requester is an app token- Specified by:
deferenceRestrictedIDin interfaceSessionOperations- Parameters:
session- Must be an app tokenrestrictedID- The SSOTokenID of the restricted token- Returns:
- The SSOTokenID string of the master token
- Throws:
SessionException- If the master token cannot be de-referenced
-
setExternalProperty
public void setExternalProperty(SSOToken clientToken, SessionID sessionId, String name, String value) throws SessionException
Description copied from interface:SessionOperationsSets an external property in the session. If the property is protected then it will throw a SessionException.- Specified by:
setExternalPropertyin interfaceSessionOperations- Parameters:
clientToken- SSO Token of the client setting external property.sessionId- The Id of the session to set the property onname- the name of the propertyvalue- the new value of the property- Throws:
SessionException- If the Session could not be accessed or the property is protected.
-
-