/** * Backward-compatible generate function. * @param principal * @return * @throws InvalidKeyException * @throws IOException */ public final String generate(final HttpPrincipal principal) throws InvalidKeyException, IOException { Set<Principal> principalSet = new HashSet<>(); principalSet.add(principal); return generate(principalSet, null); }
/** * Generate a new cookie value for the given HttpPrincipal. * Format of the value is: * HttpPrincipal-ExpirationDateUTC-Base64SignatureToken * where: * HttpPrincipal - principal of the user * ExpirationDateUTC - long representing the expiration Java date in UTC * Base64SignatureToken - The signature token of the 2 fields above in * Base64 format. * * @param principal The HttpPrincipal to generate the value from. * @return string of the value. never null. * @throws IOException Any errors with writing and generation. * @throws InvalidKeyException Signing key is invalid */ public final String generate(final HttpPrincipal principal, URI scope) throws InvalidKeyException, IOException { Set<Principal> principalSet = new HashSet<>(); principalSet.add(principal); return generate(principalSet, scope); }
/** * Generate a new cookie value for the set of Principals. * * @param principalSet The HttpPrincipal to generate the value from. * @return string of the value. never null. * @throws IOException Any errors with writing and generation. * @throws InvalidKeyException Signing key is invalid */ public final String generate(final Set<Principal> principalSet, URI scope) throws InvalidKeyException, IOException { return generate(principalSet, scope, getExpirationDate()); }