public class OidcService extends Object
| Modifier and Type | Field and Description |
|---|---|
private OidcIdentityProvider |
identityProvider |
private com.github.benmanes.caffeine.cache.Cache<CacheKey,String> |
jwtLookupForCompletedRequests |
private com.github.benmanes.caffeine.cache.Cache<CacheKey,com.nimbusds.oauth2.sdk.id.State> |
stateLookupForPendingRequests |
| Constructor and Description |
|---|
OidcService(OidcIdentityProvider identityProvider)
Creates a new OIDC with an expiration of 1 minute.
|
OidcService(OidcIdentityProvider identityProvider,
int duration,
TimeUnit units)
Creates a new OIDC Service.
|
| Modifier and Type | Method and Description |
|---|---|
com.nimbusds.oauth2.sdk.id.State |
createState(String oidcRequestIdentifier)
Initiates an OpenId Connection authorization code flow using the specified request identifier to maintain state.
|
String |
exchangeAuthorizationCodeForAccessToken(com.nimbusds.oauth2.sdk.AuthorizationGrant authorizationGrant)
Exchanges the specified authorization grant for an access token.
|
String |
exchangeAuthorizationCodeForIdToken(com.nimbusds.oauth2.sdk.AuthorizationGrant authorizationGrant)
Exchanges the specified authorization grant for an ID Token.
|
LoginAuthenticationToken |
exchangeAuthorizationCodeForLoginAuthenticationToken(com.nimbusds.oauth2.sdk.AuthorizationGrant authorizationGrant)
Exchanges the specified authorization grant for an ID token.
|
URI |
getAuthorizationEndpoint()
Returns the OpenId Connect authorization endpoint.
|
String |
getClientId()
Returns the OpenId Connect client id.
|
URI |
getEndSessionEndpoint()
Returns the OpenId Connect end session endpoint.
|
String |
getJwt(String oidcRequestIdentifier)
Returns the resulting JWT for the given request identifier.
|
URI |
getRevocationEndpoint()
Returns the OpenId Connect revocation endpoint.
|
com.nimbusds.oauth2.sdk.Scope |
getScope()
Returns the OpenId Connect scope.
|
boolean |
isOidcEnabled()
Returns whether OpenId Connect is enabled.
|
boolean |
isStateValid(String oidcRequestIdentifier,
com.nimbusds.oauth2.sdk.id.State proposedState)
Validates the proposed state with the given request identifier.
|
void |
storeJwt(String oidcRequestIdentifier,
String jwt)
Stores the NiFi Jwt.
|
private final OidcIdentityProvider identityProvider
private final com.github.benmanes.caffeine.cache.Cache<CacheKey,com.nimbusds.oauth2.sdk.id.State> stateLookupForPendingRequests
public OidcService(OidcIdentityProvider identityProvider)
identityProvider - The identity providerpublic OidcService(OidcIdentityProvider identityProvider, int duration, TimeUnit units)
identityProvider - The identity providerduration - The expiration durationunits - The expiration unitsNullPointerException - If units is nullIllegalArgumentException - If duration is negativepublic boolean isOidcEnabled()
public URI getAuthorizationEndpoint()
public URI getEndSessionEndpoint()
public URI getRevocationEndpoint()
public com.nimbusds.oauth2.sdk.Scope getScope()
public String getClientId()
public com.nimbusds.oauth2.sdk.id.State createState(String oidcRequestIdentifier)
oidcRequestIdentifier - request identifierpublic boolean isStateValid(String oidcRequestIdentifier, com.nimbusds.oauth2.sdk.id.State proposedState)
oidcRequestIdentifier - request identifierproposedState - proposed statepublic LoginAuthenticationToken exchangeAuthorizationCodeForLoginAuthenticationToken(com.nimbusds.oauth2.sdk.AuthorizationGrant authorizationGrant) throws IOException
authorizationGrant - authorization grantIOException - exceptional case for communication error with the OpenId Connect providerpublic String exchangeAuthorizationCodeForAccessToken(com.nimbusds.oauth2.sdk.AuthorizationGrant authorizationGrant) throws Exception
authorizationGrant - authorization grantIOException - exceptional case for communication error with the OpenId Connect providerExceptionpublic String exchangeAuthorizationCodeForIdToken(com.nimbusds.oauth2.sdk.AuthorizationGrant authorizationGrant) throws IOException
authorizationGrant - authorization grantIOException - exceptional case for communication error with the OpenId Connect providerpublic void storeJwt(String oidcRequestIdentifier, String jwt)
oidcRequestIdentifier - request identifierjwt - NiFi JWTpublic String getJwt(String oidcRequestIdentifier)
oidcRequestIdentifier - request identifierCopyright © 2023 Apache NiFi Project. All rights reserved.