Package play.mvc

Class Security.Authenticator

  • Enclosing class:
    Security

    public static class Security.Authenticator
    extends Results
    Handles authentication.
    • Constructor Detail

      • Authenticator

        public Authenticator()
    • Method Detail

      • getUsername

        public Optional<String> getUsername​(Http.Request req)
        Retrieves the username from the HTTP request; the default is to read from the session cookie.
        Parameters:
        req - the current request
        Returns:
        the username if the user is authenticated.
      • onUnauthorized

        public Result onUnauthorized​(Http.Request req)
        Generates an alternative result if the user is not authenticated; the default a simple '401 Not Authorized' page.
        Parameters:
        req - the current request
        Returns:
        a 401 Not Authorized result