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 Authentication
Builds anAuthentication
instance for the user.static @NonNull Authentication
build
(@NonNull String username, @NonNull Collection<String> roles) Builds anAuthentication
instance for the user.static @NonNull Authentication
Builds anAuthentication
instance for the user.static @NonNull Authentication
build
(@NonNull String username, @Nullable Collection<String> roles, @Nullable Map<String, Object> attributes) Builds anAuthentication
instance for the user.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.default @NonNull Collection<String>
getRoles()
-
Method Details
-
getAttributes
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
.- Returns:
- Any additional attributes in the authentication
-
getRoles
- Returns:
- Any roles associated with the authentication
-
build
Builds anAuthentication
instance for the user.- Parameters:
username
- User's name- Returns:
- An
Authentication
for the User
-
build
@NonNull static @NonNull Authentication build(@NonNull @NonNull String username, @NonNull @NonNull Collection<String> roles) Builds anAuthentication
instance for the user.- Parameters:
username
- User's nameroles
- User's roles- Returns:
- An
Authentication
for the User
-
build
@NonNull static @NonNull Authentication build(@NonNull @NonNull String username, @NonNull @NonNull Map<String, Object> attributes) Builds anAuthentication
instance for the user.- Parameters:
username
- User's nameattributes
- User's attributes- Returns:
- An
Authentication
for the User
-
build
@NonNull static @NonNull Authentication build(@NonNull @NonNull String username, @Nullable @Nullable Collection<String> roles, @Nullable @Nullable Map<String, Object> attributes) Builds anAuthentication
instance for the user.- Parameters:
username
- User's nameroles
- User's rolesattributes
- User's attributes- Returns:
- An
Authentication
for the User
-