Class ManualGrpcSecurityMetadataSource
java.lang.Object
net.devh.boot.grpc.server.security.check.AbstractGrpcSecurityMetadataSource
net.devh.boot.grpc.server.security.check.ManualGrpcSecurityMetadataSource
- All Implemented Interfaces:
GrpcSecurityMetadataSource
,AopInfrastructureBean
,SecurityMetadataSource
A
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAttributes
(ServerCall<?, ?> call) Accesses theConfigAttribute
s that apply to a given secure object.remove
(MethodDescriptor<?, ?> method) Removes all access predicates for the given method.remove
(ServiceDescriptor service) Removes all access predicates for the all methods of the given service.set
(MethodDescriptor<?, ?> method, AccessPredicate predicate) Set the given access predicate for the given method.set
(ServiceDescriptor service, AccessPredicate predicate) Set the given access predicate for the all methods of the given service.setDefault
(AccessPredicate predicate) Sets the default that will be used if no specific configuration has been made.Methods inherited from class net.devh.boot.grpc.server.security.check.AbstractGrpcSecurityMetadataSource
getAttributes, supports
-
Constructor Details
-
ManualGrpcSecurityMetadataSource
public ManualGrpcSecurityMetadataSource()
-
-
Method Details
-
getAttributes
Description copied from interface:GrpcSecurityMetadataSource
Accesses theConfigAttribute
s that apply to a given secure object.- Parameters:
call
- The grpc call being secured.- Returns:
- The attributes that apply to the passed in secured object. Should return an empty collection if there are no applicable attributes.
-
getAllConfigAttributes
-
set
Set the given access predicate for the all methods of the given service. This will replace previously set predicates.- Parameters:
service
- The service to protect with a custom check.predicate
- The predicate used to check theAuthentication
.- Returns:
- This instance for chaining.
- See Also:
-
remove
Removes all access predicates for the all methods of the given service. After that, the default will be used for those methods.- Parameters:
service
- The service to protect with only the default.- Returns:
- This instance for chaining.
- See Also:
-
set
public ManualGrpcSecurityMetadataSource set(MethodDescriptor<?, ?> method, AccessPredicate predicate) Set the given access predicate for the given method. This will replace previously set predicates.- Parameters:
method
- The method to protect with a custom check.predicate
- The predicate used to check theAuthentication
.- Returns:
- This instance for chaining.
- See Also:
-
remove
Removes all access predicates for the given method. After that, the default will be used for that method.- Parameters:
method
- The method to protect with only the default.- Returns:
- This instance for chaining.
- See Also:
-
setDefault
Sets the default that will be used if no specific configuration has been made.- Parameters:
predicate
- The default predicate used to check theAuthentication
.- Returns:
- This instance for chaining.
-