Class ServerAuthentication

java.lang.Object
io.micronaut.security.authentication.ServerAuthentication
All Implemented Interfaces:
Authentication, Serializable, Principal
Direct Known Subclasses:
X509Authentication

public class ServerAuthentication extends Object implements Authentication
An implementation of the Authentication interfaced intended to be used on the server side to create authentication objects from user data found through any means.
Since:
3.0.0
Author:
James Kleeh
See Also:
  • Constructor Details

    • ServerAuthentication

      public ServerAuthentication(@NonNull @NonNull String name, @Nullable @Nullable Collection<String> roles, @Nullable @Nullable Map<String,Object> attributes)
      Parameters:
      name - The name of this principal name
      roles - Roles of the authenticated user
      attributes - Attributes of the authenticated user
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface Principal
    • getAttributes

      @NonNull public @NonNull Map<String,Object> getAttributes()
      Description copied from interface: Authentication
      In order to correctly implement the Serializable specification, this map should be Map<String, Serializable>, however that would place a burden on those not requiring serialization, forcing their values to conform to that spec. This is left intentionally as Object in order to meet both use cases and those requiring serialization must ensure all values in the map implement Serializable.
      Specified by:
      getAttributes in interface Authentication
      Returns:
      Any additional attributes in the authentication
    • getRoles

      @NonNull public @NonNull Collection<String> getRoles()
      Specified by:
      getRoles in interface Authentication
      Returns:
      Any roles associated with the authentication
    • toJson

      public Map<String,Object> toJson()
      Returns:
      A Map to be used a JSON representation of the object