Class DeviceClientAuthenticationProvider

java.lang.Object
com.irurueta.authserver.authorization.api.web.implicit.DeviceClientAuthenticationProvider
All Implemented Interfaces:
org.springframework.security.authentication.AuthenticationProvider

public class DeviceClientAuthenticationProvider extends Object implements org.springframework.security.authentication.AuthenticationProvider
Authenticates a public client of the device flow by its identifier: the client must be registered and must have registered the none authentication method, which is what makes it public. It accepts only the requests DeviceClientAuthenticationConverter built (a DeviceClientAuthenticationToken), so it can never stand in for the PKCE verification of another request of a public client.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
    Reference to the standard that describes the failure.
    private final org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository
    Finds the registered clients.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.core.Authentication
    authenticate(org.springframework.security.core.Authentication authentication)
    Authenticates the client.
    private static org.springframework.security.oauth2.core.OAuth2AuthenticationException
    invalidClient(String parameterName)
    Builds the failure.
    boolean
    supports(Class<?> authentication)
    Tells which requests this provider authenticates.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ERROR_URI

      private static final String ERROR_URI
      Reference to the standard that describes the failure.
      See Also:
    • registeredClientRepository

      private final org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository registeredClientRepository
      Finds the registered clients.
  • Constructor Details

    • DeviceClientAuthenticationProvider

      public DeviceClientAuthenticationProvider()
  • Method Details

    • authenticate

      public org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication) throws org.springframework.security.core.AuthenticationException
      Authenticates the client.
      Specified by:
      authenticate in interface org.springframework.security.authentication.AuthenticationProvider
      Parameters:
      authentication - the request of a public client of the device flow.
      Returns:
      the authenticated client.
      Throws:
      org.springframework.security.core.AuthenticationException - invalid_client if the client is unknown or is not a public one.
    • supports

      public boolean supports(Class<?> authentication)
      Tells which requests this provider authenticates.
      Specified by:
      supports in interface org.springframework.security.authentication.AuthenticationProvider
      Parameters:
      authentication - the type of the request.
      Returns:
      true for a DeviceClientAuthenticationToken.
    • invalidClient

      private static org.springframework.security.oauth2.core.OAuth2AuthenticationException invalidClient(String parameterName)
      Builds the failure.
      Parameters:
      parameterName - what failed.
      Returns:
      the exception.