Interface WebAuthSession
-
public interface WebAuthSession
A WebAuthSession manages a user'sWebAuthSessionContext
for a given IdP based on incomingWebAuthResponseContext
updates, Security Zones, and any other contextual information available. The WebAuthSession notifies the listener passed duringstartup(Runnable)
when the WebAuthSessionContext changes so that the listener may pull the new value by callinggetContext()
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description WebAuthSessionContext
getContext()
java.util.Optional<java.lang.String>
getIdpId()
void
logout()
Clears the user from thisWebAuthSession
void
onLoginResponse(WebAuthResponseContext webAuthResponseContext)
Push a newWebAuthResponseContext
when the user logs in from the IdPvoid
onLogoutResponse(WebAuthResponseContext webAuthResponseContext)
Push a newWebAuthResponseContext
when the user logs out from the IdPvoid
shutdown()
Shut down the session.void
startup(java.lang.Runnable listener)
Start up the session.
-
-
-
Method Detail
-
startup
void startup(@Nonnull java.lang.Runnable listener)
Start up the session. May only be called once. The givenlistener
is called for any changes to theWebAuthSessionContext
- Parameters:
listener
- theRunnable
which will be called when theWebAuthSessionContext
changes- Throws:
java.lang.IllegalStateException
- if the session was already started or shut down
-
shutdown
void shutdown()
Shut down the session. May only be called once after startup. The listener passed intostartup(Runnable)
will no longer be called when theWebAuthSessionContext
changes and the listener's reference will be released.- Throws:
java.lang.IllegalStateException
- if the session was already shut down or if it was never started
-
getIdpId
@Nonnull java.util.Optional<java.lang.String> getIdpId()
- Returns:
- an
Optional
containing the IdP Adapter ID associated with this session or an empty Optional if the IdP Adapter ID is null
-
getContext
@Nonnull WebAuthSessionContext getContext()
- Returns:
- the latest
WebAuthSessionContext
-
onLoginResponse
void onLoginResponse(@Nonnull WebAuthResponseContext webAuthResponseContext)
Push a newWebAuthResponseContext
when the user logs in from the IdP- Parameters:
webAuthResponseContext
- theWebAuthResponseContext
- Throws:
java.lang.IllegalStateException
- if the session is not running
-
onLogoutResponse
void onLogoutResponse(@Nonnull WebAuthResponseContext webAuthResponseContext)
Push a newWebAuthResponseContext
when the user logs out from the IdP- Parameters:
webAuthResponseContext
- theWebAuthResponseContext
- Throws:
java.lang.IllegalStateException
- if the session is not running
-
logout
void logout()
Clears the user from thisWebAuthSession
-
-