Interface B2BSessions
-
- All Implemented Interfaces:
public interface B2BSessionsThe B2BSessions interface provides methods for authenticating, updating, or revoking sessions, and properties to retrieve the existing session token (opaque or JWT).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classB2BSessions.AuthParamsData class used for wrapping parameters used with Sessions authentication
public final classB2BSessions.RevokeParamsData class used for wrapping parameters used with Sessions revocation
public final classB2BSessions.ExchangeParametersData class used for wrapping parameters used with Sessions exchange
-
Method Summary
Modifier and Type Method Description abstract UnitonChange(Function1<StytchObjectInfo<B2BSessionData>, Unit> callback)Assign a callback that will be called when the session data changes abstract StytchResult<SessionsAuthenticateResponseData>authenticate(B2BSessions.AuthParams authParams)Authenticates a Session and updates its lifetime by the specified session_duration_minutes. abstract Unitauthenticate(B2BSessions.AuthParams authParams, Function1<StytchResult<SessionsAuthenticateResponseData>, Unit> callback)Authenticates a Session and updates its lifetime by the specified session_duration_minutes. abstract CompletableFuture<StytchResult<SessionsAuthenticateResponseData>>authenticateCompletable(B2BSessions.AuthParams authParams)Authenticates a Session and updates its lifetime by the specified session_duration_minutes. abstract StytchResult<BasicData>revoke(B2BSessions.RevokeParams params)Revoke a Session and immediately invalidate all its tokens. abstract Unitrevoke(B2BSessions.RevokeParams params, Function1<StytchResult<BasicData>, Unit> callback)Revoke a Session and immediately invalidate all its tokens. abstract CompletableFuture<StytchResult<BasicData>>revokeCompletable(B2BSessions.RevokeParams params)Revoke a Session and immediately invalidate all its tokens. abstract UnitupdateSession(String sessionToken, String sessionJwt)Updates the current session with a sessionToken and sessionJwt abstract B2BSessionDatagetSync()Get session from memory without network call abstract StytchResult<SessionExchangeResponseData>exchange(B2BSessions.ExchangeParameters parameters)Exchanges an existing session for one in a different organization abstract Unitexchange(B2BSessions.ExchangeParameters parameters, Function1<StytchResult<SessionExchangeResponseData>, Unit> callback)Exchanges an existing session for one in a different organization abstract CompletableFuture<StytchResult<SessionExchangeResponseData>>exchangeCompletable(B2BSessions.ExchangeParameters parameters)Exchanges an existing session for one in a different organization abstract StateFlow<StytchObjectInfo<B2BSessionData>>getOnChange()Exposes a flow of session data abstract StringgetSessionToken()abstract StringgetSessionJwt()-
-
Method Detail
-
onChange
abstract Unit onChange(Function1<StytchObjectInfo<B2BSessionData>, Unit> callback)
Assign a callback that will be called when the session data changes
-
authenticate
abstract StytchResult<SessionsAuthenticateResponseData> authenticate(B2BSessions.AuthParams authParams)
Authenticates a Session and updates its lifetime by the specified session_duration_minutes. If the session_duration_minutes is not specified, a Session will not be extended
- Parameters:
authParams- required to authenticate- Returns:
SessionsAuthenticateResponse
-
authenticate
abstract Unit authenticate(B2BSessions.AuthParams authParams, Function1<StytchResult<SessionsAuthenticateResponseData>, Unit> callback)
Authenticates a Session and updates its lifetime by the specified session_duration_minutes. If the session_duration_minutes is not specified, a Session will not be extended
- Parameters:
authParams- required to authenticatecallback- a callback that receives an SessionsAuthenticateResponse
-
authenticateCompletable
abstract CompletableFuture<StytchResult<SessionsAuthenticateResponseData>> authenticateCompletable(B2BSessions.AuthParams authParams)
Authenticates a Session and updates its lifetime by the specified session_duration_minutes. If the session_duration_minutes is not specified, a Session will not be extended
- Parameters:
authParams- required to authenticate- Returns:
SessionsAuthenticateResponse
-
revoke
abstract StytchResult<BasicData> revoke(B2BSessions.RevokeParams params)
Revoke a Session and immediately invalidate all its tokens.
- Parameters:
params- required for revoking a session- Returns:
BaseResponse
-
revoke
abstract Unit revoke(B2BSessions.RevokeParams params, Function1<StytchResult<BasicData>, Unit> callback)
Revoke a Session and immediately invalidate all its tokens.
- Parameters:
params- required for revoking a sessioncallback- a callback that receives a BaseResponse
-
revokeCompletable
abstract CompletableFuture<StytchResult<BasicData>> revokeCompletable(B2BSessions.RevokeParams params)
Revoke a Session and immediately invalidate all its tokens.
- Parameters:
params- required for revoking a session- Returns:
BaseResponse
-
updateSession
abstract Unit updateSession(String sessionToken, String sessionJwt)
Updates the current session with a sessionToken and sessionJwt
-
getSync
abstract B2BSessionData getSync()
Get session from memory without network call
- Returns:
locally stored B2BSessionData
-
exchange
abstract StytchResult<SessionExchangeResponseData> exchange(B2BSessions.ExchangeParameters parameters)
Exchanges an existing session for one in a different organization
- Parameters:
parameters- required for exchanging a session between organizations- Returns:
SessionExchangeResponse
-
exchange
abstract Unit exchange(B2BSessions.ExchangeParameters parameters, Function1<StytchResult<SessionExchangeResponseData>, Unit> callback)
Exchanges an existing session for one in a different organization
- Parameters:
parameters- required for exchanging a session between organizationscallback- a callback that receives a SessionExchangeResponse- Returns:
SessionExchangeResponse
-
exchangeCompletable
abstract CompletableFuture<StytchResult<SessionExchangeResponseData>> exchangeCompletable(B2BSessions.ExchangeParameters parameters)
Exchanges an existing session for one in a different organization
- Parameters:
parameters- required for exchanging a session between organizations- Returns:
SessionExchangeResponse
-
getOnChange
abstract StateFlow<StytchObjectInfo<B2BSessionData>> getOnChange()
Exposes a flow of session data
-
getSessionToken
abstract String getSessionToken()
-
getSessionJwt
abstract String getSessionJwt()
-
-
-
-