Enum IdentityPolicy

java.lang.Object
java.lang.Enum<IdentityPolicy>
eu.webtoolkit.jwt.auth.IdentityPolicy
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<IdentityPolicy>, java.lang.constant.Constable

public enum IdentityPolicy
extends java.lang.Enum<IdentityPolicy>
Enumeration for an identity policy.

This enumeration lists possible choices for the user identity (login name).

When using password authentication, it is clear that the user has to provide an identity to login. The only choice is whether you will use the user's email address or another login name.

When using a 3rd party authenticator, e.g. using OAuth, a login name is no longer needed, but you may still want to give the user the opportunity to choose one.

See Also:
AuthService.setIdentityPolicy(IdentityPolicy identityPolicy)
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant Description
    EmailAddressIdentity
    The email address serves as the identity.
    LoginNameIdentity
    A unique login name chosen by the user.
    OptionalIdentity
    An identity is optional, and only asked if needed for authentication.
  • Method Summary

    Modifier and Type Method Description
    int getValue()
    Returns the numerical representation of this enum.
    static IdentityPolicy valueOf​(java.lang.String name)
    Returns the enum constant of this type with the specified name.
    static IdentityPolicy[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Enum

    clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • LoginNameIdentity

      public static final IdentityPolicy LoginNameIdentity
      A unique login name chosen by the user.

      Even if not really required for authentication, a user still chooses a unique user name. If possible, a third party autheticator may suggest a user name.

      This may be useful for sites which have a social aspect.

    • EmailAddressIdentity

      public static final IdentityPolicy EmailAddressIdentity
      The email address serves as the identity.

      This may be useful for sites which do not have any social character, but instead render a service to individual users. When the site has a social character, you will likely not want to display the email address of other users, but instead a user-chosen login name.

    • OptionalIdentity

      public static final IdentityPolicy OptionalIdentity
      An identity is optional, and only asked if needed for authentication.

      Unless the authentication procedure requires a user name, no particular identity is asked for. In this case, the identity is a unique internal identifier.

      This may be useful for sites which do not have any social character, but instead render a service to individual users.

  • Method Details

    • values

      public static IdentityPolicy[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static IdentityPolicy valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
      java.lang.NullPointerException - if the argument is null
    • getValue

      public int getValue()
      Returns the numerical representation of this enum.