Class AuthorizationResponse
java.lang.Object
com.revetsec.oauth.AuthorizationResponse
A parsed browser authorization response. It preserves repeated parameters so a duplicate cannot be silently
selected. Its delivery mode comes from the application route and method, never from callback data. Parsing does
not authenticate the response;
OAuthClient checks its pending state before trusting any error or code.- Since:
- 1.0.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionfromFormBodyResult(byte @NonNull [] body, @NonNull Charset charset, @Nullable String rawQueryOrNull) Parses a UTF-8 form-post body.fromFormBodyResult(byte @NonNull [] body, @NonNull List<@NonNull String> contentTypeHeaderValues, @Nullable String rawQueryOrNull) Parses a form-post callback after validating every raw Content-Type occurrence.fromParametersResult(@NonNull Map<@NonNull String, @NonNull List<@NonNull String>> values, @Nullable String rawQueryOrNull, @NonNull AuthorizationRequestOptions.ResponseMode responseMode) Accepts parameters from an application parser, retaining multiplicity and the explicit route mode.fromQueryStringResult(@NonNull String rawQuery) Parses a raw URL query, without the question mark, keeping malformed input as a rejected result.getCode()Returns the code, if present and nonempty.getError()Returns an authorization error, if present and nonempty.Returns untrusted error prose, if present, with non-NQSCHAR characters replaced and at most 1,024 characters.Returns the absolute error URI, if present and nonempty.Returns the RFC 9207 issuer, if present and nonempty.Returns every decoded parameter, including unsigned provider extras.Returns the optional per-flow cookie name derived from state.Returns the callback mode established by trusted application routing.getState()Returns the state, if present and nonempty.toString()Redacts all callback parameters.
-
Method Details
-
fromQueryStringResult
@CheckReturnValue public static @NonNull AuthorizationResponseParseResult fromQueryStringResult(@NonNull String rawQuery) Parses a raw URL query, without the question mark, keeping malformed input as a rejected result. A successful parse grants no identity and does not validate the pending authorization transaction.- Parameters:
rawQuery- the raw query- Returns:
- the unverified callback or a fixed rejection reason
- Throws:
NullPointerException- if rawQuery is null- Since:
- 1.0.0
-
fromFormBodyResult
@CheckReturnValue public static @NonNull AuthorizationResponseParseResult fromFormBodyResult(byte @NonNull [] body, @NonNull Charset charset, @Nullable String rawQueryOrNull) Parses a UTF-8 form-post body. Protocol members in the query reject split-channel responses; safe nonprotocol query parameters remain untrusted extras. Invalid charset, encoding, size or parameters produce rejection.- Parameters:
body- the form bytescharset- the application's parsed Content-Type charset, which must be UTF-8rawQueryOrNull- the URL's raw query, if any- Returns:
- the unverified callback or a fixed rejection reason
- Throws:
NullPointerException- if body or charset is null- Since:
- 1.0.0
-
fromFormBodyResult
@CheckReturnValue public static @NonNull AuthorizationResponseParseResult fromFormBodyResult(byte @NonNull [] body, @NonNull List<@NonNull String> contentTypeHeaderValues, @Nullable String rawQueryOrNull) Parses a form-post callback after validating every raw Content-Type occurrence. Requires exactly one form field with an absent or UTF-8 charset and no duplicate MIME parameters. The field is capped at 8,192 characters before MIME parsing. Preserve materialized duplicates; a trusted edge rejects physical fields discarded by a transport. Invalid MIME, body, duplicate parameters and split channels produce rejection.- Parameters:
body- the raw form bytescontentTypeHeaderValues- all materialized Content-Type valuesrawQueryOrNull- the raw URL query, if any- Returns:
- the unverified callback or a fixed rejection reason
- Throws:
NullPointerException- if body, header list or its sole field is null- Since:
- 1.0.0
-
fromParametersResult
@CheckReturnValue public static @NonNull AuthorizationResponseParseResult fromParametersResult(@NonNull Map<@NonNull String, @NonNull List<@NonNull String>> values, @Nullable String rawQueryOrNull, @NonNull AuthorizationRequestOptions.ResponseMode responseMode) Accepts parameters from an application parser, retaining multiplicity and the explicit route mode. Malformed, duplicate, oversized or split-channel parameters produce rejection. Success remains unverified.- Parameters:
values- decoded parameters, with all values for each namerawQueryOrNull- the URL query when the mode is form-post, if anyresponseMode- mode established by trusted application routing- Returns:
- the unverified callback or a fixed rejection reason
- Throws:
NullPointerException- if values, a parameter name/list/value or responseMode is null- Since:
- 1.0.0
-
getCode
-
getState
-
getIssuer
-
getError
-
getErrorDescription
Returns untrusted error prose, if present, with non-NQSCHAR characters replaced and at most 1,024 characters. Do not log it without application redaction. The raw value remains available ingetParameters().- Returns:
- the prose
- Since:
- 1.0.0
-
getErrorUri
Returns the absolute error URI, if present and nonempty. Parsing rejects a malformed supplied URI. This is untrusted provider data with no navigation, scheme or destination authorization. Never automatically redirect, fetch or render it as active content. Applications choosing to expose a link must apply their own exact HTTPS destination allowlist and safe HTML rendering.- Returns:
- the URI
- Since:
- 1.0.0
-
getParameters
-
getResponseMode
Returns the callback mode established by trusted application routing.- Returns:
- the mode
- Since:
- 1.0.0
-
getPerFlowCookieName
Returns the optional per-flow cookie name derived from state. The suffix is a selector, not an authenticator.- Returns:
- the cookie name when nonempty state is present
- Since:
- 1.0.0
-
toString
-