utils
Class OAuth2

java.lang.Object
  extended by utils.OAuth2

public class OAuth2
extends java.lang.Object


Constructor Summary
OAuth2()
           
 
Method Summary
static void deleteToken(java.lang.String accessKey, java.lang.String refreshKey)
           
static AccessToken generateAccessToken(java.lang.Long userId, int ttl, java.lang.String refreshToken)
          generate access token
static AccessToken generateAccessToken(java.lang.Long userId, java.lang.String refreshToken)
          generate access token
static java.lang.String generateKey()
          generate key
static RefreshToken generateRefreshToken(java.lang.Long userId)
          generate refresh token
static RefreshToken generateRefreshToken(java.lang.Long userId, int ttl)
          generate refresh token
static AccessToken getAccessToken(java.lang.String key)
           
static RefreshToken getRefreshToken(java.lang.String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OAuth2

public OAuth2()
Method Detail

generateKey

public static java.lang.String generateKey()
generate key

Returns:
key

generateAccessToken

public static AccessToken generateAccessToken(java.lang.Long userId,
                                              java.lang.String refreshToken)
generate access token

Parameters:
userId - user id
refreshToken - refresh token
Returns:
AccessToken object
See Also:
AccessToken

generateAccessToken

public static AccessToken generateAccessToken(java.lang.Long userId,
                                              int ttl,
                                              java.lang.String refreshToken)
generate access token

Parameters:
userId - user id
ttl - time to live in cache
refreshToken - refresh token
Returns:
AccessToken object
See Also:
AccessToken

getAccessToken

public static AccessToken getAccessToken(java.lang.String key)
Parameters:
key - access token key
Returns:
AccessToken object or null
See Also:
AccessToken

deleteToken

public static void deleteToken(java.lang.String accessKey,
                               java.lang.String refreshKey)
Parameters:
accessKey - access token key
refreshKey - refresh token key

generateRefreshToken

public static RefreshToken generateRefreshToken(java.lang.Long userId)
generate refresh token

Parameters:
userId - user id
Returns:
RefreshToken object
See Also:
RefreshToken

generateRefreshToken

public static RefreshToken generateRefreshToken(java.lang.Long userId,
                                                int ttl)
generate refresh token

Parameters:
userId - user id
ttl - time to live in cache
Returns:
RefreshToken object
See Also:
RefreshToken

getRefreshToken

public static RefreshToken getRefreshToken(java.lang.String key)
Parameters:
key - refresh token key
Returns:
RefreshToken object or null
See Also:
RefreshToken