Module io.helidon.common.security
Package io.helidon.common.security
Interface SecurityContext<P extends Principal>
- Type Parameters:
P
- type of principal used by the implementation, this common interface uses Java security Principal
- All Known Subinterfaces:
SecurityContext
public interface SecurityContext<P extends Principal>
Security context.
Can be obtained either from context, or from APIs of Helidon components.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Return true if the user is authenticated.boolean
Return true if authorization was handled for current context.Service principal if service is authenticated.User principal if user is authenticated.
-
Method Details
-
isAuthenticated
boolean isAuthenticated()Return true if the user is authenticated. This only cares about USER! not about service. To check if service is authenticated, useservicePrincipal()
and check the resulting optional.- Returns:
true
for authenticated user
-
isAuthorized
boolean isAuthorized()Return true if authorization was handled for current context.- Returns:
true
for authorized requests
-
userPrincipal
User principal if user is authenticated.- Returns:
- current context user principal, or empty if none authenticated
-
servicePrincipal
Service principal if service is authenticated.- Returns:
- current context service principal, or empty if none authenticated
-