Interface Authentication
- All Superinterfaces:
Principal,Serializable
- All Known Implementing Classes:
AuthenticationJWTClaimsSetAdapter,ClientAuthentication,ServerAuthentication,X509Authentication
Represents the state of an authentication.
- Since:
- 1.0
- Author:
- James Kleeh
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull AuthenticationBuilds anAuthenticationinstance for the user.static @NonNull Authenticationbuild(@NonNull String username, @NonNull Collection<String> roles) Builds anAuthenticationinstance for the user.static @NonNull AuthenticationBuilds anAuthenticationinstance for the user.static @NonNull Authenticationbuild(@NonNull String username, @Nullable Collection<String> roles, @Nullable Map<String, Object> attributes) Builds anAuthenticationinstance for the user.In order to correctly implement theSerializablespecification, 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.default @NonNull Collection<String>getRoles()
-
Method Details
-
getAttributes
In order to correctly implement theSerializablespecification, 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.- Returns:
- Any additional attributes in the authentication
-
getRoles
- Returns:
- Any roles associated with the authentication
-
build
Builds anAuthenticationinstance for the user.- Parameters:
username- User's name- Returns:
- An
Authenticationfor the User
-
build
@NonNull static @NonNull Authentication build(@NonNull @NonNull String username, @NonNull @NonNull Collection<String> roles) Builds anAuthenticationinstance for the user.- Parameters:
username- User's nameroles- User's roles- Returns:
- An
Authenticationfor the User
-
build
@NonNull static @NonNull Authentication build(@NonNull @NonNull String username, @NonNull @NonNull Map<String, Object> attributes) Builds anAuthenticationinstance for the user.- Parameters:
username- User's nameattributes- User's attributes- Returns:
- An
Authenticationfor the User
-
build
@NonNull static @NonNull Authentication build(@NonNull @NonNull String username, @Nullable @Nullable Collection<String> roles, @Nullable @Nullable Map<String, Object> attributes) Builds anAuthenticationinstance for the user.- Parameters:
username- User's nameroles- User's rolesattributes- User's attributes- Returns:
- An
Authenticationfor the User
-