Class ConsentController
java.lang.Object
com.irurueta.authserver.authorization.api.web.consent.ConsentController
- All Implemented Interfaces:
ConsentPageApi
Serves the consent page the authorization endpoint redirects to when a client needs the user's approval, as the
contract
apis/auth-server/web-pages/auth-server-pages-v1.yaml describes it through the generated
ConsentPageApi. It lives in this adapter because it works with the framework's
RegisteredClientRepository and OAuth2AuthorizationConsentService.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsentServiceFinds the scopes the user granted earlier.(package private) static final StringPath of the authorization endpoint, where the decision of an authorization request is posted.(package private) static final StringName of the model attribute that holds theConsentPageModel.static final StringPath of the consent page, and of its registration in the authorization endpoint, taken from the contract.(package private) static final StringName of the model attribute that holds the path the decision is posted to.private final ConsentPageModelMapperBuilds the view model.private final PageRendererRenders the page.private final org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepositoryFinds the client that asks for access.private final jakarta.servlet.http.HttpServletRequestThe current request, injected as a thread-bound proxy, which carries the signed-in user and the locale.(package private) static final StringName of the model attribute that holds the user code of a device.(package private) static final StringName of the consent template.Fields inherited from interface com.irurueta.authserver.authorization.api.web.pages.v1.generated.api.ConsentPageApi
PATH_CONSENT_PAGE -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
CONSENT_PATH
Path of the consent page, and of its registration in the authorization endpoint, taken from the contract.- See Also:
-
VIEW_NAME
Name of the consent template.- See Also:
-
CONSENT_ATTRIBUTE
Name of the model attribute that holds theConsentPageModel.- See Also:
-
DECISION_PATH_ATTRIBUTE
Name of the model attribute that holds the path the decision is posted to.- See Also:
-
USER_CODE_ATTRIBUTE
Name of the model attribute that holds the user code of a device.- See Also:
-
AUTHORIZE_PATH
Path of the authorization endpoint, where the decision of an authorization request is posted.- See Also:
-
registeredClientRepository
private final org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository registeredClientRepositoryFinds the client that asks for access. -
authorizationConsentService
private final org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsentService authorizationConsentServiceFinds the scopes the user granted earlier. -
mapper
Builds the view model. -
pageRenderer
Renders the page. -
request
private final jakarta.servlet.http.HttpServletRequest requestThe current request, injected as a thread-bound proxy, which carries the signed-in user and the locale.
-
-
Constructor Details
-
ConsentController
public ConsentController()
-
-
Method Details
-
consentPage
public org.springframework.http.ResponseEntity<String> consentPage(String clientId, String scope, String state, String userCode) Renders the consent page.- Specified by:
consentPagein interfaceConsentPageApi- Parameters:
clientId- identifier of the client that asks for access.scope- requested scopes, space delimited.state- state of the authorization request.userCode- user code of the device the consent is asked for,nullfor an authorization request; the decision of a device is posted to the device verification endpoint, with the code.- Returns:
- the consent page.
- Throws:
org.springframework.web.server.ResponseStatusException- with status 400 when the client is unknown.
-