AuthenticationUtils

public class AuthenticationUtils

Useful static methods, mainly for parsing and serializing SessionTokens by the means of web cookies and producing session timeout cookies.

Author:

tf

Fields

Methods

createSessionTimeoutCookie

public static CookieSetting createSessionTimeoutCookie(SessionToken token)

Create a session timeout cookie. The value is a plain UTC timestamp which tells the user how long his session will stay active. This cookie will be ignored by the server and carries only additional information for the user interfaces (E.g. they can remind the user before her session is expiring or do an auto-logout based on this timestamp). Of course, the cookie will be flagged with httpOnly:false (but secure:true).

Parameters:
  • token – a SessionToken

createSessionTokenCookie

public static CookieSetting createSessionTokenCookie(SelfValidatingAuthenticationToken token)

getAuthorizationInfo

public static AuthorizationInfo getAuthorizationInfo(Subject user)

getLogoutCookies

public static Collection<? extends CookieSetting> getLogoutCookies()

getLogoutSessionTokenCookie

public static CookieSetting getLogoutSessionTokenCookie()

getRoles

public static Collection<String> getRoles(Subject user)

isAnonymous

public static boolean isAnonymous(Subject user)

isAnonymous

public static boolean isAnonymous(Principal principal)

isFromOneTimeTokenRealm

public static boolean isFromOneTimeTokenRealm(Subject subject)

isResponsibleAgentExistent

public static boolean isResponsibleAgentExistent(ResponsibleAgent agent)

parseSessionTokenCookie

public static SelfValidatingAuthenticationToken parseSessionTokenCookie(Cookie cookie)

Parse a SessionToken from a cookie with optional cryptographic curry.

Parameters:
  • cookie

  • curry

Returns:

A new SessionToken

See also: {@linkAuthenticationUtils.createSessionTokenCookie(SessionToken)},{@linkSessionToken}