Class MicrosoftAuthConfig
clientId is the
host's own Azure application id and is required — the library ships no default, so an
implementer must register their own app rather than sharing one. The scope, the local redirect path,
and every service endpoint default to the public Microsoft / Xbox / Minecraft URLs and are only
overridden when an implementer fronts them with a proxy or targets a non-standard deployment.
Build the common case with of(String) and adjust with the withX copy methods.
A legacy MSA application is a different protocol dialect and comes from
legacyMsa(String). A blank optional value always falls back to its default.
A final class rather than a record since 1.0.0, so a later setting is an addition and not a break. Two configs are equal when every value is.
- Since:
- 0.2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault OAuth authorize endpoint.static final StringDefault device-authorization endpoint, on the consumers tenant of the Microsoft identity platform.static final StringDefault token endpoint the device-code login polls.static final StringDefault Minecraft services login-with-Xbox endpoint.static final StringDefault Minecraft services profile endpoint.static final StringDefault loopback callback path — intentionally long to reduce accidental screen-share exposure.static final StringPrefix marking an OAuth 2.0 access token as delegated when it is exchanged at Xbox Live.static final StringDefault OAuth scope for a Minecraft login.static final StringDefault OAuth token endpoint.static final StringDefault Xbox Live user-authentication endpoint.static final StringDefault XSTS authorization endpoint.static final StringThe redirect a legacy MSA application's token grant must declare.static final StringPrefix marking a legacy MSA access token as an RPS ticket proper.static final StringThe scope a legacy MSA application authenticates Xbox Live with. -
Method Summary
Modifier and TypeMethodDescriptionReturns the OAuth authorize endpoint.clientId()Returns the host's Azure application (OAuth) client id.Returns the device-authorization endpoint the device-code login starts at.Returns the token endpoint the device-code login polls.booleanReturns whetherois a config with every value equal to this one's.inthashCode()Returns a hash over every value, consistent withequals(Object).static MicrosoftAuthConfigCreates a config for a legacy MSA application — the pre-Azure registration shape.Returns the Minecraft services login-with-Xbox endpoint.Returns the Minecraft services profile endpoint.static MicrosoftAuthConfigCreates a config for the given client id with every other value defaulted.Returns the local callback path the loopback redirect server listens on.Returns theredirect_urithe refresh grant must carry; the authorization-code grant ignores this and uses the address the callback server actually served.Returns the prefix the Microsoft access token carries into the Xbox Live RPS ticket.scope()Returns the OAuth scope to request.tokenUrl()Returns the OAuth token endpoint.toString()Returns every value, in the form the record printed them.withClientId(String value) Returns a copy targeting a different application, keeping the dialect and endpoints.withDeviceCodeEndpoints(String deviceCodeUrl, String deviceTokenUrl) Returns a copy with the two device-code endpoints replaced (each null/blank argument keeps its default).withEndpoints(String authorizeUrl, String tokenUrl, String xboxLiveAuthUrl, String xstsAuthUrl, String minecraftLoginUrl, String minecraftProfileUrl) Returns a copy with all six service endpoints replaced (each null/blank argument keeps its default).withRedirectPath(String value) Returns a copy with the local redirect path replaced.withRedirectUri(String value) Returns a copy with theredirect_urithe refresh grant carries replaced.withRpsTicketPrefix(String value) Returns a copy with the RPS ticket prefix replaced.Returns a copy with the OAuth scope replaced.Returns the Xbox Live user-authentication endpoint.Returns the XSTS authorization endpoint.
-
Field Details
-
DEFAULT_SCOPE
Default OAuth scope for a Minecraft login.- Since:
- 0.2.0
- See Also:
-
DEFAULT_REDIRECT_PATH
Default loopback callback path — intentionally long to reduce accidental screen-share exposure. The browser sign-in redirects tohttp://localhost:<port>followed by this path, so the host's app registration lists it. Changed in 1.0.0: a registration that lists the 0.12 default keeps working by passing that path towithRedirectPath(String).- Since:
- 0.2.0
- See Also:
-
DEFAULT_AUTHORIZE_URL
Default OAuth authorize endpoint.- Since:
- 0.2.0
- See Also:
-
DEFAULT_TOKEN_URL
-
DEFAULT_XBOX_LIVE_AUTH_URL
Default Xbox Live user-authentication endpoint.- Since:
- 0.2.0
- See Also:
-
DEFAULT_XSTS_AUTH_URL
Default XSTS authorization endpoint.- Since:
- 0.2.0
- See Also:
-
DEFAULT_MINECRAFT_LOGIN_URL
Default Minecraft services login-with-Xbox endpoint.- Since:
- 0.2.0
- See Also:
-
DEFAULT_MINECRAFT_PROFILE_URL
Default Minecraft services profile endpoint.- Since:
- 0.2.0
- See Also:
-
DEFAULT_RPS_TICKET_PREFIX
Prefix marking an OAuth 2.0 access token as delegated when it is exchanged at Xbox Live.- Since:
- 0.7.0
- See Also:
-
LEGACY_MSA_SCOPE
The scope a legacy MSA application authenticates Xbox Live with.- Since:
- 0.7.0
- See Also:
-
LEGACY_MSA_REDIRECT_URI
The redirect a legacy MSA application's token grant must declare.- Since:
- 0.7.0
- See Also:
-
LEGACY_MSA_RPS_TICKET_PREFIX
Prefix marking a legacy MSA access token as an RPS ticket proper.- Since:
- 0.7.0
- See Also:
-
DEFAULT_DEVICE_CODE_URL
Default device-authorization endpoint, on the consumers tenant of the Microsoft identity platform.- Since:
- 0.12.0
- See Also:
-
DEFAULT_DEVICE_TOKEN_URL
Default token endpoint the device-code login polls. It is a different endpoint fromDEFAULT_TOKEN_URL: a device code is redeemed where it was issued.- Since:
- 0.12.0
- See Also:
-
-
Method Details
-
of
Creates a config for the given client id with every other value defaulted.- Parameters:
clientId- the host's Azure application client id; required- Returns:
- a fully-defaulted config
- Since:
- 0.2.0
-
legacyMsa
Creates a config for a legacy MSA application — the pre-Azure registration shape.Three things differ from an OAuth app and all three are load-bearing: the token grant must declare
LEGACY_MSA_REDIRECT_URI, it must ask forLEGACY_MSA_SCOPEinstead of the delegated Xbox scopes, and the access token it returns is an RPS ticket that Xbox Live wants prefixedt=rather thand=. Sending the OAuth shape to one of these apps is answered with a flat400.Refresh tokens are the practical use: the interactive browser flow needs the desktop redirect these apps declare, which the loopback callback server cannot serve.
- Parameters:
clientId- the legacy application id; required- Returns:
- a config speaking the legacy MSA dialect
- Since:
- 0.7.0
-
withClientId
Returns a copy targeting a different application, keeping the dialect and endpoints.- Parameters:
value- the new client id; required- Returns:
- a copy with the client id replaced
- Since:
- 0.7.0
-
withScope
Returns a copy with the OAuth scope replaced.- Parameters:
value- the new scope, or null/blank to keep the default- Returns:
- a copy with the scope replaced
- Since:
- 0.2.0
-
withRedirectPath
Returns a copy with the local redirect path replaced.- Parameters:
value- the new redirect path, or null/blank to keep the default- Returns:
- a copy with the redirect path replaced
- Since:
- 0.2.0
-
withEndpoints
public MicrosoftAuthConfig withEndpoints(String authorizeUrl, String tokenUrl, String xboxLiveAuthUrl, String xstsAuthUrl, String minecraftLoginUrl, String minecraftProfileUrl) Returns a copy with all six service endpoints replaced (each null/blank argument keeps its default). For implementers fronting Microsoft / Xbox / Minecraft services with their own proxy.- Parameters:
authorizeUrl- the OAuth authorize endpointtokenUrl- the OAuth token endpointxboxLiveAuthUrl- the Xbox Live user-authentication endpointxstsAuthUrl- the XSTS authorization endpointminecraftLoginUrl- the Minecraft services login-with-Xbox endpointminecraftProfileUrl- the Minecraft services profile endpoint- Returns:
- a copy with the endpoints replaced
- Since:
- 0.2.0
-
withDeviceCodeEndpoints
Returns a copy with the two device-code endpoints replaced (each null/blank argument keeps its default). Kept apart fromwithEndpoints(String, String, String, String, String, String)so that method's signature is unchanged.- Parameters:
deviceCodeUrl- the device-authorization endpointdeviceTokenUrl- the token endpoint the device-code login polls- Returns:
- a copy with the device-code endpoints replaced
- Since:
- 0.12.0
-
clientId
Returns the host's Azure application (OAuth) client id.- Returns:
- the client id
- Since:
- 0.2.0
-
scope
Returns the OAuth scope to request.- Returns:
- the value, defaulted when none was given
- Since:
- 0.2.0
-
redirectPath
Returns the local callback path the loopback redirect server listens on.- Returns:
- the value, defaulted when none was given
- Since:
- 0.2.0
-
authorizeUrl
Returns the OAuth authorize endpoint.- Returns:
- the value, defaulted when none was given
- Since:
- 0.2.0
-
tokenUrl
Returns the OAuth token endpoint.- Returns:
- the value, defaulted when none was given
- Since:
- 0.2.0
-
xboxLiveAuthUrl
Returns the Xbox Live user-authentication endpoint.- Returns:
- the value, defaulted when none was given
- Since:
- 0.2.0
-
xstsAuthUrl
Returns the XSTS authorization endpoint.- Returns:
- the value, defaulted when none was given
- Since:
- 0.2.0
-
minecraftLoginUrl
Returns the Minecraft services login-with-Xbox endpoint.- Returns:
- the value, defaulted when none was given
- Since:
- 0.2.0
-
minecraftProfileUrl
Returns the Minecraft services profile endpoint.- Returns:
- the value, defaulted when none was given
- Since:
- 0.2.0
-
redirectUri
Returns theredirect_urithe refresh grant must carry; the authorization-code grant ignores this and uses the address the callback server actually served.- Returns:
- the redirect URI, or
nullto omit it - Since:
- 0.7.0
-
rpsTicketPrefix
Returns the prefix the Microsoft access token carries into the Xbox Live RPS ticket.- Returns:
- the value, defaulted when none was given
- Since:
- 0.7.0
-
deviceCodeUrl
Returns the device-authorization endpoint the device-code login starts at.- Returns:
- the value, defaulted when none was given
- Since:
- 0.12.0
-
deviceTokenUrl
Returns the token endpoint the device-code login polls.- Returns:
- the value, defaulted when none was given
- Since:
- 0.12.0
-
withRedirectUri
Returns a copy with theredirect_urithe refresh grant carries replaced. An OAuth app's refresh grant carries none; a legacy MSA app's declaresLEGACY_MSA_REDIRECT_URI.- Parameters:
value- the redirect URI, or null/blank to omit it- Returns:
- a copy with the redirect URI replaced
- Since:
- 1.0.0
-
withRpsTicketPrefix
Returns a copy with the RPS ticket prefix replaced.- Parameters:
value- the prefix, or null/blank to keep the default (DEFAULT_RPS_TICKET_PREFIX)- Returns:
- a copy with the prefix replaced
- Since:
- 1.0.0
-
equals
-
hashCode
public int hashCode()Returns a hash over every value, consistent withequals(Object). -
toString
-