Package org.ehrbase.rest.util
Class AuthHelper
java.lang.Object
org.ehrbase.rest.util.AuthHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetCurrentAuthenticatedUsername(javax.servlet.http.HttpServletRequest request) Gets the currently authenticated username from the given HTTP request.static StringgetRequestedJwtClaim(org.springframework.security.authentication.AbstractAuthenticationToken token, String requestedClaim) Extracts the requested claim from the token's claims.
-
Method Details
-
getCurrentAuthenticatedUsername
Gets the currently authenticated username from the given HTTP request.- Parameters:
request- The HTTP request- Returns:
- The username if it exists, or an empty string if not
-
getRequestedJwtClaim
public static String getRequestedJwtClaim(org.springframework.security.authentication.AbstractAuthenticationToken token, String requestedClaim) Extracts the requested claim from the token's claims.- Parameters:
token- TokenrequestedClaim- The claim to be retrieved- Returns:
- The value of the requested claim
-