public final class ManualGrpcSecurityMetadataSource extends AbstractGrpcSecurityMetadataSource
GrpcSecurityMetadataSource
for manual configuration. For each gRPC method
a
AccessPredicate
can be defined, that checks whether the user is authenticated and has access. This metadata
source only works if an AccessDecisionManager
is configured with an AccessPredicateVoter
.
Note: This instance is initialized with deny all
as default.
Constructor and Description |
---|
ManualGrpcSecurityMetadataSource() |
Modifier and Type | Method and Description |
---|---|
Collection<ConfigAttribute> |
getAllConfigAttributes() |
Collection<ConfigAttribute> |
getAttributes(MethodDescriptor<?,?> method)
Accesses the
ConfigAttribute s that apply to a given secure object. |
ManualGrpcSecurityMetadataSource |
remove(MethodDescriptor<?,?> method)
Removes all access predicates for the given method.
|
ManualGrpcSecurityMetadataSource |
remove(ServiceDescriptor service)
Removes all access predicates for the all methods of the given service.
|
ManualGrpcSecurityMetadataSource |
set(MethodDescriptor<?,?> method,
AccessPredicate predicate)
Set the given access predicate for the given method.
|
ManualGrpcSecurityMetadataSource |
set(ServiceDescriptor service,
AccessPredicate predicate)
Set the given access predicate for the all methods of the given service.
|
ManualGrpcSecurityMetadataSource |
setDefault(AccessPredicate predicate)
Sets the default that will be used if no specific configuration has been made.
|
protected Collection<ConfigAttribute> |
wrap(AccessPredicate predicate)
Wraps the given predicate in a configuration attribute and an immutable collection.
|
getAttributes, supports
public Collection<ConfigAttribute> getAttributes(MethodDescriptor<?,?> method)
GrpcSecurityMetadataSource
ConfigAttribute
s that apply to a given secure object.method
- The grpc method being secured.public Collection<ConfigAttribute> getAllConfigAttributes()
public ManualGrpcSecurityMetadataSource set(ServiceDescriptor service, AccessPredicate predicate)
service
- The service to protect with a custom check.predicate
- The predicate used to check the Authentication
.setDefault(AccessPredicate)
public ManualGrpcSecurityMetadataSource remove(ServiceDescriptor service)
service
- The service to protect with only the default.setDefault(AccessPredicate)
public ManualGrpcSecurityMetadataSource set(MethodDescriptor<?,?> method, AccessPredicate predicate)
method
- The method to protect with a custom check.predicate
- The predicate used to check the Authentication
.setDefault(AccessPredicate)
public ManualGrpcSecurityMetadataSource remove(MethodDescriptor<?,?> method)
method
- The method to protect with only the default.setDefault(AccessPredicate)
public ManualGrpcSecurityMetadataSource setDefault(AccessPredicate predicate)
predicate
- The default predicate used to check the Authentication
.protected Collection<ConfigAttribute> wrap(AccessPredicate predicate)
predicate
- The predicate to wrap.