smolnar82 commented on a change in pull request #397:
URL: https://github.com/apache/knox/pull/397#discussion_r555630478
##########
File path:
gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenAuthorityService.java
##########
@@ -78,17 +83,22 @@
private GatewayConfig config;
private char[] cachedSigningKeyPassphrase;
+ private byte[] cachedSigningHmacSecret;
private RSAPrivateKey signingKey;
static {
- // Only standard RSA signature algorithms are accepted
+ // Only standard RSA and HMAC signature algorithms are accepted
// https://tools.ietf.org/html/rfc7518
SUPPORTED_SIG_ALGS.add("RS256");
SUPPORTED_SIG_ALGS.add("RS384");
SUPPORTED_SIG_ALGS.add("RS512");
SUPPORTED_SIG_ALGS.add("PS256");
SUPPORTED_SIG_ALGS.add("PS384");
SUPPORTED_SIG_ALGS.add("PS512");
+ //HMAC
+ SUPPORTED_SIG_ALGS.add("HS256");
+ SUPPORTED_SIG_ALGS.add("HS384");
+ SUPPORTED_SIG_ALGS.add("HS512");
Review comment:
Done and tested:
```
2021-01-12 10:32:35,717 ERROR service.knoxtoken
(TokenResource.java:getAuthenticationToken(439)) - Unable to issue token.
org.apache.knox.gateway.services.security.token.TokenServiceException: The
Knox Gateway is configured to use PKI as signing method, however the supplied
algorithm (HS256) is incompatible with that method
at
org.apache.knox.gateway.services.token.impl.DefaultTokenAuthorityService.signToken(DefaultTokenAuthorityService.java:175)
at
org.apache.knox.gateway.services.token.impl.DefaultTokenAuthorityService.issueToken(DefaultTokenAuthorityService.java:157)
at
org.apache.knox.gateway.services.token.impl.DefaultTokenAuthorityService.issueToken(DefaultTokenAuthorityService.java:137)
at
org.apache.knox.gateway.service.knoxtoken.TokenResource.getAuthenticationToken(TokenResource.java:401)
at
org.apache.knox.gateway.service.knoxtoken.TokenResource.doGet(TokenResource.java:233)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]