Skip to content

Commit

Permalink
Make OidcTestSecurityIdentityAugmentor faster by making privateKey's …
Browse files Browse the repository at this point in the history
…generation final and static
  • Loading branch information
Yassin Hajaj committed Feb 7, 2024
1 parent 4151049 commit 9264092
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,21 @@ public class OidcTestSecurityIdentityAugmentor implements TestSecurityIdentityAu
Claims.auth_time.name(), ClaimType.LONG,
Claims.email_verified.name(), ClaimType.BOOLEAN);

private static final PrivateKey privateKey;
private Optional<String> issuer;
private PrivateKey privateKey;

public OidcTestSecurityIdentityAugmentor(Optional<String> issuer) {
this.issuer = issuer;
static {
try {
privateKey = KeyUtils.generateKeyPair(2048).getPrivate();
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException(ex);
}
}

public OidcTestSecurityIdentityAugmentor(Optional<String> issuer) {
this.issuer = issuer;
}

@Override
public SecurityIdentity augment(final SecurityIdentity identity, final Annotation[] annotations) {
QuarkusSecurityIdentity.Builder builder = QuarkusSecurityIdentity.builder(identity);
Expand Down

0 comments on commit 9264092

Please sign in to comment.