Package org.gluu.oxauth.service
Class DeviceAuthorizationService
- java.lang.Object
- 
- org.gluu.oxauth.service.DeviceAuthorizationService
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 @ApplicationScoped public class DeviceAuthorizationService extends java.lang.Object implements java.io.SerializableService used to process data related to device code grant type.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringSESSION_ATTEMPTSstatic java.lang.StringSESSION_LAST_ATTEMPTstatic java.lang.StringSESSION_USER_CODE
 - 
Constructor SummaryConstructors Constructor Description DeviceAuthorizationService()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDeviceAuthorizationPage(DeviceAuthorizationCacheControl deviceAuthorizationCacheControl, Client client, java.lang.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.DeviceAuthorizationCacheControlgetDeviceAuthzByDeviceCode(java.lang.String deviceCode)Returns cache data related to the device authz request using user_code as cache key.DeviceAuthorizationCacheControlgetDeviceAuthzByUserCode(java.lang.String userCode)Returns cache data related to the device authz request using device_code as cache key.java.lang.StringgetUserCodeFromSession(javax.servlet.http.HttpServletRequest httpRequest)Uses an HttpServletRequest, process it and return userCode in the session whether it exists.booleanhasDeviceCodeCompatibility(Client client)Verifies whether a specific client has Device Code grant type compatibility.voidremoveDeviceAuthRequestInCache(java.lang.String userCode, java.lang.String deviceCode)Removes device request data from cache using user_code and device_code.voidsaveInCache(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.
 
- 
- 
- 
Field Detail- 
SESSION_ATTEMPTSpublic static final java.lang.String SESSION_ATTEMPTS - See Also:
- Constant Field Values
 
 - 
SESSION_LAST_ATTEMPTpublic static final java.lang.String SESSION_LAST_ATTEMPT - See Also:
- Constant Field Values
 
 - 
SESSION_USER_CODEpublic static final java.lang.String SESSION_USER_CODE - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
saveInCachepublic 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.
 
 - 
getDeviceAuthzByUserCodepublic DeviceAuthorizationCacheControl getDeviceAuthzByUserCode(java.lang.String userCode) Returns cache data related to the device authz request using device_code as cache key.
 - 
getDeviceAuthzByDeviceCodepublic DeviceAuthorizationCacheControl getDeviceAuthzByDeviceCode(java.lang.String deviceCode) Returns cache data related to the device authz request using user_code as cache key.
 - 
hasDeviceCodeCompatibilitypublic boolean hasDeviceCodeCompatibility(Client client) Verifies whether a specific client has Device Code grant type compatibility.- Parameters:
- client- Client to check.
 
 - 
getDeviceAuthorizationPagepublic java.lang.String getDeviceAuthorizationPage(DeviceAuthorizationCacheControl deviceAuthorizationCacheControl, Client client, java.lang.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
 
 - 
removeDeviceAuthRequestInCachepublic void removeDeviceAuthRequestInCache(java.lang.String userCode, java.lang.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.
 
 - 
getUserCodeFromSessionpublic java.lang.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.
 
 
- 
 
-