Package org.damap.base.security
Class SecurityService
java.lang.Object
org.damap.base.security.SecurityService
SecurityService class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.microprofile.jwt.JsonWebTokencheckIfUserIsAuthorized(jakarta.ws.rs.core.HttpHeaders headers) Checks if the user is authorized based on the JWT token.getUserId.getUserName.booleanisAdmin()isAdmin.org.eclipse.microprofile.jwt.JsonWebTokenvalidateAuthHeader(jakarta.ws.rs.core.HttpHeaders headers) Validates a JWT token from the X-Auth header.
-
Constructor Details
-
SecurityService
public SecurityService()
-
-
Method Details
-
getUserId
getUserId.- Returns:
- a
Stringobject
-
getUserName
getUserName.- Returns:
- a
Stringobject
-
getDisplayName
-
isAdmin
public boolean isAdmin()isAdmin.- Returns:
- a boolean
-
validateAuthHeader
public org.eclipse.microprofile.jwt.JsonWebToken validateAuthHeader(jakarta.ws.rs.core.HttpHeaders headers) Validates a JWT token from the X-Auth header.- Parameters:
headers- HttpHeaders containing the Authorization token.- Returns:
- JsonWebToken if valid, null otherwise.
-
checkIfUserIsAuthorized
public org.eclipse.microprofile.jwt.JsonWebToken checkIfUserIsAuthorized(jakarta.ws.rs.core.HttpHeaders headers) Checks if the user is authorized based on the JWT token.- Parameters:
headers- HttpHeaders containing the Authorization token.- Returns:
- JsonWebToken if the user is authorized.
-