/** * Encrypt identity into text. * @param identity The identity to encrypt * @param key Security key * @return Encrypted text for cookie */ public static String encrypt(@NotNull final Identity identity, @NotNull final String key) { return new Encrypted(identity, key).cookie(); }
/** * Authentication cookie. * @param identity The identity to wrap into the cookie * @return The cookie */ public NewCookie cookie(final Identity identity) { return new CookieBuilder(this.resource.uriInfo().getBaseUri()) .name(AuthInset.AUTH_COOKIE) .value(new Encrypted(identity, this.key).cookie()) .temporary() .build(); }