Companion
Installs Oidc in this application and returns the identity-provider registry.
Use the returned Oidc to call identityProvider and keep typed route capabilities close to the issuer configuration. Registration is suspendable because it performs initial discovery, so call it from a suspend application module:
val oidc = install(Oidc) {
httpClient = openIdClient
}
val google = oidc.identityProvider("google") {
issuer = "https://accounts.google.com"
bearer {
audience = setOf("api")
}
}
val apiUser = google.jwtBearer.mapPrincipal { token -> findUser(token.claims.subject) }Content copied to clipboard
Return
Installed OpenID Connect identity-provider registry.