use of org.pac4j.jwt.config.signature.ECSignatureConfiguration in project pac4j by pac4j.
the class JwtTests method buildECSignatureConfiguration.
private ECSignatureConfiguration buildECSignatureConfiguration() throws NoSuchAlgorithmException {
final KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC");
final KeyPair keyPair = keyGen.generateKeyPair();
return new ECSignatureConfiguration(keyPair, JWSAlgorithm.ES256);
}
use of org.pac4j.jwt.config.signature.ECSignatureConfiguration in project pac4j by pac4j.
the class JwtTests method testPemJwt.
@Test
public void testPemJwt() throws NoSuchAlgorithmException {
final FacebookProfile profile = createProfile();
final ECSignatureConfiguration signatureConfiguration = buildECSignatureConfiguration();
final JwtGenerator<FacebookProfile> generator = new JwtGenerator<>(signatureConfiguration);
final String token = generator.generate(profile);
final JwtAuthenticator authenticator = new JwtAuthenticator();
authenticator.addSignatureConfiguration(signatureConfiguration);
assertToken(profile, token, authenticator);
}
Aggregations