Skip to content

Commit

Permalink
Merge pull request quarkusio#38079 from YassinHajaj/main
Browse files Browse the repository at this point in the history
Make OidcTestSecurityIdentityAugmentor faster by making privateKey's generation final and static
  • Loading branch information
sberyozkin authored Feb 10, 2024
2 parents d80aa32 + 9264092 commit 4a5aae6
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 4a5aae6

Please sign in to comment.