Class ServerAuthentication
java.lang.Object
io.micronaut.security.authentication.ServerAuthentication
- All Implemented Interfaces:
Authentication
,Serializable
,Principal
- Direct Known Subclasses:
X509Authentication
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 Summary
ConstructorDescriptionServerAuthentication
(@NonNull String name, @Nullable Collection<String> roles, @Nullable Map<String, Object> attributes) -
Method Summary
Modifier and TypeMethodDescriptionIn order to correctly implement theSerializable
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.getName()
@NonNull Collection<String>
getRoles()
toJson()
-
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 nameroles
- Roles of the authenticated userattributes
- Attributes of the authenticated user
-
-
Method Details
-
getName
-
getAttributes
Description copied from interface:Authentication
In order to correctly implement theSerializable
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 implementSerializable
.- Specified by:
getAttributes
in interfaceAuthentication
- Returns:
- Any additional attributes in the authentication
-
getRoles
- Specified by:
getRoles
in interfaceAuthentication
- Returns:
- Any roles associated with the authentication
-
toJson
- Returns:
- A Map to be used a JSON representation of the object
-