public interface UserServiceThe UserService provides information useful for forcing a user to log in or out, and retrieving information about the user who is currently logged-in.
Methods
createLoginURL(String destinationURL)
public abstract String createLoginURL(String destinationURL)Returns a URL that can be used to display a login page to the user.
| Parameter | |
|---|---|
| Name | Description |
destinationURL |
Stringwhere the user will be redirected after they log in. |
| Returns | |
|---|---|
| Type | Description |
String |
The URL that will present a login prompt. |
createLoginURL(String destinationURL, @Nullable String authDomain)
public abstract String createLoginURL(String destinationURL, @Nullable String authDomain)Returns a URL that can be used to display a login page to the user.
| Parameters | |
|---|---|
| Name | Description |
destinationURL |
Stringwhere the user will be redirected after they log in. |
authDomain |
Nullable Stringnot used. |
| Returns | |
|---|---|
| Type | Description |
String |
The URL that will present a login prompt. |
createLoginURL(String destinationURL, String authDomain, String federatedIdentity, Set<String> attributesRequest) (deprecated)
public abstract String createLoginURL(String destinationURL, String authDomain, String federatedIdentity, Set<String> attributesRequest)Deprecated. Use of federatedIdentity is no longer supported. Please change calls to a method that does not take the parameter.
Returns a URL that can be used to redirect the user to a third party for federated login.
| Parameters | |
|---|---|
| Name | Description |
destinationURL |
Stringwhere the user will be redirected after they log in. |
authDomain |
Stringnot used. |
federatedIdentity |
StringSetting this parameter to a non-null value will throw an IllegalArgumentException. OpenID 2.0 support has been decommissioned. Please see https://cloud.google.com/appengine/docs/deprecations/open_id for details. |
attributesRequest |
Set<String>not used. |
| Returns | |
|---|---|
| Type | Description |
String |
The URL that will present a login prompt. |
createLogoutURL(String destinationURL)
public abstract String createLogoutURL(String destinationURL)Returns a URL that can be used to log the current user out of this app.
| Parameter | |
|---|---|
| Name | Description |
destinationURL |
Stringwhere the user will be redirected after they log out. |
| Returns | |
|---|---|
| Type | Description |
String |
The URL that will log the user out. |
createLogoutURL(String destinationURL, @Nullable String authDomain)
public abstract String createLogoutURL(String destinationURL, @Nullable String authDomain)Returns a URL that can be used to log the current user out of this app.
| Parameters | |
|---|---|
| Name | Description |
destinationURL |
Stringwhere the user will be redirected after they log out. |
authDomain |
Nullable Stringnot used. |
| Returns | |
|---|---|
| Type | Description |
String |
The URL that will log the user out. |
getCurrentUser()
public abstract @Nullable User getCurrentUser()If the user is logged in, this method will return a User that
contains information about them.
Note that repeated calls may not necessarily return the same
User object.
| Returns | |
|---|---|
| Type | Description |
com.google.appengine.api.users.@org.jspecify.annotations.Nullable User |
User if the user is logged in, null otherwise. |
isUserAdmin()
public abstract boolean isUserAdmin()Returns true if the user making this request is an admin for this application, false otherwise.
| Returns | |
|---|---|
| Type | Description |
boolean |
|
isUserLoggedIn()
public abstract boolean isUserLoggedIn()Returns true if there is a user logged in, false otherwise.
| Returns | |
|---|---|
| Type | Description |
boolean |
|