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 anAuthorizedSession
with the same access token value as the one in the providedaccessToken
.get
(AuthorizedSession session) Gets the providedAuthorizedSession
from the in-memory storerefresh
(AuthorizedSession session) Refreshes theAuthorizedSession
and updates the in-memory session store with the new valuesint
size()
Returns the size of the in-memory session storevoid
store
(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 providedAuthorizedSession
from the in-memory store- Specified by:
get
in interfaceAuthorizedSessionAccessor
- Parameters:
session
-AuthorizedSession
to get- Returns:
AuthorizedSession
matching the provided session or null- Throws:
SaiAuthenticationException
-
get
Searches the in-memory session store for anAuthorizedSession
with the same access token value as the one in the providedaccessToken
.- Specified by:
get
in interfaceAuthorizedSessionAccessor
- Parameters:
accessToken
- Access token to lookup session with- Returns:
AuthorizedSession
matching 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:
get
in 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:
AuthorizedSession
or null if it can't be found- Throws:
SaiAuthenticationException
-
refresh
Refreshes theAuthorizedSession
and updates the in-memory session store with the new values- Specified by:
refresh
in interfaceAuthorizedSessionAccessor
- Parameters:
session
-AuthorizedSession
to 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
-