risdenk commented on a change in pull request #61: KNOX-1793 -
DefaultKeystoreService should not validate the signing key on initialization
URL: https://github.com/apache/knox/pull/61#discussion_r260761314
##########
File path:
gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenAuthorityService.java
##########
@@ -184,7 +191,7 @@ public boolean verifyToken(JWT token, RSAPublicKey
publicKey)
PublicKey key;
try {
if (publicKey == null) {
- key =
ks.getSigningKeystore().getCertificate(getSigningKeyAlias(signingKeyAlias)).getPublicKey();
+ key =
ks.getSigningKeystore().getCertificate(getSigningKeyAlias(null)).getPublicKey();
Review comment:
How about something like this:
```
private String getSigningKeyAlias(String signingKeystoreAlias) {
if(signingKeystoreAlias != null) {
return signingKeystoreAlias;
}
// Fallback to defaults
return getSigningKeyAlias();
}
private String getSigningKeyAlias() {
String alias = config.getSigningKeyAlias();
return (alias == null) ? GatewayConfig.DEFAULT_SIGNING_KEY_ALIAS : alias;
}
```
The places where `getSigningKeyAlias(null)` can be changed to
`getSigningKeyAlias()`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services