All Superinterfaces:
Principal
All Known Implementing Classes:
User

public interface Authentication extends Principal
Represents the state of an authentication.
  • Field Details

  • Method Details

    • getAttributes

      @NotNull @NotNull Map<String,Object> getAttributes()
      Any additional attributes in the authentication.
      Returns:
      a Map containing the attributes;
    • getRoles

      @NotNull default @NotNull Collection<String> getRoles()
      Any roles associated with the authentication.
      Returns:
      a Collection of roles as string
    • toJSON

      @NotNull default @NotNull org.json.JSONObject toJSON()
      Convert the authentication information to JSON format.
      Returns:
      a JSON object.
    • create

      @NotNull static @NotNull Authentication create(@NotNull @NotNull String username)
      Build an Authentication instance for the user.
      Parameters:
      username - the user's name
      Returns:
      an Authentication object
    • create

      @NotNull static @NotNull Authentication create(@NotNull @NotNull String username, @NotNull @NotNull Set<String> roles)
      Build an Authentication instance for the user.
      Parameters:
      username - the user's name
      roles - the user's roles
      Returns:
      an Authentication object
    • create

      @NotNull static @NotNull Authentication create(@NotNull @NotNull String username, @NotNull @NotNull Map<String,Object> attributes)
      Build an Authentication instance for the user.
      Parameters:
      username - the user's name
      attributes - the user's attributes
      Returns:
      an Authentication object
    • create

      @NotNull static @NotNull Authentication create(@NotNull @NotNull String username, @Nullable @Nullable Set<String> roles, @Nullable @Nullable Map<String,Object> attributes)
      Builds an Authentication instance for the user.
      Parameters:
      username - User's name
      roles - User's roles
      attributes - User's attributes
      Returns:
      an Authentication object
    • create

      @NotNull static @NotNull Authentication create(@NotNull @NotNull org.json.JSONObject json)
      Builds an Authentication instance for the user from a JSONObject.
      Parameters:
      json - a JSONObject containing user's data.
      Returns:
      an Authentication object