Class DeviceAuthorizationService

java.lang.Object
org.gluu.oxauth.service.DeviceAuthorizationService
All Implemented Interfaces:
Serializable

@ApplicationScoped public class DeviceAuthorizationService extends Object implements Serializable
Service used to process data related to device code grant type.
See Also:
  • Field Details

  • Constructor Details

    • DeviceAuthorizationService

      public DeviceAuthorizationService()
  • Method Details

    • saveInCache

      public void saveInCache(DeviceAuthorizationCacheControl data, boolean saveDeviceCode, boolean saveUserCode)
      Saves data in cache, it could be saved with two identifiers used by Token endpoint or device_authorization page.
      Parameters:
      data - Data to be saved.
      saveDeviceCode - Defines whether data should be saved using device code.
      saveUserCode - Defines whether data should be saved using user code.
    • getDeviceAuthzByUserCode

      public DeviceAuthorizationCacheControl getDeviceAuthzByUserCode(String userCode)
      Returns cache data related to the device authz request using device_code as cache key.
    • getDeviceAuthzByDeviceCode

      public DeviceAuthorizationCacheControl getDeviceAuthzByDeviceCode(String deviceCode)
      Returns cache data related to the device authz request using user_code as cache key.
    • hasDeviceCodeCompatibility

      public boolean hasDeviceCodeCompatibility(Client client)
      Verifies whether a specific client has Device Code grant type compatibility.
      Parameters:
      client - Client to check.
    • getDeviceAuthorizationPage

      public String getDeviceAuthorizationPage(DeviceAuthorizationCacheControl deviceAuthorizationCacheControl, Client client, String state, javax.servlet.http.HttpServletRequest servletRequest)
      Validates data related to the cache, status and client in order to return correct redirection used to process device authorizations.
      Parameters:
      deviceAuthorizationCacheControl - Cache data related to the device code request.
      client - Client in process.
      state - State of the authorization request.
      servletRequest - HttpServletRequest
    • removeDeviceAuthRequestInCache

      public void removeDeviceAuthRequestInCache(String userCode, String deviceCode)
      Removes device request data from cache using user_code and device_code.
      Parameters:
      userCode - User code used as key in cache.
      deviceCode - Device code used as key in cache.
    • getUserCodeFromSession

      public String getUserCodeFromSession(javax.servlet.http.HttpServletRequest httpRequest)
      Uses an HttpServletRequest, process it and return userCode in the session whether it exists.
      Parameters:
      httpRequest - Request received from an user agent.