Package org.gcube.common.iam
Class OIDCBearerAuth
java.lang.Object
org.gcube.common.iam.AbstractIAMResponse
org.gcube.common.iam.D4ScienceIAMClientAuthn
org.gcube.common.iam.OIDCBearerAuth
- All Implemented Interfaces:
IAMResponse
OIDC Bearer authentication implementation for handling bearer tokens.
Provides utility methods to construct authentication objects from various token formats.
- Author:
- Mauro Mugnaini (Nubisware S.r.l.)
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOIDCBearerAuth(D4ScienceIAMClient iamClient, org.gcube.common.keycloak.model.TokenResponse tokenResponse) Creates a new OIDC bearer authentication instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic OIDCBearerAuthfromAccessTokenString(String accessToken) Deprecated.static OIDCBearerAuthfromAccessTokenString(String accessToken, D4ScienceIAMClient iamClient) Constructs a new object from an access-token string bound to the given (configured, trusted) IAM client: nothing is taken from the token to choose the IAM server.static OIDCBearerAuthfromAuthorizationHeader(String authorizationHeader) Deprecated.the realm is taken from the unverifiedissclaim of the token; usefromAccessTokenString(String, D4ScienceIAMClient)with the client of the configured IAM server andD4ScienceIAMClient.introspect(String, String, String)to validate itstatic OIDCBearerAuthfromBearerAuthorization(String bearerAuthorization) Deprecated.Methods inherited from class org.gcube.common.iam.D4ScienceIAMClientAuthn
authorize, authorizeMethods inherited from class org.gcube.common.iam.AbstractIAMResponse
canBeRefreshed, exchange, exchangeForRefreshToken, getAccessToken, getAccessTokenExpiryMillis, getAccessTokenString, getAudience, getAuthorizedParty, getContactOrganization, getContactPerson, getContext, getContextRoles, getEmail, getExpiresIn, getFamilyName, getGivenName, getGlobalRoles, getIamClient, getIdTokenString, getName, getPreferredUsername, getRefreshExpiresIn, getRefreshTokenExpiryMillis, getRefreshTokenString, getResourceAccessRoles, getResourceRoles, getRoles, getSubject, getTokenResponse, isAccessTokenValid, isAccessTokenValid, isExpired, isRefreshTokenValid, isRefreshTokenValid, logout, logout, refresh, refresh, setIamClient, setTokenResponse, verifyAccessToken, verifyAccessToken, verifyRefreshToken, verifyRefreshToken
-
Constructor Details
-
OIDCBearerAuth
protected OIDCBearerAuth(D4ScienceIAMClient iamClient, org.gcube.common.keycloak.model.TokenResponse tokenResponse) Creates a new OIDC bearer authentication instance.- Parameters:
iamClient- the IAM clienttokenResponse- the token response
-
-
Method Details
-
fromAuthorizationHeader
Deprecated.the realm is taken from the unverifiedissclaim of the token; usefromAccessTokenString(String, D4ScienceIAMClient)with the client of the configured IAM server andD4ScienceIAMClient.introspect(String, String, String)to validate itConstructs a new object from an HTTP authorization header containing the bearer token with an OIDC access-token.- Parameters:
authorizationHeader- the HTTP authorization header- Returns:
- the auth object
-
fromBearerAuthorization
Deprecated.Constructs a new object from a bearer token with an OIDC access-token.- Parameters:
bearerAuthorization- the bearer token (with or without 'bearer ' prefix- Returns:
- the auth object
-
fromAccessTokenString
Deprecated.Constructs a new object from an OIDC base64 encoded access-token string.- Parameters:
accessToken- the OIDC base64 encoded access-token string- Returns:
- the auth object
-
fromAccessTokenString
public static OIDCBearerAuth fromAccessTokenString(String accessToken, D4ScienceIAMClient iamClient) Constructs a new object from an access-token string bound to the given (configured, trusted) IAM client: nothing is taken from the token to choose the IAM server. The token is NOT verified here: validate it withD4ScienceIAMClient.introspect(String, String, String).- Parameters:
accessToken- the OIDC base64 encoded access-token stringiamClient- the client of the IAM server the service trusts- Returns:
- the auth object
-
fromAuthorizationHeader(String)