public class OAuth2RequestFilter extends Object implements com.ning.http.client.filter.RequestFilter
OAuth2Config| Modifier and Type | Field and Description |
|---|---|
protected String |
accessTokenEndPoint |
protected long |
acquireTime |
static String |
CLIENT_ID_PARAMETER_NAME |
static String |
CLIENT_SECRET_PARAMETER_NAME |
protected String |
clientId |
protected String |
clientSecret |
static String |
GRANT_TYPE_PARAMETER_NAME |
protected String |
password |
static String |
PASSWORD_PARAMETER_NAME |
static String |
PASSWORD_PARAMETER_VALUE |
protected String |
scheme_name |
static String |
SCOPE_PARAMETER_NAME |
protected OAuth2Token |
token |
protected String |
username |
static String |
USERNAME_PARAMETER_NAME |
| Constructor and Description |
|---|
OAuth2RequestFilter(String accessTokenEndPoint,
String clientId,
String clientSecret)
Request filter that acquires an OAuth token if:
no token has been acquired
the current token is expired, given its "ExpiresIn" information
|
| Modifier and Type | Method and Description |
|---|---|
com.ning.http.client.filter.FilterContext |
filter(com.ning.http.client.filter.FilterContext ctx) |
String |
getAccessTokenEndPoint() |
String |
getClientId() |
String |
getClientSecret() |
String |
getSchemeName() |
void |
setAccessTokenEndPoint(String accessTokenEndPoint) |
void |
setClientId(String clientId) |
void |
setClientSecret(String clientSecret) |
void |
setCredentials(String username,
String password) |
void |
setSchemeName(String scheme_name) |
public static final String GRANT_TYPE_PARAMETER_NAME
public static final String CLIENT_ID_PARAMETER_NAME
public static final String CLIENT_SECRET_PARAMETER_NAME
public static final String USERNAME_PARAMETER_NAME
public static final String PASSWORD_PARAMETER_NAME
public static final String SCOPE_PARAMETER_NAME
public static final String PASSWORD_PARAMETER_VALUE
protected String accessTokenEndPoint
protected String clientId
protected String clientSecret
protected String scheme_name
protected String username
protected String password
protected long acquireTime
protected OAuth2Token token
public OAuth2RequestFilter(String accessTokenEndPoint, String clientId, String clientSecret)
accessTokenEndPoint - URL where the OAuth2.0 client should request access tokensclientId - id of the OAuth2.0 clientclientSecret - secret of the OAuth2.0 clientpublic String getAccessTokenEndPoint()
public void setAccessTokenEndPoint(String accessTokenEndPoint)
public String getClientId()
public void setClientId(String clientId)
public String getClientSecret()
public void setClientSecret(String clientSecret)
public String getSchemeName()
public void setSchemeName(String scheme_name)
public com.ning.http.client.filter.FilterContext filter(com.ning.http.client.filter.FilterContext ctx)
throws com.ning.http.client.filter.FilterException
filter in interface com.ning.http.client.filter.RequestFiltercom.ning.http.client.filter.FilterExceptionCopyright © 2009-2014. All Rights Reserved.