# Interface OAuthService (5.0.3)

    public interface OAuthService

The OAuthService provides methods useful for validating OAuth requests.
See Also: [RFC 5849](http://tools.ietf.org/html/rfc5849) for the OAuth specification.

## Methods

### getAuthorizedScopes(String\[\] scopes)

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

Return authorized scopes from input scopes.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `scopes` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html[]` The custom OAuth scopes at least one of which is accepted. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html[]` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html[]` The custom OAuth scopes at least one of which is accepted. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.OAuthRequestException` | If the request was not a valid OAuth2 request. |

### getCurrentUser()

    public abstract User getCurrentUser()

Returns the [User](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.User) on whose behalf the request was made.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.User` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.OAuthRequestException` | If the request was not a valid OAuth request. |

### getCurrentUser(String scope)

    public abstract User getCurrentUser(String scope)

Returns the [User](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.User) on whose behalf the request was made.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `scope` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The custom OAuth scope that is accepted. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.User` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.OAuthRequestException` | If the request was not a valid OAuth request. |

### getCurrentUser(String\[\] scopes)

    public abstract User getCurrentUser(String[] scopes)

Returns the [User](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.User) on whose behalf the request was made.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `scopes` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html[]` The custom OAuth scopes at least one of which is accepted. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.users.User` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.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** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.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** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The custom OAuth scope that is accepted. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.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` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html[]` The custom OAuth scopes at least one of which is accepted. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.oauth.OAuthRequestException` | If the request was not a valid OAuth request. |