use of org.jose4j.jwk.JsonWebKey in project cas by apereo.
the class BaseStringCipherExecutor method prepareJsonWebTokenKey.
/**
* Prepare json web token key.
*
* @param secret the secret
* @return the key
*/
private static Key prepareJsonWebTokenKey(final String secret) {
try {
final Map<String, Object> keys = new HashMap<>(2);
keys.put("kty", "oct");
keys.put(EncodingUtils.JSON_WEB_KEY, secret);
final JsonWebKey jwk = JsonWebKey.Factory.newJwk(keys);
return jwk.getKey();
} catch (final Exception e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
Aggregations