-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add azp to JWKS endpoint headers #1285
Conversation
.../src/main/java/com/sap/cloud/security/token/validation/validators/JwtSignatureValidator.java
Outdated
Show resolved
Hide resolved
.../java/com/sap/cloud/security/token/validation/validators/OAuth2TokenKeyServiceWithCache.java
Fixed
Show fixed
Hide fixed
.../java/com/sap/cloud/security/token/validation/validators/OAuth2TokenKeyServiceWithCache.java
Fixed
Show fixed
Hide fixed
.../java/com/sap/cloud/security/token/validation/validators/OAuth2TokenKeyServiceWithCache.java
Fixed
Show fixed
Hide fixed
.../java/com/sap/cloud/security/token/validation/validators/OAuth2TokenKeyServiceWithCache.java
Fixed
Show fixed
Hide fixed
.../java/com/sap/cloud/security/token/validation/validators/OAuth2TokenKeyServiceWithCache.java
Fixed
Show fixed
Hide fixed
…ew method a default method
.../java/com/sap/cloud/security/token/validation/validators/OAuth2TokenKeyServiceWithCache.java
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things to consider, see comments.
.../src/main/java/com/sap/cloud/security/token/validation/validators/JwtSignatureValidator.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/sap/cloud/security/token/validation/validators/JwtSignatureValidator.java
Outdated
Show resolved
Hide resolved
...security/src/main/java/com/sap/cloud/security/token/validation/validators/JsonWebKeySet.java
Outdated
Show resolved
Hide resolved
.../java/com/sap/cloud/security/token/validation/validators/OAuth2TokenKeyServiceWithCache.java
Outdated
Show resolved
Hide resolved
…or and SapIdJwtSignatureValidator
… hotfix/jwksEndpointHeaders
Split JwtSignatureValidator into two service-specific implementations to clean up its code and prepare for service-specific retrieval of JWKS in future refactorings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All in all really nice job 💯
I'm just troubled by the number of arguments that TokenKeyService method retrieveTokenKeys
and OAuth2TokenKeyServiceWithCache.getPublicKey(JwtSignatureAlgorithm keyAlgorithm, String keyId, URI keyUri, String appTid, String clientId, String azp)
introduces, it should be refactored and a new class should be introduced that encapsulates all the required header parameters.
.../java/com/sap/cloud/security/token/validation/validators/OAuth2TokenKeyServiceWithCache.java
Outdated
Show resolved
Hide resolved
...main/java/com/sap/cloud/security/token/validation/validators/XsuaaJwtSignatureValidator.java
Outdated
Show resolved
Hide resolved
token-client/src/main/java/com/sap/cloud/security/xsuaa/client/SpringOAuth2TokenKeyService.java
Outdated
Show resolved
Hide resolved
token-client/src/main/java/com/sap/cloud/security/xsuaa/client/OAuth2TokenKeyService.java
Outdated
Show resolved
Hide resolved
...n-client/src/main/java/com/sap/cloud/security/xsuaa/client/DefaultOAuth2TokenKeyService.java
Outdated
Show resolved
Hide resolved
I used a Map<String, String> now to pass the parameters since the required parameters are different for XSUAA and IAS and I do not think a dedicated class can be defined with the required parameters that works for both services. |
@@ -77,7 +67,7 @@ | |||
.build(); | |||
} | |||
|
|||
LOGGER.debug("Successfully retrieved token keys from {} for tenant '{}'", tokenKeysEndpointUri, tenantId); | |||
LOGGER.debug("Successfully retrieved token keys from {} with params {}.", tokenKeysEndpointUri, params); |
Check failure
Code scanning / CodeQL
Insertion of sensitive information into log files
try { | ||
ResponseEntity<String> response = restOperations.exchange( | ||
tokenKeysEndpointUri, GET, new HttpEntity<>(headers), String.class); | ||
if (HttpStatus.OK.value() == response.getStatusCode().value()) { | ||
LOGGER.debug("Successfully retrieved token keys from {} for tenant '{}'", tokenKeysEndpointUri, tenantId); | ||
LOGGER.debug("Successfully retrieved token keys from {} for params '{}'", tokenKeysEndpointUri, params); |
Check failure
Code scanning / CodeQL
Insertion of sensitive information into log files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, so much cleaner with the map as param 👍🏻 just check the 2 comments before merging.
...main/java/com/sap/cloud/security/token/validation/validators/XsuaaJwtSignatureValidator.java
Outdated
Show resolved
Hide resolved
token-client/src/main/java/com/sap/cloud/security/xsuaa/client/testa.java
Outdated
Show resolved
Hide resolved
* add x-azp header to JWKS fetching and adjust JWKS cache key * refactor JwtSignatureValidator -> Split into XsuaaJwtSignatureValidator and SapIdJwtSignatureValidator * refactor OAuth2TokenKeyService and OAuth2TokenKeyServiceWithCache APIs to use generic Map instead of explicit IAS-specific parameters --------- Co-authored-by: liga-oz <liga.ozolina@sap.com>
No description provided.