Skip to content

Commit

Permalink
(4.2.2) Corrected CrossEncryptionTest
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriyz committed Nov 14, 2020
1 parent dab2631 commit a1a289f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 7 additions & 3 deletions Server/src/main/java/org/gluu/oxauth/model/token/JwtSigner.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,22 @@ public class JwtSigner {

private Jwt jwt;

public JwtSigner(AppConfiguration appConfiguration, JSONWebKeySet webKeys, SignatureAlgorithm signatureAlgorithm, String audience) throws Exception {
public JwtSigner(AppConfiguration appConfiguration, JSONWebKeySet webKeys, SignatureAlgorithm signatureAlgorithm, String audience) {
this(appConfiguration, webKeys, signatureAlgorithm, audience, null);
}

public JwtSigner(AppConfiguration appConfiguration, JSONWebKeySet webKeys, SignatureAlgorithm signatureAlgorithm, String audience, String hmacSharedSecret) throws Exception {
public JwtSigner(AppConfiguration appConfiguration, JSONWebKeySet webKeys, SignatureAlgorithm signatureAlgorithm, String audience, String hmacSharedSecret) {
this(appConfiguration, webKeys, signatureAlgorithm, audience, hmacSharedSecret,null);
}

public JwtSigner(AppConfiguration appConfiguration, JSONWebKeySet webKeys, SignatureAlgorithm signatureAlgorithm, String audience, String hmacSharedSecret, AbstractCryptoProvider cryptoProvider) {
this.appConfiguration = appConfiguration;
this.webKeys = webKeys;
this.signatureAlgorithm = signatureAlgorithm;
this.audience = audience;
this.hmacSharedSecret = hmacSharedSecret;

cryptoProvider = new ServerCryptoProvider(CdiUtil.bean(AbstractCryptoProvider.class));
this.cryptoProvider = cryptoProvider != null ? cryptoProvider : new ServerCryptoProvider( CdiUtil.bean(AbstractCryptoProvider.class));
}

public static JwtSigner newJwtSigner(AppConfiguration appConfiguration, JSONWebKeySet webKeys, Client client) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,7 @@ public void nestedJWTProducedByGluu() throws Exception {
JSONWebKeySet keySet = new JSONWebKeySet();
keySet.setKeys(keyArrayList);

final JwtSigner jwtSigner = new JwtSigner(appConfiguration, keySet, SignatureAlgorithm.RS256, "audience");
jwtSigner.setCryptoProvider(new AbstractCryptoProvider() {
final JwtSigner jwtSigner = new JwtSigner(appConfiguration, keySet, SignatureAlgorithm.RS256, "audience", null, new AbstractCryptoProvider() {
@Override
public JSONObject generateKey(Algorithm algorithm, Long expirationTime, Use use) throws Exception {
return null;
Expand Down Expand Up @@ -412,7 +411,7 @@ public PrivateKey getPrivateKey(String keyId) throws Exception {
}
});
Jwt jwt = jwtSigner.newJwt();
jwt.getClaims().setSubjectIdentifier("testi");
jwt.getClaims().setSubjectIdentifier("testing");
jwt.getClaims().setIssuer("https:devgluu.saminet.local");
jwt = jwtSigner.sign();

Expand Down

0 comments on commit a1a289f

Please sign in to comment.