Package at.jku.dke.etutor.task_app.auth
Class ApiKeyAuthentication
java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
at.jku.dke.etutor.task_app.auth.ApiKeyAuthentication
- All Implemented Interfaces:
Serializable
,Principal
,org.springframework.security.core.Authentication
,org.springframework.security.core.CredentialsContainer
public class ApiKeyAuthentication
extends org.springframework.security.authentication.AbstractAuthenticationToken
API-key authentication token.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe credentials that prove the principal is correct.The identity of the principal being authenticated.Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
-
Constructor Details
-
ApiKeyAuthentication
Creates a new instance of classApiKeyAuthentication
.Sets the role (
ApiKeyConfiguration.ApiKey.roles()
) of the API key as authority.- Parameters:
apiKey
- The API-key for which to create the authentication token.
-
-
Method Details
-
getCredentials
The credentials that prove the principal is correct.- Returns:
- The
ApiKeyConfiguration.ApiKey.key()
.
-
getPrincipal
The identity of the principal being authenticated.- Returns:
- The
ApiKeyConfiguration.ApiKey
.
-