io.jsonwebtoken.impl.crypto.MacProvider Java Examples

The following examples show how to use io.jsonwebtoken.impl.crypto.MacProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecretService.java    From tutorials with MIT License 5 votes vote down vote up
public Map<String, String> refreshSecrets() {
    SecretKey key = MacProvider.generateKey(SignatureAlgorithm.HS256);
    secrets.put(SignatureAlgorithm.HS256.getValue(), TextCodec.BASE64.encode(key.getEncoded()));
    key = MacProvider.generateKey(SignatureAlgorithm.HS384);
    secrets.put(SignatureAlgorithm.HS384.getValue(), TextCodec.BASE64.encode(key.getEncoded()));
    key = MacProvider.generateKey(SignatureAlgorithm.HS512);
    secrets.put(SignatureAlgorithm.HS512.getValue(), TextCodec.BASE64.encode(key.getEncoded()));
    return secrets;
}
 
Example #2
Source File: JsonWebTokenAuthenticatorTest.java    From jobson with Apache License 2.0 4 votes vote down vote up
private static Key createSecretKey() {
    return MacProvider.generateKey();
}