Class BasicAuthorizedSessionAccessor
java.lang.Object
com.janeirodigital.sai.authentication.BasicAuthorizedSessionAccessor
- All Implemented Interfaces:
AuthorizedSessionAccessor
Basic in-memory implementation of
AuthorizedSessionAccessor when the consumer
of sai-java doesn't provide their own implementation.-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new Concurrent (thread safe) Hash Map for storage and retrieval of anAuthorizedSession -
Method Summary
Modifier and TypeMethodDescriptionget(AccessToken accessToken) Searches the in-memory session store for anAuthorizedSessionwith the same access token value as the one in the providedaccessToken.get(AuthorizedSession session) Gets the providedAuthorizedSessionfrom the in-memory storerefresh(AuthorizedSession session) Refreshes theAuthorizedSessionand updates the in-memory session store with the new valuesintsize()Returns the size of the in-memory session storevoidstore(AuthorizedSession session) Updates in-memory session store with the providedAuthorizedSession
-
Constructor Details
-
BasicAuthorizedSessionAccessor
public BasicAuthorizedSessionAccessor()Initializes a new Concurrent (thread safe) Hash Map for storage and retrieval of anAuthorizedSession
-
-
Method Details
-
get
Gets the providedAuthorizedSessionfrom the in-memory store- Specified by:
getin interfaceAuthorizedSessionAccessor- Parameters:
session-AuthorizedSessionto get- Returns:
AuthorizedSessionmatching the provided session or null- Throws:
SaiAuthenticationException
-
get
Searches the in-memory session store for anAuthorizedSessionwith the same access token value as the one in the providedaccessToken.- Specified by:
getin interfaceAuthorizedSessionAccessor- Parameters:
accessToken- Access token to lookup session with- Returns:
AuthorizedSessionmatching the provided access token or null
-
get
public AuthorizedSession get(URI socialAgentId, URI applicationId, URI oidcProviderId) throws SaiAuthenticationException Description copied from interface:AuthorizedSessionAccessor- Specified by:
getin interfaceAuthorizedSessionAccessor- Parameters:
socialAgentId- URI identifier of the session's social agentapplicationId- URI identifier of the session's applicationoidcProviderId- URI identifier of the session's openid connect provider- Returns:
AuthorizedSessionor null if it can't be found- Throws:
SaiAuthenticationException
-
refresh
Refreshes theAuthorizedSessionand updates the in-memory session store with the new values- Specified by:
refreshin interfaceAuthorizedSessionAccessor- Parameters:
session-AuthorizedSessionto refresh- Returns:
- Refreshed
AuthorizedSession - Throws:
SaiAuthenticationException
-
store
Updates in-memory session store with the providedAuthorizedSession- Parameters:
session- session to store- Throws:
SaiAuthenticationException
-
size
public int size()Returns the size of the in-memory session store- Returns:
- number of sessions
-