uaa icon indicating copy to clipboard operation
uaa copied to clipboard

Move OAuth2 Core Server Classes to UAA namespace

Open strehle opened this issue 1 year ago • 1 comments

  • Moved Endpoints for OAuth2 from library to UAA. Main OIDC endpoints are in UAA implemented, so changes needed.

  • Core-Beans for Server start. Entry point OAuth2SecurityNamespaceHandler.java, which supports XML key words in spring-servlet.xml. (moved to server)

  • Moved spring schema handlers to server - support usage of spring-servlet.xml

    • server/src/main/resources/META-INF/spring.handlers
    • server/src/main/resources/META-INF/spring.schemas
  • Client Token Creation, Main class OAuth2RestTemplate (moved to model)

  • Not Moved / OPEN. Client Annotation. UAA does not need it

Statistics

  • Sonar : https://sonarcloud.io/summary/new_code?id=cloudfoundry-identity-parent&pullRequest=2813
  • CodeQL green now. Issue in Annotation , thus removed support for it
  • Tests not forked yet. PR without tests has 522 changes. 170 NEW Files (moved from spring-security-oauth2 to uaa)

strehle avatar Apr 03 '24 16:04 strehle

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/187364134

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar Apr 03 '24 16:04 cf-gitbot

@strehle I see the sonar link showing: Failed Last analysis 23 hours ago 13.85%. Coverage: Required ≥ 80.0% Is this still in progress?

Tallicia avatar May 02 '24 14:05 Tallicia

Is this still in progress?

No it is ready. The issues are solved, the coverage needs tests but I have putted the forked tests into another PR, see https://github.com/cloudfoundry/uaa/pull/2843#issuecomment-2090164533

-> PR 2848 is this PR plus tests -> https://sonarcloud.io/summary/new_code?id=cloudfoundry-identity-parent&pullRequest=2848

Why: because then this PR would have even more changes

strehle avatar May 02 '24 15:05 strehle

All existing tests are passing. ✅ want to run against new tests at strehle:eol/oauth2/core-server-plus-tests next

Tallicia avatar May 02 '24 17:05 Tallicia

Tests from strehle:eol/oauth2/core-server-plus-tests passing. ✅ https://github.com/cloudfoundry/uaa/pull/2843 Screenshot 2024-05-02 at 12 54 34 PM

Tallicia avatar May 02 '24 17:05 Tallicia

Making progress, about 1/3rd of the way through so far.

Tallicia avatar May 02 '24 19:05 Tallicia

Approximately 2/3rd the way through (315 of 488 files).

So far everything is looking good with some comments and questions in the review.

I am out of time today, but expect I will have this completed tomorrow and ready for approval and merging. It looks like this and the PR with tests need to go together. Screenshot 2024-05-02 at 4 53 09 PM

Tallicia avatar May 02 '24 21:05 Tallicia

@Tallicia I hope I have done all comments... / questions. If you have open questions , things I do not have answered, please let me know

strehle avatar May 07 '24 16:05 strehle

Statistics:

Moved ca. 170 classes from https://github.com/spring-attic/spring-security-oauth/tree/main/spring-security-oauth2 to UAA into model and server sub projects.

Moved ca. 70 tests from https://github.com/spring-attic/spring-security-oauth/tree/main/spring-security-oauth2 into UAA

Did code cleanup based on CodeQL and Sonar findings.

Refactored existing UAA forks , e.g. Token Endpoints

uaa.war now includes 134 external libraries (before 136) uaa.war now has 61 MB (before 64 MB)

Summary. UAA now has all code to run as OAuth2/OIDC Server in this project, so that further refactoring can be done, e.g.

  • refactor loading and caching of oauth_client_details (should be loaded per thread only once, similar to IdentityZone)
  • refactor token granter - UAA loads base grant types internally and then extend this via https://github.com/cloudfoundry/uaa/blob/develop/uaa/src/main/webapp/WEB-INF/spring/oauth-endpoints.xml#L40-L56. Support more / further grant types in future, e.g. token-exchange grant type https://datatracker.ietf.org/doc/html/rfc8693

strehle avatar May 08 '24 08:05 strehle