Support JWT Authentication

Closes gh-689
Original pull request: gh-802
This commit is contained in:
Nanne Baars
2023-06-28 11:15:51 +02:00
committed by Mark Paluch
parent d877da4328
commit 1367275b66
5 changed files with 435 additions and 0 deletions

View File

@@ -828,6 +828,42 @@ See also:
* https://www.vaultproject.io/api-docs/auth/radius[Vault Documentation: Using the RADIUS auth backend]
* https://www.vaultproject.io/api-docs/auth/okta[Vault Documentation: Using the Okta auth backend]
[[vault.authentication.jwt]]
== JWT authentication
Configuring JWT authentication requires at least the signed JWT to be provided:
====
[source,java]
----
@Configuration
class AppConfig extends AbstractVaultConfiguration {
// …
@Override
public ClientAuthentication clientAuthentication() {
JwtAuthenticationOptions options = JwtAuthenticationOptions.builder()
.role(…).jwt(…).path(…).build();
return new JwtAuthentication(options, restOperations());
}
// …
}
----
====
You can configure the authentication via `JwtAuthenticationOptions`.
On the Vault side you can configure the JWT backend by enabling the JWT auth backend and creating a role. You can either use `oidc_discovery_url`, `jwks_url` or `jwt_validation_pubkeys` to configure the JWT backend.
See also:
* https://developer.hashicorp.com/vault/docs/auth/jwt[Vault Documentation: Using the JWT auth backend]
[[vault.authentication.steps]]
== Authentication Steps