Class OAuth2AuthorizationConsent.Builder

java.lang.Object
org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsent.Builder
All Implemented Interfaces:
Serializable
Enclosing class:
OAuth2AuthorizationConsent

public static final class OAuth2AuthorizationConsent.Builder extends Object implements Serializable
See Also:
  • Method Details

    • scope

      Adds a scope to the collection of authorities in the resulting OAuth2AuthorizationConsent, wrapping it in a SimpleGrantedAuthority, prefixed by SCOPE_. For example, a message.write scope would be stored as SCOPE_message.write.
      Parameters:
      scope - the scope
      Returns:
      the Builder for further configuration
    • authority

      public OAuth2AuthorizationConsent.Builder authority(org.springframework.security.core.GrantedAuthority authority)
      Adds a GrantedAuthority to the collection of authorities in the resulting OAuth2AuthorizationConsent.
      Parameters:
      authority - the GrantedAuthority
      Returns:
      the Builder for further configuration
    • authorities

      public OAuth2AuthorizationConsent.Builder authorities(Consumer<Set<org.springframework.security.core.GrantedAuthority>> authoritiesConsumer)
      A Consumer of the authorities, allowing the ability to add, replace or remove.
      Parameters:
      authoritiesConsumer - a Consumer of the authorities
      Returns:
      the Builder for further configuration
    • build

      Validate the authorities and build the OAuth2AuthorizationConsent. There must be at least one GrantedAuthority.
      Returns:
      the OAuth2AuthorizationConsent