Class RedirectionBasedGrantService
java.lang.Object
org.apache.cxf.rs.security.oauth2.services.AbstractOAuthService
org.apache.cxf.rs.security.oauth2.services.RedirectionBasedGrantService
- Direct Known Subclasses:
AbstractImplicitGrantService,AuthorizationCodeGrantService
The Base Redirection-Based Grant Service
-
Field Summary
Fields inherited from class org.apache.cxf.rs.security.oauth2.services.AbstractOAuthService
LOG -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRedirectionBasedGrantService(String supportedResponseType, String supportedGrantType) protectedRedirectionBasedGrantService(Set<String> supportedResponseTypes, String supportedGrantType) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseHandles the initial authorization request by preparing the authorization challenge data and returning it to the user.jakarta.ws.rs.core.ResponseProcesses the end user decisionjakarta.ws.rs.core.ResponseauthorizeDecisionForm(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Processes the end user decisionjakarta.ws.rs.core.ResponseauthorizePost(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Handles the initial authorization request by preparing the authorization challenge data and returning it to the user.protected booleancanAccessTokenBeReturned(String responseType) protected booleancanAuthorizationBeSkipped(jakarta.ws.rs.core.MultivaluedMap<String, String> params, Client client, UserSubject userSubject, List<String> requestedScope, List<OAuthPermission> permissions) protected abstract booleanprotected abstract booleanprotected jakarta.ws.rs.core.ResponsecompleteAuthorization(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Completes the authorization processprotected OAuthAuthorizationDatacreateAuthorizationData(Client client, jakarta.ws.rs.core.MultivaluedMap<String, String> params, String redirectUri, UserSubject subject, List<OAuthPermission> requestedPerms, List<OAuthPermission> alreadyAuthorizedPerms, boolean authorizationCanBeSkipped) Create the authorization challenge dataprotected jakarta.ws.rs.core.ResponsecreateErrorResponse(jakarta.ws.rs.core.MultivaluedMap<String, String> params, String redirectUri, String error) protected abstract jakarta.ws.rs.core.ResponsecreateErrorResponse(String state, String redirectUri, String error) protected abstract jakarta.ws.rs.core.ResponsecreateGrant(OAuthRedirectionState state, Client client, List<String> requestedScope, List<String> approvedScope, UserSubject userSubject, ServerAccessToken preAuthorizedToken) protected jakarta.ws.rs.core.ResponsecreateHtmlResponse(Object response) protected UserSubjectcreateUserSubject(SecurityContext securityContext, jakarta.ws.rs.core.MultivaluedMap<String, String> params) protected SecurityContextgetAndValidateSecurityContext(jakarta.ws.rs.core.MultivaluedMap<String, String> params) getApprovedScope(List<String> requestedScope, List<String> approvedScope) protected ClientGet theClientreferenceprotected Stringprotected booleanbooleanprotected booleannoConsentForRequestedScopes(jakarta.ws.rs.core.MultivaluedMap<String, String> params, Client client, UserSubject userSubject, List<String> requestedScope, List<OAuthPermission> permissions) protected voidpersonalizeData(OAuthAuthorizationData data, UserSubject userSubject) protected OAuthRedirectionStaterecreateRedirectionStateFromParams(jakarta.ws.rs.core.MultivaluedMap<String, String> params) protected OAuthRedirectionStaterecreateRedirectionStateFromSession(UserSubject subject, String sessionToken) voidsetAuthorizationFilter(AuthorizationRequestFilter authorizationFilter) voidsetHidePreauthorizedScopesInForm(boolean hidePreauthorizedScopesInForm) voidsetMatchRedirectUriWithApplicationUri(boolean matchRedirectUriWithApplicationUri) voidsetMaxDefaultSessionInterval(int maxDefaultSessionInterval) voidsetPartialMatchScopeValidation(boolean partialMatchScopeValidation) voidsetResourceOwnerNameProvider(ResourceOwnerNameProvider resourceOwnerNameProvider) voidsetRevokePreauthorizedTokenOnApproval(boolean revoke) voidsetScopesRequiringNoConsent(List<String> scopesRequiringNoConsent) voidsetSessionAuthenticityTokenProvider(SessionAuthenticityTokenProvider sessionAuthenticityTokenProvider) voidsetSubjectCreator(SubjectCreator creator) voidsetSupportSinglePageApplications(boolean supportSinglePageApplications) voidsetUseAllClientScopes(boolean useAllClientScopes) voidsetUseRegisteredRedirectUriIfPossible(boolean use) If a client does not include a redirect_uri parameter but has an exactly one pre-registered redirect_uri then use that redirect_uriprotected jakarta.ws.rs.core.ResponsestartAuthorization(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Starts the authorization processprotected jakarta.ws.rs.core.ResponsestartAuthorization(jakarta.ws.rs.core.MultivaluedMap<String, String> params, UserSubject userSubject, Client client, String redirectUri) protected StringvalidateRedirectUri(Client client, String redirectUri) Methods inherited from class org.apache.cxf.rs.security.oauth2.services.AbstractOAuthService
checkTransportSecurity, getDataProvider, getMessageContext, getQueryParameters, getValidClient, getValidClient, injectContextIntoOAuthProviders, isWriteOptionalParameters, reportInvalidRequestError, reportInvalidRequestError, reportInvalidRequestError, reportInvalidRequestError, setBlockUnsecureRequests, setDataProvider, setMessageContext, setWriteOptionalParameters
-
Constructor Details
-
RedirectionBasedGrantService
-
RedirectionBasedGrantService
-
-
Method Details
-
authorize
@GET @Produces({"application/xhtml+xml","text/html","application/xml","application/json"}) public jakarta.ws.rs.core.Response authorize()Handles the initial authorization request by preparing the authorization challenge data and returning it to the user. Typically the data are expected to be presented in the HTML form- Returns:
- the authorization data
-
authorizePost
@POST @Consumes("application/x-www-form-urlencoded") @Produces({"application/xhtml+xml","text/html","application/xml","application/json"}) public jakarta.ws.rs.core.Response authorizePost(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Handles the initial authorization request by preparing the authorization challenge data and returning it to the user. Typically the data are expected to be presented in the HTML form- Returns:
- the authorization data
-
authorizeDecision
@GET @Path("/decision") public jakarta.ws.rs.core.Response authorizeDecision()Processes the end user decision- Returns:
- The grant value, authorization code or the token
-
authorizeDecisionForm
@POST @Path("/decision") @Consumes("application/x-www-form-urlencoded") public jakarta.ws.rs.core.Response authorizeDecisionForm(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Processes the end user decision- Returns:
- The grant value, authorization code or the token
-
startAuthorization
protected jakarta.ws.rs.core.Response startAuthorization(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Starts the authorization process -
startAuthorization
protected jakarta.ws.rs.core.Response startAuthorization(jakarta.ws.rs.core.MultivaluedMap<String, String> params, UserSubject userSubject, Client client, String redirectUri) -
getSupportedResponseTypes
-
canAuthorizationBeSkipped
protected boolean canAuthorizationBeSkipped(jakarta.ws.rs.core.MultivaluedMap<String, String> params, Client client, UserSubject userSubject, List<String> requestedScope, List<OAuthPermission> permissions) -
noConsentForRequestedScopes
protected boolean noConsentForRequestedScopes(jakarta.ws.rs.core.MultivaluedMap<String, String> params, Client client, UserSubject userSubject, List<String> requestedScope, List<OAuthPermission> permissions) -
createAuthorizationData
protected OAuthAuthorizationData createAuthorizationData(Client client, jakarta.ws.rs.core.MultivaluedMap<String, String> params, String redirectUri, UserSubject subject, List<OAuthPermission> requestedPerms, List<OAuthPermission> alreadyAuthorizedPerms, boolean authorizationCanBeSkipped) Create the authorization challenge data -
recreateRedirectionStateFromSession
protected OAuthRedirectionState recreateRedirectionStateFromSession(UserSubject subject, String sessionToken) -
recreateRedirectionStateFromParams
protected OAuthRedirectionState recreateRedirectionStateFromParams(jakarta.ws.rs.core.MultivaluedMap<String, String> params) -
personalizeData
-
getApprovedScope
-
completeAuthorization
protected jakarta.ws.rs.core.Response completeAuthorization(jakarta.ws.rs.core.MultivaluedMap<String, String> params) Completes the authorization process -
isRevokePreauthorizedTokenOnApproval
public boolean isRevokePreauthorizedTokenOnApproval() -
setRevokePreauthorizedTokenOnApproval
public void setRevokePreauthorizedTokenOnApproval(boolean revoke) -
setSessionAuthenticityTokenProvider
public void setSessionAuthenticityTokenProvider(SessionAuthenticityTokenProvider sessionAuthenticityTokenProvider) -
setSubjectCreator
-
createUserSubject
protected UserSubject createUserSubject(SecurityContext securityContext, jakarta.ws.rs.core.MultivaluedMap<String, String> params) -
createErrorResponse
-
canAccessTokenBeReturned
-
createErrorResponse
-
createGrant
protected abstract jakarta.ws.rs.core.Response createGrant(OAuthRedirectionState state, Client client, List<String> requestedScope, List<String> approvedScope, UserSubject userSubject, ServerAccessToken preAuthorizedToken) -
getAndValidateSecurityContext
protected SecurityContext getAndValidateSecurityContext(jakarta.ws.rs.core.MultivaluedMap<String, String> params) -
validateRedirectUri
-
getClient
protected Client getClient(String clientId, jakarta.ws.rs.core.MultivaluedMap<String, String> params) Get theClientreference- Parameters:
params- request parameters- Returns:
- Client the client reference
-
createHtmlResponse
-
isFormResponse
-
getSupportedGrantType
-
setResourceOwnerNameProvider
-
setPartialMatchScopeValidation
public void setPartialMatchScopeValidation(boolean partialMatchScopeValidation) -
setUseAllClientScopes
public void setUseAllClientScopes(boolean useAllClientScopes) -
setUseRegisteredRedirectUriIfPossible
public void setUseRegisteredRedirectUriIfPossible(boolean use) If a client does not include a redirect_uri parameter but has an exactly one pre-registered redirect_uri then use that redirect_uri- Parameters:
use- allows to use a single registered redirect_uri if set to true (default)
-
canSupportPublicClient
-
canRedirectUriBeEmpty
-
setMaxDefaultSessionInterval
public void setMaxDefaultSessionInterval(int maxDefaultSessionInterval) -
setMatchRedirectUriWithApplicationUri
public void setMatchRedirectUriWithApplicationUri(boolean matchRedirectUriWithApplicationUri) -
setHidePreauthorizedScopesInForm
public void setHidePreauthorizedScopesInForm(boolean hidePreauthorizedScopesInForm) -
setAuthorizationFilter
-
setScopesRequiringNoConsent
-
setSupportSinglePageApplications
public void setSupportSinglePageApplications(boolean supportSinglePageApplications)
-