|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<Flow>
org.restlet.ext.oauth.Flow
public enum Flow
Enum that lets clients retrieve tokens using different OAuth2 flows. Currently this class enables use of the NONE (Autonomous) flow and the PASSWORD flow. It also supports a client to refresh a token. The class defines one function doFlow that wraps the above specified ways of retrieving a token from an authorization server. Example:
{ @code OAuthParameters params = new OAuthParameters("clientId", "clientSecret"); Flow f = Flow.NONE; User u = f.execute(params, null, null, null, null, null); f = Flow.PASSWORD; u = f.execute(params, null, null, "username", "password", null); }
Enum Constant Summary | |
---|---|
NONE
|
|
PASSWORD
|
|
REFRESH
|
Method Summary | |
---|---|
OAuthUser |
execute(OAuthParameters params,
String callbackUri,
String state,
String username,
String password,
String refreshToken)
Executes a specific OAuth Flow (including token refresh). |
OAuthUser |
execute(OAuthParameters params,
String callbackUri,
String state,
String username,
String password,
String refreshToken,
Client client)
Executes a specific OAuth Flow (including token refresh). |
static Flow |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static Flow[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final Flow NONE
public static final Flow PASSWORD
public static final Flow REFRESH
Method Detail |
---|
public static Flow[] values()
for (Flow c : Flow.values()) System.out.println(c);
public static Flow valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic OAuthUser execute(OAuthParameters params, String callbackUri, String state, String username, String password, String refreshToken)
params
- parameters specifying (clientId, clientSecret, scope etc).
Used for all flowscallbackUri
- callbackUri used for the userAgent flow. The serverstate
- used in the userAgent flowusername
- used in the password flowpassword
- used in the password flowrefreshToken
- the token to refresh, used in the refresh flow
public OAuthUser execute(OAuthParameters params, String callbackUri, String state, String username, String password, String refreshToken, Client client)
params
- parameters specifying OAuth end point. Used for all flows.callbackUri
- callbackUri used for the userAgent flow.state
- state that should be returned by the Authorization server.
Used in UserAgent flow.username
- used in the password flow.password
- used in the password flow.refreshToken
- the token to refresh, used in the refresh flowclient
- provided client
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |