Class OAuthClient
java.lang.Object
com.hypixel.hytale.server.core.auth.oauth.OAuthClient
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpClientprivate static final com.hypixel.hytale.logger.HytaleLoggerprivate static final SecureRandom -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringbuildAuthUrl(String state, String codeChallenge, String redirectUri) private static StringbuildHtmlPage(boolean success, String title, String heading, String message, String errorDetail) private StringencodeStateWithPort(String state, int port) private OAuthClient.TokenResponseexchangeCodeForTokens(String code, String codeVerifier, String redirectUri) private StringextractParam(String query, String name) private StringgenerateCodeChallenge(String verifier) private StringgenerateRandomString(int length) private static intgetJsonInt(com.google.gson.JsonObject obj, String key, int defaultValue) private static StringgetJsonString(com.google.gson.JsonObject obj, String key) private OAuthClient.DeviceAuthResponseprivate OAuthClient.TokenResponseparseTokenResponse(String json) private OAuthClient.TokenResponsepollDeviceToken(String deviceCode) refreshTokens(String refreshToken) private OAuthClient.DeviceAuthResponsestartFlow(OAuthBrowserFlow flow) startFlow(OAuthDeviceFlow flow)
-
Field Details
-
LOGGER
private static final com.hypixel.hytale.logger.HytaleLogger LOGGER -
RANDOM
-
httpClient
-
-
Constructor Details
-
OAuthClient
public OAuthClient()
-
-
Method Details
-
startFlow
-
startFlow
-
refreshTokens
-
buildAuthUrl
-
exchangeCodeForTokens
@Nullable private OAuthClient.TokenResponse exchangeCodeForTokens(String code, String codeVerifier, String redirectUri) -
requestDeviceAuthorization
-
pollDeviceToken
-
generateRandomString
-
generateCodeChallenge
-
extractParam
-
encodeStateWithPort
-
parseTokenResponse
-
parseDeviceAuthResponse
-
getJsonString
-
getJsonInt
-
buildHtmlPage
-