Skip to content

Conversation

yuriyz
Copy link
Contributor

@yuriyz yuriyz commented Dec 17, 2024

Description

Update first party native authn implementation.
It must be updated in backwards compatibilty way because it is already in use.

https://datatracker.ietf.org/doc/draft-parecki-oauth-first-party-apps/02/

Target issue

closes #10380

Test and Document the changes

  • Static code analysis has been run locally and issues have been fixed
  • Relevant unit and integration tests have been added/updated
  • Relevant documentation has been updated if any (i.e. user guides, installation and configuration guides, technical design docs etc)

Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with docs: to indicate documentation changes or if the below checklist is not selected.

  • I confirm that there is no impact on the docs due to the code changes in this PR.

…n ( in backwards compatibility way) #10380

#10380
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
…ty Apps

#10380
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
@yuriyz yuriyz requested review from yurem and yuriyzz as code owners December 17, 2024 16:34
@yuriyz yuriyz marked this pull request as draft December 17, 2024 16:34
Copy link

dryrunsecurity bot commented Dec 17, 2024

DryRun Security Summary

The pull request enhances the Jans Auth Server's security by integrating DPoP (Demonstration of Proof of Possession), improving authorization challenge validation, refining token management, and implementing more robust error handling.

Expand for full summary

Summary:

The code changes in this pull request focus on improving the security and functionality of the Jans Auth Server's authorization challenge and token-related features. The key changes include:

  1. DPoP (Demonstration of Proof of Possession) Integration: The code has been updated to handle the DPoP header in the HTTP request, which helps mitigate the risks associated with token leakage and replay attacks.

  2. Authorization Challenge Validation: The code includes new validation methods to ensure the integrity of the authorization challenge process, such as validating the PKCE (Proof Key for Code Exchange) parameters and the authorization challenge session.

  3. Token Management: The changes enhance the handling of token-related operations, including improvements to grant type validation, refresh token validation, and audience validation. These changes help to maintain the security and integrity of the token-based authentication and authorization processes.

  4. Error Handling: The code includes better error handling and more informative error responses, which can help client applications troubleshoot and handle errors more effectively.

Overall, the changes in this pull request appear to be focused on improving the security and robustness of the Jans Auth Server's authorization and token-related functionality. The integration of DPoP, the enhanced validation of authorization challenges, and the improvements to token management are all positive steps towards enhancing the application's security posture.

Files Changed:

  1. docs/janssen-server/auth-server/oauth-features/README.md: The documentation has been updated to reference the latest "OAuth 2.0 for First-Party Applications" specification.
  2. docs/janssen-server/auth-server/endpoints/authorization-challenge.md: The documentation provides an overview of the Authorization Challenge Endpoint and the behavior of the custom script.
  3. docs/script-catalog/authorization_challenge/authorization-challenge.md: The documentation for the Authorization Challenge Custom Script has been updated.
  4. docs/script-catalog/authorization_challenge/AuthorizationChallenge.java: The code changes include the handling of the DPoP header and the management of the AuthorizationChallengeSession object.
  5. jans-auth-server/common/src/main/java/io/jans/as/common/model/session/AuthorizationChallengeSessionAttributes.java: A new field jkt (JWK SHA-256 Thumbprint) has been added to store the DPoP public key thumbprint.
  6. jans-auth-server/server/src/main/java/io/jans/as/server/auth/DpopService.java: The getDpopJwkThumbprint method has been made static.
  7. jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizationChallengeEndpoint.java: The code now includes a reference to the DpopService and handles the transition from the older "device_session" and "use_device_session" parameters.
  8. jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizationChallengeService.java: The code includes the validation of DPoP and JKT values.
  9. jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthzRequest.java: A new field dpop has been added to the AuthzRequest class.
  10. jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizationChallengeSessionService.java: The code handles the creation, retrieval, and management of authorization challenge sessions.
  11. jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizationChallengeValidator.java: The code includes new methods to validate the DPoP token and the grant type.
  12. jans-auth-server/server/src/main/java/io/jans/as/server/model/common/AbstractAuthorizationGrant.java: A new boolean field isAuthorizationChallenge has been added.
  13. jans-auth-server/server/src/main/java/io/jans/as/server/model/common/AuthorizationGrantList.java:

Code Analysis

We ran 9 analyzers against 18 files and 1 analyzer had findings. 8 analyzers had no findings.

Analyzer Findings
Authn/Authz Analyzer 5 findings

View PR in the DryRun Dashboard.

@mo-auto mo-auto added comp-jans-auth-server Component affected by issue or PR kind-feature Issue or PR is a new feature request labels Dec 17, 2024
…pps case

#10380
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
…arty Apps is invoked

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
…pps update

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
@yuriyz yuriyz marked this pull request as ready for review December 23, 2024 09:59
@yuriyz yuriyz enabled auto-merge (squash) December 23, 2024 09:59
Copy link

@yuriyz yuriyz merged commit bc431fb into main Dec 23, 2024
13 checks passed
@yuriyz yuriyz deleted the jans-auth-server-10380 branch December 23, 2024 10:09
Copy link

Copy link

Copy link

Copy link

ossdhaval pushed a commit that referenced this pull request Dec 27, 2024
…on ( in backwards compatibility way) #10380 (#10442)

* feat(jans-auth-server): update first party native authn implementation ( in backwards compatibility way) #10380

#10380
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

* feat(jans-auth-server): updated redirect uri validation for First-Party Apps

#10380
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

* feat(jans-auth-server): do not validate redirect_uri in First-Party Apps case

#10380
Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

* feat(jans-auth-server): set authorization_challenge flag when First-Party Apps is invoked

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

* feat(jans-auth-server): added dpop support for First-Party Apps

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

* missed file

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

* fixed bug with not passed authorization_challenge flag inside grant #10380

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

* missed file

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

* added dpop to sample Authorization Challenge custom script #10380

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

* doc(jans-auth-server): updated documentation for latest First-Party Apps update

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>

---------

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-jans-auth-server Component affected by issue or PR kind-feature Issue or PR is a new feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(jans-auth-server): update first party native authn implementation ( in backwards compatibilty way)
4 participants