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
Name Description
scopes String[]

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

Returns
Type Description
String[]
Exceptions
Type Description
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
Name Description
scope String
Returns
Type Description
String
Exceptions
Type Description
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
Name Description
scopes String[]

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

Returns
Type Description
String
Exceptions
Type Description
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
Type Description
User
Exceptions
Type Description
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
Name Description
scope String

The custom OAuth scope that is accepted.

Returns
Type Description
User
Exceptions
Type Description
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
Name Description
scopes String[]

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

Returns
Type Description
User
Exceptions
Type Description
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
Type Description
String
Exceptions
Type Description
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
Type Description
boolean
Exceptions
Type Description
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
Name Description
scope String

The custom OAuth scope that is accepted.

Returns
Type Description
boolean
Exceptions
Type Description
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
Name Description
scopes String[]

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

Returns
Type Description
boolean
Exceptions
Type Description
OAuthRequestException

If the request was not a valid OAuth request.