Class ClientAuthentication
java.lang.Object
com.revetsec.oauth.ClientAuthentication
One OAuth client authentication strategy. A supplier is consulted once per outgoing request, supporting a
rotating client secret; its result is never placed in a URL, exception or string rendering. Supplier
implementations must be thread-safe when the client is shared between threads.
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classConfigures assertion audience and lifetime. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull ClientAuthenticationfromClientSecretBasic(@NonNull String secret) Selects RFC 6749 client-secret Basic with form encoding.static @NonNull ClientAuthenticationfromClientSecretBasic(@NonNull String secret, @NonNull ClientSecretBasicEncoding encoding) Selects client-secret Basic with an explicit encoding choice.static @NonNull ClientAuthenticationfromClientSecretPost(@NonNull String secret) Selects client-secret POST with a fixed secret.static @NonNull ClientAuthenticationfromClientSecretPost(@NonNull Supplier<@NonNull String> secretSupplier) Selects client-secret POST with a supplier called once per request.static @NonNull ClientAuthenticationfromPrivateKeyJwt(@NonNull ClientAssertionKeyProvider keyProvider) Selects generated private-key assertions with the issuer audience and 60-second lifetime.static @NonNull ClientAuthenticationSelects no client authentication for a public client.toString()Redacts the strategy and any secret.withPrivateKeyJwt(@NonNull ClientAssertionKeyProvider keyProvider) Starts private-key assertion configuration without selecting a key or signing.
-
Method Details
-
noneInstance
Selects no client authentication for a public client.- Returns:
- the shared public-client strategy
- Since:
- 1.0.0
-
fromClientSecretBasic
Selects RFC 6749 client-secret Basic with form encoding.- Parameters:
secret- the nonempty secret- Returns:
- the strategy
- Since:
- 1.0.0
-
fromClientSecretBasic
public static @NonNull ClientAuthentication fromClientSecretBasic(@NonNull String secret, @NonNull ClientSecretBasicEncoding encoding) Selects client-secret Basic with an explicit encoding choice.- Parameters:
secret- the nonempty secretencoding- the encoding- Returns:
- the strategy
- Since:
- 1.0.0
-
fromClientSecretPost
Selects client-secret POST with a fixed secret.- Parameters:
secret- the nonempty secret- Returns:
- the strategy
- Since:
- 1.0.0
-
fromClientSecretPost
public static @NonNull ClientAuthentication fromClientSecretPost(@NonNull Supplier<@NonNull String> secretSupplier) Selects client-secret POST with a supplier called once per request.- Parameters:
secretSupplier- the supplier- Returns:
- the strategy
- Since:
- 1.0.0
-
fromPrivateKeyJwt
@CheckReturnValue public static @NonNull ClientAuthentication fromPrivateKeyJwt(@NonNull ClientAssertionKeyProvider keyProvider) Selects generated private-key assertions with the issuer audience and 60-second lifetime.- Parameters:
keyProvider- thread-safe cooperative key provider- Returns:
- the strategy
- Since:
- 1.0.0
-
withPrivateKeyJwt
@CheckReturnValue public static @NonNull ClientAuthentication.PrivateKeyJwtBuilder withPrivateKeyJwt(@NonNull ClientAssertionKeyProvider keyProvider) Starts private-key assertion configuration without selecting a key or signing.- Parameters:
keyProvider- thread-safe cooperative key provider- Returns:
- the builder
- Since:
- 1.0.0
-
toString
-