Class ServerAuthentication

  • All Implemented Interfaces:
    Authentication, java.io.Serializable, java.security.Principal
    Direct Known Subclasses:
    X509Authentication

    @Introspected
    public class ServerAuthentication
    extends java.lang.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
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ServerAuthentication​(java.lang.String name, java.util.Collection<java.lang.String> roles, java.util.Map<java.lang.String,​java.lang.Object> attributes)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.Object> getAttributes()
      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.
      java.lang.String getName()  
      java.util.Collection<java.lang.String> getRoles()  
      java.util.Map<java.lang.String,​java.lang.Object> toJson()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.security.Principal

        equals, hashCode, implies, toString
    • Constructor Detail

      • ServerAuthentication

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

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface java.security.Principal
      • getAttributes

        @NonNull
        public java.util.Map<java.lang.String,​java.lang.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 java.util.Collection<java.lang.String> getRoles()
        Specified by:
        getRoles in interface Authentication
        Returns:
        Any roles associated with the authentication
      • toJson

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