Class ConsentPageModelMapper

java.lang.Object
com.irurueta.authserver.authorization.api.web.consent.ConsentPageModelMapper

@Component public class ConsentPageModelMapper extends Object
Builds the ConsentPageModel from the registered client, the requested scopes and the scopes granted earlier. Scope descriptions come from messages.properties (consent.scope.<name>); a scope without a description is shown by its name.
  • Field Details

    • SCOPE_MESSAGE_PREFIX

      static final String SCOPE_MESSAGE_PREFIX
      Prefix of the message code of a scope description.
      See Also:
    • messageSource

      private final org.springframework.context.MessageSource messageSource
      Resolves the scope descriptions.
  • Constructor Details

    • ConsentPageModelMapper

      public ConsentPageModelMapper()
  • Method Details

    • toModel

      public ConsentPageModel toModel(org.springframework.security.oauth2.server.authorization.client.RegisteredClient client, String principalName, String state, String requestedScopes, Collection<String> grantedScopes, Locale locale)
      Maps the consent request to its view model. The openid scope is never listed: it only asks for the identity the user has just proved by signing in. Scopes granted earlier are listed apart.
      Parameters:
      client - client that asks for access.
      principalName - name of the signed-in user.
      state - state of the authorization request.
      requestedScopes - requested scopes, space delimited as in the authorization request.
      grantedScopes - scopes the user granted to the client earlier.
      locale - locale of the descriptions.
      Returns:
      the view model.
    • view

      private ConsentPageModel.ScopeView view(String scope, Locale locale)
      Describes a scope.
      Parameters:
      scope - name of the scope.
      locale - locale of the description.
      Returns:
      the scope with its description.