-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added debug information for expired jwt (#214)
* Enhance JWT verification logs with detailed claim data Added detailed claim data to logs on JWT expiration and not-before time checks. This improves the ability to diagnose issues by providing comprehensive context in error messages. * Add Mockito dependencies and JWTClaimsSetVerifierWithLogsTest This commit adds Mockito dependencies to the pom.xml file to facilitate mocking in unit tests. It also introduces the JWTClaimsSetVerifierWithLogsTest class to test JWT claim set verification, ensuring proper handling of expired and not-before JWT conditions. * Add BadJOSEException handling for token processing This commit introduces exception handling for BadJOSEException across the codebase, ensuring that invalid JWT tokens are appropriately handled. The changes include method signatures updates to propagate the exception and modifications in various services, controllers, and tests to handle the exception correctly and provide proper feedback in case of an error. * Add MDC logging to JWTClaimsSetVerifierWithLogs Introduce MDC logging for subject, issue time, and token ID in JWTClaimsSetVerifierWithLogs. This enhancement allows for better traceability and debugging by including these details in the log context. * Enhance logging and error handling for token exchange and JWT Added detailed trace ID and span ID headers in error responses across TokenExchangeController and JWTAuthenticationFilter. These changes improve debuggability by providing clearer error context and extended log information. * Refactor SecretServerClient to support additional headers Added support for passing additional headers to `getSecret` method in `SecretServerClient` and its implementations. Updated method signatures and internal logic to accommodate the new parameter, facilitating enhanced customization and control over secret retrieval. * Add issued time to JWT claims in test cases This ensures that the JWT claims set contains an issued time, which is necessary for some verifications. The additional issued time makes the test cases more comprehensive and accurate. --------- Co-authored-by: marcelmeyer <[email protected]>
- Loading branch information
1 parent
6da662a
commit 37c6aa5
Showing
14 changed files
with
104 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
sts-secret/src/main/java/de/adorsys/sts/secret/SecretServerClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
package de.adorsys.sts.secret; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public interface SecretServerClient { | ||
|
||
/** | ||
* Provides the decrypted BASE64 encoded secret for the user using the specified token. | ||
*/ | ||
String getSecret(String token); | ||
default String getSecret(String token) { | ||
return getSecret(token, new HashMap<>()); | ||
} | ||
|
||
/** | ||
* Provides the decrypted BASE64 encoded secret for the user using the specified token. | ||
*/ | ||
String getSecret(String token, Map<String, String> additionalHeaders); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.