Class X509CertificateAuthentication
java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
net.devh.boot.grpc.server.security.authentication.X509CertificateAuthentication
- All Implemented Interfaces:
Serializable,Principal,Authentication,CredentialsContainer
An authentication object that was created for a
X509Certificate.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionX509CertificateAuthentication(Object principal, X509Certificate certificate, Collection<? extends GrantedAuthority> authorities) Creates a new X509CertificateAuthentication that was authenticated using the given certificate.X509CertificateAuthentication(X509Certificate certificate) Creates a new X509CertificateAuthentication that will use the given certificate. -
Method Summary
Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
equals, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setDetails, toString
-
Constructor Details
-
X509CertificateAuthentication
Creates a new X509CertificateAuthentication that will use the given certificate. Any code can safely use this constructor to create anAuthentication, because theAbstractAuthenticationToken.isAuthenticated()will returnfalse.- Parameters:
certificate- The certificate to create the authentication from.
-
X509CertificateAuthentication
public X509CertificateAuthentication(Object principal, X509Certificate certificate, Collection<? extends GrantedAuthority> authorities) Creates a new X509CertificateAuthentication that was authenticated using the given certificate. This constructor should only be used byAuthenticationManagers orAuthenticationProviders. The resulting authentication is trusted (AbstractAuthenticationToken.isAuthenticated()returns true) and has the given authorities.- Parameters:
principal- The authenticated principal.certificate- The certificate that was used to authenticate the principal.authorities- The authorities of the principal.
-
-
Method Details
-
getPrincipal
-
getCredentials
-
eraseCredentials
public void eraseCredentials()- Specified by:
eraseCredentialsin interfaceCredentialsContainer- Overrides:
eraseCredentialsin classAbstractAuthenticationToken
-
setAuthenticated
public void setAuthenticated(boolean authenticated) - Specified by:
setAuthenticatedin interfaceAuthentication- Overrides:
setAuthenticatedin classAbstractAuthenticationToken
-