Class BearerToken
java.lang.Object
com.revetsec.oauth.BearerToken
An unverified credential parsed from exactly one Authorization field (RFC 6750 section 2.1).
Parsing grants no identity or permission. No public accessor exposes the credential; equality is reference
identity and diagnostic text is redacted. Query, form and cookie credentials are not accepted here.
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull BearerTokenResultParses materialized header values with a 64 KiB credential limit and a 64-byte prefix allowance, returning absent, present or malformed.static @NonNull BearerTokenResultfromAuthorizationHeaderValuesResult(@NonNull List<@NonNull String> values, @NonNull Integer maximumTokenLength) Parses one case-insensitive Bearer scheme, one to 58 ASCII spaces, and RFC 6750 b64token text.toString()Returns a description containing no credential.
-
Method Details
-
fromAuthorizationHeaderValuesResult
@CheckReturnValue public static @NonNull BearerTokenResult fromAuthorizationHeaderValuesResult(@NonNull List<@NonNull String> values) Parses materialized header values with a 64 KiB credential limit and a 64-byte prefix allowance, returning absent, present or malformed. Other schemes and duplicate fields are malformed, including identical duplicates. Applications must preserve duplicates or reject them at a trusted edge. A present credential remains unverified and grants no identity or permission.- Parameters:
values- all materialized Authorization values, preserving duplicates- Returns:
- the header parsing outcome
- Throws:
NullPointerException- if the list or its sole value is null- Since:
- 1.0.0
-
fromAuthorizationHeaderValuesResult
@CheckReturnValue public static @NonNull BearerTokenResult fromAuthorizationHeaderValuesResult(@NonNull List<@NonNull String> values, @NonNull Integer maximumTokenLength) Parses one case-insensitive Bearer scheme, one to 58 ASCII spaces, and RFC 6750 b64token text. Padding is permitted only at the end. Bounds are checked before copying the credential. No raw credential appears on absent or malformed outcomes.- Parameters:
values- all materialized Authorization values, preserving duplicatesmaximumTokenLength- credential limit from 8 KiB through 1 MiB- Returns:
- the header parsing outcome
- Throws:
NullPointerException- if a required argument is nullIllegalArgumentException- if the configured limit is invalid- Since:
- 1.0.0
-
toString
-