ServerAuthManager

public class ServerAuthManager

Class ServerAuthManager. Provides serverauthmanager functionality for the Hytale server.

java.lang.Object > ServerAuthManager

Field Summary

oauthClient

private OAuthClient oauthClient

Field oauthClient.

refreshTask

private ScheduledFuture refreshTask

Field refreshTask.

cancelActiveFlow

private Runnable cancelActiveFlow

Field cancelActiveFlow.

t

final Thread t

Field t.

optionSet

final OptionSet optionSet

Field optionSet.

ownerProfile

final SessionServiceClient.GameProfile ownerProfile

Field ownerProfile.

envToken

final String envToken

Field envToken.

session

final SessionServiceClient.GameSessionResponse session

Field session.

provider

final AuthCredentialStoreProvider provider

Field provider.

store

final IAuthCredentialStore store

Field store.

tokens

final IAuthCredentialStore.OAuthTokens tokens

Field tokens.

result

final AuthResult result

Field result.

cert

final X509Certificate cert

Field cert.

oldStore

final IAuthCredentialStore oldStore

Field oldStore.

newStore

final IAuthCredentialStore newStore

Field newStore.

profile

final UUID profile

Field profile.

accessToken

final String accessToken

Field accessToken.

profiles

final SessionServiceClient.GameProfile[] profiles

Field profiles.

profile2

final SessionServiceClient.GameProfile profile2

Field profile2.

expiresAt

final Instant expiresAt

Field expiresAt.

refreshToken

final String refreshToken

Field refreshToken.

newTokens

final OAuthClient.TokenResponse newTokens

Field newTokens.

requestedUuid

final UUID requestedUuid

Field requestedUuid.

profileUuid

final UUID profileUuid

Field profileUuid.

newSession

final SessionServiceClient.GameSessionResponse newSession

Field newSession.

expiresAtInstant

final Instant expiresAtInstant

Field expiresAtInstant.

secondsUntilExpiry

final long secondsUntilExpiry

Field secondsUntilExpiry.

mode

final AuthMode mode

Field mode.

selected

final SessionServiceClient.GameProfile selected

Field selected.

validator

final JWTValidator validator

Field validator.

claims

final JWTValidator.IdentityTokenClaims claims

Field claims.

claims2

final JWTValidator.SessionTokenClaims claims2

Field claims2.

expiry

final Instant expiry

Field expiry.

idToken

final String idToken

Field idToken.

parts

final String[] parts

Field parts.

payload

final String payload

Field payload.

json

final JsonObject json

Field json.

exp

final long exp

Field exp.

secondsUntilExpiry2

final long secondsUntilExpiry2

Field secondsUntilExpiry2.

refreshDelay

final long refreshDelay

Field refreshDelay.

currentSessionToken

final String currentSessionToken

Field currentSessionToken.

response

final SessionServiceClient.GameSessionResponse response

Field response.

supported

final boolean supported

Field supported.

currentProfile

final UUID currentProfile

Field currentProfile.

sb

final StringBuilder sb

Field sb.

secondsRemaining

final long secondsRemaining

Field secondsRemaining.

Method Detail

ServerAuthManager

public private ServerAuthManager ()

Method ServerAuthManager.

DefaultAuthCredentialStore

public new DefaultAuthCredentialStore ()

Method DefaultAuthCredentialStore.

initialize

public void initialize ()

Method initialize.

initializeCredentialStore

public void initializeCredentialStore ()

Method initializeCredentialStore.

if

public else if (result == AuthResult.PENDING_PROFILE_SELECTION)

Method if.

Parameters:
result == AuthResult.PENDING_PROFILE_SELECTION

getInstance

static ServerAuthManager getInstance ()

Method getInstance.

getGameSession

public SessionServiceClient.GameSessionResponse getGameSession ()

Method getGameSession.

getIdentityToken

public String getIdentityToken ()

Method getIdentityToken.

getSessionToken

public String getSessionToken ()

Method getSessionToken.

setGameSession

public void setGameSession (@Nonnull final SessionServiceClient.GameSessionResponse session)

Method setGameSession.

Parameters:
@Nonnull final SessionServiceClient.GameSessionResponse session

hasIdentityToken

public boolean hasIdentityToken ()

Method hasIdentityToken.

hasSessionToken

public boolean hasSessionToken ()

Method hasSessionToken.

setServerCertificate

public void setServerCertificate (@Nonnull final X509Certificate certificate)

Method setServerCertificate.

Parameters:
@Nonnull final X509Certificate certificate

getServerCertificate

public X509Certificate getServerCertificate ()

Method getServerCertificate.

getServerCertificateFingerprint

public String getServerCertificateFingerprint ()

Method getServerCertificateFingerprint.

getServerSessionId

public UUID getServerSessionId ()

Method getServerSessionId.

startFlowAsync

public CompletableFuture startFlowAsync (@Nonnull final OAuthBrowserFlow flow)

Method startFlowAsync.

Parameters:
@Nonnull final OAuthBrowserFlow flow

registerCredentialStore

public CompletableFuture registerCredentialStore (final IAuthCredentialStore store)

Method registerCredentialStore.

Parameters:
final IAuthCredentialStore store

swapCredentialStoreProvider

public void swapCredentialStoreProvider (@Nonnull final AuthCredentialStoreProvider provider)

Method swapCredentialStoreProvider.

Parameters:
@Nonnull final AuthCredentialStoreProvider provider

createGameSessionFromOAuth

private AuthResult createGameSessionFromOAuth (final AuthMode mode)

Method createGameSessionFromOAuth.

Parameters:
final AuthMode mode

refreshOAuthTokens

private boolean refreshOAuthTokens ()

Method refreshOAuthTokens.

tryAutoSelectProfile

private SessionServiceClient.GameProfile tryAutoSelectProfile (final SessionServiceClient.GameProfile[] profiles)

Method tryAutoSelectProfile.

Parameters:
final SessionServiceClient.GameProfile[] profiles

completeAuthWithProfile

private boolean completeAuthWithProfile (final SessionServiceClient.GameProfile profile, final AuthMode mode)

Method completeAuthWithProfile.

Parameters:
final SessionServiceClient.GameProfile profile
final AuthMode mode

getPendingProfiles

public SessionServiceClient.GameProfile[] getPendingProfiles ()

Method getPendingProfiles.

hasPendingProfiles

public boolean hasPendingProfiles ()

Method hasPendingProfiles.

selectPendingProfile

public boolean selectPendingProfile (final int index)

Method selectPendingProfile.

Parameters:
final int index

selectPendingProfileByUsername

public boolean selectPendingProfileByUsername (final String username)

Method selectPendingProfileByUsername.

Parameters:
final String username

clearPendingProfiles

public void clearPendingProfiles ()

Method clearPendingProfiles.

cancelActiveFlow

public boolean cancelActiveFlow ()

Method cancelActiveFlow.

validateInitialTokens

private boolean validateInitialTokens (@Nullable final String sessionToken, @Nullable final String identityToken)

Method validateInitialTokens.

Parameters:
@Nullable final String sessionToken
@Nullable final String identityToken

parseAndScheduleRefresh

private void parseAndScheduleRefresh ()

Method parseAndScheduleRefresh.

String

public new String (Base64.getUrlDecoder()

Method String.

Parameters:
Base64.getUrlDecoder( Base64.getUrlDecoder(

scheduleRefresh

private void scheduleRefresh (final int expiresInSeconds)

Method scheduleRefresh.

Parameters:
final int expiresInSeconds

doRefresh

private void doRefresh ()

Method doRefresh.

refreshGameSession

private boolean refreshGameSession (final String currentSessionToken)

Method refreshGameSession.

Parameters:
final String currentSessionToken

refreshGameSessionViaOAuth

private boolean refreshGameSessionViaOAuth ()

Method refreshGameSessionViaOAuth.

createGameSession

private SessionServiceClient.GameSessionResponse createGameSession (final UUID profileUuid)

Method createGameSession.

Parameters:
final UUID profileUuid

logout

public void logout ()

Method logout.

getAuthMode

public AuthMode getAuthMode ()

Method getAuthMode.

isSingleplayer

public boolean isSingleplayer ()

Method isSingleplayer.

isOwner

public boolean isOwner (@Nullable final UUID playerUuid)

Method isOwner.

Parameters:
@Nullable final UUID playerUuid

getSelectedProfile

public SessionServiceClient.GameProfile getSelectedProfile ()

Method getSelectedProfile.

getTokenExpiry

public Instant getTokenExpiry ()

Method getTokenExpiry.

getAuthStatus

public String getAuthStatus ()

Method getAuthStatus.

shutdown

public void shutdown ()

Method shutdown.