public class AnonymousAuthenticationReader extends java.lang.Object implements GrpcAuthenticationReader
Constructor and Description |
---|
AnonymousAuthenticationReader(java.lang.String key)
Creates a new AnonymousAuthenticationReader with the given key and
"anonymousUser" as principal with the
ROLE_ANONYMOUS . |
AnonymousAuthenticationReader(java.lang.String key,
java.lang.Object principal,
java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
Creates a new AnonymousAuthenticationReader with the given key,principal and authorities.
|
Modifier and Type | Method and Description |
---|---|
org.springframework.security.core.Authentication |
readAuthentication(io.grpc.ServerCall<?,?> call,
io.grpc.Metadata headers)
Tries to read the
Authentication information from the given call and metadata. |
public AnonymousAuthenticationReader(java.lang.String key)
"anonymousUser"
as principal with the
ROLE_ANONYMOUS
.key
- The key to used to identify tokens that were created by this instance.public AnonymousAuthenticationReader(java.lang.String key, java.lang.Object principal, java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
key
- The key to used to identify tokens that were created by this instance.principal
- The principal which will be used to represent anonymous users.authorities
- The authority list for anonymous users.public org.springframework.security.core.Authentication readAuthentication(io.grpc.ServerCall<?,?> call, io.grpc.Metadata headers)
GrpcAuthenticationReader
Authentication
information from the given call and metadata.
Note: Implementations are free to throw an AuthenticationException
if no credentials could be
found in the call. If an exception is thrown by an implementation then the authentication attempt should be
considered as failed and no subsequent GrpcAuthenticationReader
s should be called.
readAuthentication
in interface GrpcAuthenticationReader
call
- The call to get that send the request.headers
- The metadata/headers as sent by the client.