public interface AccessPredicate extends BiPredicate<Authentication,io.grpc.ServerCall<?,?>>
Authentication has access to the protected
service/method. This interface assumes, that the user is authenticated before the method is called.| Modifier and Type | Interface and Description |
|---|---|
static interface |
AccessPredicate.SocketPredicate
Some helper methods used to create
Predicates for SocketAddresses. |
| Modifier and Type | Method and Description |
|---|---|
default AccessPredicate |
and(BiPredicate<? super Authentication,? super io.grpc.ServerCall<?,?>> other) |
default AccessPredicate |
and(Predicate<? super Authentication> other)
Combines this predicate with the given predicate using the
AND operator. |
static AccessPredicate |
authenticated()
All authenticated users can access the protected instance including anonymous users.
|
static AccessPredicate |
denyAll()
Nobody can access the protected instance.
|
static AccessPredicate |
fromClientAddress(Predicate<? super SocketAddress> remoteAddressCheck)
Checks that the client connected from the given address.
|
static AccessPredicate |
fullyAuthenticated()
All authenticated users can access the protected instance excluding anonymous users.
|
static AccessPredicate |
hasAllAuthorities(Collection<GrantedAuthority> roles)
Only those who have any of the given
GrantedAuthority can access the protected instance. |
static AccessPredicate |
hasAllAuthorities(GrantedAuthority... roles)
Only those who have all of the given
GrantedAuthority can access the protected instance. |
static AccessPredicate |
hasAllRoles(Collection<String> roles)
Only those who have all of the given roles can access the protected instance.
|
static AccessPredicate |
hasAllRoles(String... roles)
Only those who have all of the given roles can access the protected instance.
|
static AccessPredicate |
hasAnyAuthority(Collection<GrantedAuthority> roles)
Only those who have any of the given
GrantedAuthority can access the protected instance. |
static AccessPredicate |
hasAnyAuthority(GrantedAuthority... roles)
Only those who have any of the given
GrantedAuthority can access the protected instance. |
static AccessPredicate |
hasAnyRole(Collection<String> roles)
Only those who have any of the given roles can access the protected instance.
|
static AccessPredicate |
hasAnyRole(String... roles)
Only those who have any of the given roles can access the protected instance.
|
static AccessPredicate |
hasAuthority(GrantedAuthority role)
Only those who have the given
GrantedAuthority can access the protected instance. |
static AccessPredicate |
hasRole(String role)
Only those who have the given role can access the protected instance.
|
default AccessPredicate |
negate() |
default AccessPredicate |
or(BiPredicate<? super Authentication,? super io.grpc.ServerCall<?,?>> other) |
default AccessPredicate |
or(Predicate<? super Authentication> other)
Combines this predicate with the given predicate using the
OR operator. |
static AccessPredicate |
permitAll()
Special constant that symbolizes that everybody (including unauthenticated users) can access the instance (no
protection).
|
boolean |
test(Authentication authentication,
io.grpc.ServerCall<?,?> serverCall)
Checks whether the given user is authorized to execute the given call.
|
static AccessPredicate |
toServerAddress(Predicate<? super SocketAddress> localAddressCheck)
Checks that the client connected to the given server address.
|
boolean test(Authentication authentication, io.grpc.ServerCall<?,?> serverCall)
test in interface BiPredicate<Authentication,io.grpc.ServerCall<?,?>>authentication - The authentication to check.serverCall - The secure object being called.default AccessPredicate negate()
negate in interface BiPredicate<Authentication,io.grpc.ServerCall<?,?>>default AccessPredicate and(Predicate<? super Authentication> other)
AND operator.other - The other predicate to call.default AccessPredicate and(BiPredicate<? super Authentication,? super io.grpc.ServerCall<?,?>> other)
and in interface BiPredicate<Authentication,io.grpc.ServerCall<?,?>>default AccessPredicate or(Predicate<? super Authentication> other)
OR operator.other - The other predicate to call.default AccessPredicate or(BiPredicate<? super Authentication,? super io.grpc.ServerCall<?,?>> other)
or in interface BiPredicate<Authentication,io.grpc.ServerCall<?,?>>static AccessPredicate permitAll()
Note: This is a special constant, that does not allow execution and mutation. It's sole purpose is to
avoid ambiguity for null values. It should only be used in == comparisons.
static AccessPredicate authenticated()
Note: The negation of this call is denyAll() and NOT all unauthenticated.
static AccessPredicate fullyAuthenticated()
static AccessPredicate denyAll()
Note: The negation of this call is authenticated() and NOT permitAll().
static AccessPredicate hasRole(String role)
role - The role to check for.GrantedAuthoritys
matches the given role name.static AccessPredicate hasAuthority(GrantedAuthority role)
GrantedAuthority can access the protected instance.role - The role to check for.GrantedAuthoritys matches the
given role.static AccessPredicate hasAnyRole(String... roles)
roles - The roles to check for.GrantedAuthoritys
matches any of the given role names.static AccessPredicate hasAnyRole(Collection<String> roles)
roles - The roles to check for.GrantedAuthoritys
matches any of the given role names.static AccessPredicate hasAnyAuthority(GrantedAuthority... roles)
GrantedAuthority can access the protected instance.roles - The roles to check for.GrantedAuthoritys matches any of
the given roles.static AccessPredicate hasAnyAuthority(Collection<GrantedAuthority> roles)
GrantedAuthority can access the protected instance.roles - The roles to check for.GrantedAuthoritys matches any of
the given roles.static AccessPredicate hasAllRoles(String... roles)
roles - The roles to check for.GrantedAuthoritys
matches all of the given role names.static AccessPredicate hasAllRoles(Collection<String> roles)
roles - The roles to check for.GrantedAuthoritys
matches all of the given role names.static AccessPredicate hasAllAuthorities(GrantedAuthority... roles)
GrantedAuthority can access the protected instance.roles - The roles to check for.GrantedAuthoritys matches all of
the given roles.static AccessPredicate hasAllAuthorities(Collection<GrantedAuthority> roles)
GrantedAuthority can access the protected instance.roles - The roles to check for.GrantedAuthoritys matches all of
the given roles.static AccessPredicate fromClientAddress(Predicate<? super SocketAddress> remoteAddressCheck)
remoteAddressCheck - The check to apply to the client address.Grpc.TRANSPORT_ATTR_REMOTE_ADDRstatic AccessPredicate toServerAddress(Predicate<? super SocketAddress> localAddressCheck)
localAddressCheck - The check to apply to the server address.Grpc.TRANSPORT_ATTR_LOCAL_ADDR