Class JwtCookieSession

  • All Implemented Interfaces:
    Map<String,​Object>, Session, DirtyListener

    public class JwtCookieSession
    extends MapDecorator<String,​Object>
    implements Session, DirtyListener
    Represents an Identity Gateway Session that will be stored as an encrypted and signed JSON Web Token in a Cookie.

    The generated JWT is encrypted with the JweAlgorithm.RSAES_PKCS1_V1_5 algorithm and EncryptionMethod.A128CBC_HS256 method and then signed with the JwsAlgorithm.HS256 algorithm.

    • Field Detail

      • OPENIG_JWT_SESSION

        public static final String OPENIG_JWT_SESSION
        Name of the cookie that will store the JWT session.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JwtCookieSession

        public JwtCookieSession​(Request request,
                                KeyPair pair,
                                CookieBuilder cookieBuilder,
                                Clock clock,
                                Duration sessionTimeout,
                                boolean persistentCookie,
                                Duration skewAllowance,
                                org.forgerock.json.jose.jws.handlers.SigningHandler signingHandler)
        Builds a new JwtCookieSession that will manage the given Request's session.
        Parameters:
        request - Request used to access Cookie and Set-Cookie headers.
        pair - Secret key used to sign the JWT payload.
        cookieBuilder - The CookieBuilder for building the session cookie.
        clock - Clock to use when dealing with JWT sessions' expiration.
        sessionTimeout - The duration of the JWT session.
        persistentCookie - Issue a persistent cookie (with Expiry attribute) or a session cookie (no Expiry attribute)
        skewAllowance - The skew allowance to use for temporal validation on the JwtCookieSession.
        signingHandler - The JWT signing handler.