Package com.google.appengine.api.users
Interface UserService
public interface UserService
The UserService provides information useful for forcing a user to
log in or out, and retrieving information about the user who is
currently logged-in.
-
Method Summary
Modifier and TypeMethodDescriptioncreateLoginURL
(String destinationURL) Returns a URL that can be used to display a login page to the user.createLoginURL
(String destinationURL, @Nullable String authDomain) Returns a URL that can be used to display a login page to the user.createLoginURL
(String destinationURL, String authDomain, String federatedIdentity, Set<String> attributesRequest) Deprecated.Use of federatedIdentity is no longer supported.createLogoutURL
(String destinationURL) Returns a URL that can be used to log the current user out of this app.createLogoutURL
(String destinationURL, @Nullable String authDomain) Returns a URL that can be used to log the current user out of this app.@Nullable User
If the user is logged in, this method will return aUser
that contains information about them.boolean
Returns true if the user making this request is an admin for this application, false otherwise.boolean
Returns true if there is a user logged in, false otherwise.
-
Method Details
-
createLoginURL
Returns a URL that can be used to display a login page to the user.- Parameters:
destinationURL
- where the user will be redirected after they log in.- Returns:
- The URL that will present a login prompt.
- Throws:
IllegalArgumentException
- If the destinationURL is not valid.
-
createLoginURL
Returns a URL that can be used to display a login page to the user.- Parameters:
destinationURL
- where the user will be redirected after they log in.authDomain
- not used.- Returns:
- The URL that will present a login prompt.
- Throws:
IllegalArgumentException
- If the destinationURL is not valid.
-
createLoginURL
@Deprecated 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:
destinationURL
- where the user will be redirected after they log in.authDomain
- not used.federatedIdentity
- Setting 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
- not used.- Returns:
- The URL that will present a login prompt.
- Throws:
IllegalArgumentException
- If the destinationURL is not valid or if federatedIdentity is not null
-
createLogoutURL
Returns a URL that can be used to log the current user out of this app.- Parameters:
destinationURL
- where the user will be redirected after they log out.- Returns:
- The URL that will log the user out.
- Throws:
IllegalArgumentException
- If the destinationURL is not valid.
-
createLogoutURL
Returns a URL that can be used to log the current user out of this app.- Parameters:
destinationURL
- where the user will be redirected after they log out.authDomain
- not used.- Returns:
- The URL that will log the user out.
- Throws:
IllegalArgumentException
- If the destinationURL is not valid.
-
isUserLoggedIn
boolean isUserLoggedIn()Returns true if there is a user logged in, false otherwise. -
isUserAdmin
boolean isUserAdmin()Returns true if the user making this request is an admin for this application, false otherwise.- Throws:
IllegalStateException
- If the current user is not logged in.
-
getCurrentUser
@Nullable User getCurrentUser()If the user is logged in, this method will return aUser
that contains information about them. Note that repeated calls may not necessarily return the sameUser
object.- Returns:
- User if the user is logged in, null otherwise.
-