org.mule.security.oauth
Class DefaultRefreshTokenManager

java.lang.Object
  extended by org.mule.security.oauth.DefaultRefreshTokenManager
All Implemented Interfaces:
MuleContextAware, RefreshTokenManager

public class DefaultRefreshTokenManager
extends Object
implements MuleContextAware, RefreshTokenManager

Implementation of RefreshTokenManager that guarantees that no refresh token is used more than once. If two threads try to refresh the same token concurrently, only one will succeed and the other one will rely on the result of the first one


Field Summary
 
Fields inherited from interface org.mule.security.oauth.RefreshTokenManager
DEFAULT_MIN_REFRESH_INTERVAL
 
Constructor Summary
DefaultRefreshTokenManager()
           
 
Method Summary
 void refreshToken(OAuth2Adapter adapter, String accessTokenId)
          Refreshes the token of the given id for the given adapter.
 void setMinRefreshIntervalInMillis(int minRefreshIntervalInMillis)
          Sets the minimum interval of time in which we allow a given access token id to be refresh.
 void setMuleContext(MuleContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRefreshTokenManager

public DefaultRefreshTokenManager()
Method Detail

refreshToken

public void refreshToken(OAuth2Adapter adapter,
                         String accessTokenId)
                  throws Exception
Refreshes the token of the given id for the given adapter. This implementation uses a lock to guarantee that no refresh token is consumed more than once

Specified by:
refreshToken in interface RefreshTokenManager
Throws:
Exception
See Also:
RefreshTokenManager.refreshToken(org.mule.security.oauth.OAuth2Adapter, java.lang.String)

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware

setMinRefreshIntervalInMillis

public void setMinRefreshIntervalInMillis(int minRefreshIntervalInMillis)
Description copied from interface: RefreshTokenManager
Sets the minimum interval of time in which we allow a given access token id to be refresh. If an access token is attempted to be refresh in an interval lower than the provided, then the token is not refresh

Specified by:
setMinRefreshIntervalInMillis in interface RefreshTokenManager
Parameters:
minRefreshIntervalInMillis - a number of milliseconds


Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.