UserService (Google App Engine API for Java)

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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      java.lang.String createLoginURL(java.lang.String destinationURL)
      Returns a URL that can be used to display a login page to the user.
      java.lang.String createLoginURL(java.lang.String destinationURL, java.lang.String authDomain)
      Returns a URL that can be used to display a login page to the user.
      java.lang.String createLoginURL(java.lang.String destinationURL, java.lang.String authDomain, java.lang.String federatedIdentity, java.util.Set<java.lang.String> attributesRequest)
      Returns a URL that can be used to redirect the user to a third party for federated login.
      java.lang.String createLogoutURL(java.lang.String destinationURL)
      Returns a URL that can be used to log the current user out of this app.
      java.lang.String createLogoutURL(java.lang.String destinationURL, java.lang.String authDomain)
      Returns a URL that can be used to log the current user out of this app.
      User getCurrentUser()
      If the user is logged in, this method will return a User that contains information about them.
      boolean isUserAdmin()
      Returns true if the user making this request is an admin for this application, false otherwise.
      boolean isUserLoggedIn()
      Returns true if there is a user logged in, false otherwise.
    • Method Detail

      • createLoginURL

        java.lang.String createLoginURL(java.lang.String destinationURL)
        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:
        java.lang.IllegalArgumentException - If the destinationURL is not valid.
      • createLoginURL

        java.lang.String createLoginURL(java.lang.String destinationURL,
                                        java.lang.String authDomain)
        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:
        java.lang.IllegalArgumentException - If the destinationURL is not valid.
      • createLoginURL

        java.lang.String createLoginURL(java.lang.String destinationURL,
                                        java.lang.String authDomain,
                                        java.lang.String federatedIdentity,
                                        java.util.Set<java.lang.String> attributesRequest)
        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 - federated identity string which is to be asserted for users who are authenticated using a non-Google ID (e.g., OpenID). In order to use federated logins this feature must be enabled for the application. Otherwise, this should be null.
        attributesRequest - not used.
        Returns:
        The URL that will present a login prompt.
        Throws:
        java.lang.IllegalArgumentException - If the destinationURL is not valid.
      • createLogoutURL

        java.lang.String createLogoutURL(java.lang.String destinationURL)
        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:
        java.lang.IllegalArgumentException - If the destinationURL is not valid.
      • createLogoutURL

        java.lang.String createLogoutURL(java.lang.String destinationURL,
                                         java.lang.String authDomain)
        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:
        java.lang.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:
        java.lang.IllegalStateException - If the current user is not logged in.
      • getCurrentUser

        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:
        User if the user is logged in, null otherwise.

Send feedback about...