File tree 2 files changed +18
-5
lines changed
main/java/com/tngtech/keycloakmock/impl/handler
test/java/com/tngtech/keycloakmock/impl/handler
2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -48,17 +48,30 @@ private static JsonObject toSigningKey(
48
48
if (publicKey instanceof RSAPublicKey ) {
49
49
result .put ("kty" , "RSA" );
50
50
RSAPublicKey rsaKey = (RSAPublicKey ) publicKey ;
51
- result .put ("n" , Base64 .getUrlEncoder ().encodeToString (rsaKey .getModulus ().toByteArray ()));
52
51
result .put (
53
- "e" , Base64 .getUrlEncoder ().encodeToString (rsaKey .getPublicExponent ().toByteArray ()));
52
+ "n" ,
53
+ Base64 .getUrlEncoder ()
54
+ .withoutPadding ()
55
+ .encodeToString (rsaKey .getModulus ().toByteArray ()));
56
+ result .put (
57
+ "e" ,
58
+ Base64 .getUrlEncoder ()
59
+ .withoutPadding ()
60
+ .encodeToString (rsaKey .getPublicExponent ().toByteArray ()));
54
61
} else if (publicKey instanceof ECPublicKey ) {
55
62
result .put ("kty" , "EC" );
56
63
ECPublicKey ecKey = (ECPublicKey ) publicKey ;
57
64
result .put ("crv" , "P-" + ecKey .getParams ().getOrder ().bitLength ());
58
65
result .put (
59
- "x" , Base64 .getUrlEncoder ().encodeToString (ecKey .getW ().getAffineX ().toByteArray ()));
66
+ "x" ,
67
+ Base64 .getUrlEncoder ()
68
+ .withoutPadding ()
69
+ .encodeToString (ecKey .getW ().getAffineX ().toByteArray ()));
60
70
result .put (
61
- "y" , Base64 .getUrlEncoder ().encodeToString (ecKey .getW ().getAffineY ().toByteArray ()));
71
+ "y" ,
72
+ Base64 .getUrlEncoder ()
73
+ .withoutPadding ()
74
+ .encodeToString (ecKey .getW ().getAffineY ().toByteArray ()));
62
75
} else {
63
76
throw new IllegalStateException ("Invalid public key type found" );
64
77
}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ void rsaKeyIsCorrectlyExported() throws Exception {
33
33
.hasFieldOrPropertyWithValue ("use" , "sig" )
34
34
.hasFieldOrPropertyWithValue (
35
35
"n" ,
36
- "AKzaf4nijuwtAn9ieZaz-iGXBp1pFm6dJMAxRO6ax2CV9cBFeThxrKJNFmDY7j7gKRnrgWxvgJKSd3hAm_CGmXHbTM8cPi_gsof-CsOohv7LH0UYbr0UpCIJncTiRrKQto7q_NOO4Jh1EBSLMPX7MzttEhh35Ue9txHLq3zkdkR6BR6nGS7QxEg7FzYzA4IooV59OPr-TvlDxbEpwc1wkRZDGavo-WjngAt7m_BEQtHnav3whitbrMmi_1tWY8cQbO9D4FuQTM7yvACLSv94G2TCvsjm_gGJmOJyRBkI1r-uEIfhz9-VIKlswqapKSul-Hoxv5NycucRa4xi4N39dfM= " )
36
+ "AKzaf4nijuwtAn9ieZaz-iGXBp1pFm6dJMAxRO6ax2CV9cBFeThxrKJNFmDY7j7gKRnrgWxvgJKSd3hAm_CGmXHbTM8cPi_gsof-CsOohv7LH0UYbr0UpCIJncTiRrKQto7q_NOO4Jh1EBSLMPX7MzttEhh35Ue9txHLq3zkdkR6BR6nGS7QxEg7FzYzA4IooV59OPr-TvlDxbEpwc1wkRZDGavo-WjngAt7m_BEQtHnav3whitbrMmi_1tWY8cQbO9D4FuQTM7yvACLSv94G2TCvsjm_gGJmOJyRBkI1r-uEIfhz9-VIKlswqapKSul-Hoxv5NycucRa4xi4N39dfM" )
37
37
.hasFieldOrPropertyWithValue ("e" , "AQAB" );
38
38
}
39
39
You can’t perform that action at this time.
0 commit comments