Interface OAuthService (2.0.0)

public interface OAuthService

The OAuthService provides methods useful for validating OAuth requests. See Also: RFC 5849 for the OAuth specification.

Methods

getAuthorizedScopes(String[] scopes)

public abstract String[] getAuthorizedScopes(String[] scopes)

Return authorized scopes from input scopes.

Parameter
NameDescription
scopesString[]

The custom OAuth scopes at least one of which is accepted.

Returns
TypeDescription
String[]
Exceptions
TypeDescription
OAuthRequestException

If the request was not a valid OAuth2 request.

getClientId(String scope)

public abstract String getClientId(String scope)

Returns the client_id from oauth2 request.

Parameter
NameDescription
scopeString
Returns
TypeDescription
String
Exceptions
TypeDescription
OAuthRequestException

If the request was not a valid OAuth2 request.

getClientId(String[] scopes)

public abstract String getClientId(String[] scopes)

Returns the client_id from oauth2 request.

Parameter
NameDescription
scopesString[]

The custom OAuth scopes at least one of which is accepted.

Returns
TypeDescription
String
Exceptions
TypeDescription
OAuthRequestException

If the request was not a valid OAuth2 request.

getCurrentUser()

public abstract User getCurrentUser()

Returns the User on whose behalf the request was made.

Returns
TypeDescription
User
Exceptions
TypeDescription
OAuthRequestException

If the request was not a valid OAuth request.

getCurrentUser(String scope)

public abstract User getCurrentUser(String scope)

Returns the User on whose behalf the request was made.

Parameter
NameDescription
scopeString

The custom OAuth scope that is accepted.

Returns
TypeDescription
User
Exceptions
TypeDescription
OAuthRequestException

If the request was not a valid OAuth request.

getCurrentUser(String[] scopes)

public abstract User getCurrentUser(String[] scopes)

Returns the User on whose behalf the request was made.

Parameter
NameDescription
scopesString[]

The custom OAuth scopes at least one of which is accepted.

Returns
TypeDescription
User
Exceptions
TypeDescription
OAuthRequestException

If the request was not a valid OAuth request.

getOAuthConsumerKey() (deprecated)

public abstract String getOAuthConsumerKey()

Deprecated. OAuth1 is no longer supported

Throws OAuthRequestException

Returns
TypeDescription
String
Exceptions
TypeDescription
OAuthRequestException

isUserAdmin()

public abstract boolean isUserAdmin()

Returns true if the user on whose behalf the request was made is an admin for this application, false otherwise.

Returns
TypeDescription
boolean
Exceptions
TypeDescription
OAuthRequestException

If the request was not a valid OAuth request.

isUserAdmin(String scope)

public abstract boolean isUserAdmin(String scope)

Returns true if the user on whose behalf the request was made is an admin for this application, false otherwise.

Parameter
NameDescription
scopeString

The custom OAuth scope that is accepted.

Returns
TypeDescription
boolean
Exceptions
TypeDescription
OAuthRequestException

If the request was not a valid OAuth request.

isUserAdmin(String[] scopes)

public abstract boolean isUserAdmin(String[] scopes)

Returns true if the user on whose behalf the request was made is an admin for this application, false otherwise.

Parameter
NameDescription
scopesString[]

The custom OAuth scopes at least one of which is accepted.

Returns
TypeDescription
boolean
Exceptions
TypeDescription
OAuthRequestException

If the request was not a valid OAuth request.