Package org.craftercms.security.utils
Class SecurityUtils
java.lang.Object
org.craftercms.security.utils.SecurityUtils
Contains security utility methods.
- Author:
- Alfonso Vásquez
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticationgetAuthentication(javax.servlet.http.HttpServletRequest request) Returns the authentication attribute from the specified request.static AuthenticationReturns the authentication attribute from the current request.static ProfileReturns the profile from authentication attribute from the current request.static ProfilegetProfile(javax.servlet.http.HttpServletRequest request) Returns the profile from authentication attribute from the specified request.static LonggetProfileLastModifiedCookie(javax.servlet.http.HttpServletRequest request) Returns the last modified timestamp cookie from the request.static StringgetTicketCookie(javax.servlet.http.HttpServletRequest request) Returns the ticket cookie value from the request.static voidremoveAuthentication(javax.servlet.http.HttpServletRequest request) Removes the authentication attribute from the specified request.static voidRemoves the authentication attribute from the current request.static voidsetAuthentication(javax.servlet.http.HttpServletRequest request, Authentication authentication) Sets the authentication attribute in the specified request.static voidsetCurrentAuthentication(Authentication authentication) Sets the authentication attribute in the current request.
-
Field Details
-
AUTHENTICATION_EXCEPTION_SESSION_ATTRIBUTE
- See Also:
-
BAD_CREDENTIALS_EXCEPTION_SESSION_ATTRIBUTE
- See Also:
-
ACCESS_DENIED_EXCEPTION_SESSION_ATTRIBUTE
- See Also:
-
TICKET_COOKIE_NAME
- See Also:
-
PROFILE_LAST_MODIFIED_COOKIE_NAME
- See Also:
-
TENANT_REQUEST_ATTRIBUTE_NAME
- See Also:
-
AUTHENTICATION_REQUEST_ATTRIBUTE_NAME
- See Also:
-
-
Method Details
-
getTicketCookie
Returns the ticket cookie value from the request.- Parameters:
request- the request where to retrieve the ticket from- Returns:
- the ticket
-
getProfileLastModifiedCookie
Returns the last modified timestamp cookie from the request.- Parameters:
request- the request where to retrieve the last modified timestamp from- Returns:
- the last modified timestamp of the authenticated profile
-
getCurrentAuthentication
Returns the authentication attribute from the current request.- Returns:
- the authentication object
-
setCurrentAuthentication
Sets the authentication attribute in the current request.- Parameters:
authentication- the authentication object to set as request attribute
-
removeCurrentAuthentication
public static void removeCurrentAuthentication()Removes the authentication attribute from the current request. -
getAuthentication
Returns the authentication attribute from the specified request.- Parameters:
request- the request where to get the attribute from- Returns:
- the authentication object
-
setAuthentication
public static void setAuthentication(javax.servlet.http.HttpServletRequest request, Authentication authentication) Sets the authentication attribute in the specified request.- Parameters:
request- the request where to add the attribute toauthentication- the authentication object to set as request attribute
-
removeAuthentication
public static void removeAuthentication(javax.servlet.http.HttpServletRequest request) Removes the authentication attribute from the specified request.- Parameters:
request- the request where to remove the attribute from
-
getCurrentProfile
Returns the profile from authentication attribute from the current request.- Returns:
- the profile object, or null if there's no authentication
-
getProfile
Returns the profile from authentication attribute from the specified request.- Returns:
- the profile object, or null if there's no authentication
-