Skip to content

Commit

Permalink
refactor(OAuth2): groovy to java conversion for OAuth module (spinnak…
Browse files Browse the repository at this point in the history
…er#1871)

* refactor(OAuth2): groovy to java conversion for OAuth module

Validated and tested using google and github OAuth.

* Add specific imports and remove *

* Remove DefaultGroovyMethods

* Add StructuredArguments.entries

* Rename safeGet to toStringOrNull. toStringOrNull returns null when the input is null. Add javadoc

* Replace details.getOrDefault with Optional to handle null cases

* Add log statement from groovy code

* Use AssertJ

* First checks log.isDebugEnabled() to avoid unnecessary String concatenation

* Add non empty string check

* Add test for SpinnakerUserInfoTokenServices#isServiceAccount

* Refactor SpinnakerUserInfoTokenServices to use constructor injection

- Replaced member injection with constructor injection
- Improved encapsulation by removing direct member access
- Updated tests to pass dependencies via constructor

* Preserve method call verifications in tests

* Refactor to use constructor injection

- Removed  annotations from individual members
- Added  to the all-args constructor
- Removed no-arg constructor to enforce dependency injection
- Improved clarity and testability of the class

* Add specific imports and remove *

* Move SpinnakerProviderTokenServices to constructor argument and make it optional using Optional<SpinnakerProviderTokenServices>
  • Loading branch information
rahul-chekuri authored Feb 27, 2025
1 parent b0ee1b1 commit 381f554
Show file tree
Hide file tree
Showing 16 changed files with 1,022 additions and 793 deletions.
1 change: 1 addition & 0 deletions gate-oauth2/gate-oauth2.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dependencies {
implementation project(":gate-core")
implementation "com.netflix.spectator:spectator-api"
implementation "io.spinnaker.fiat:fiat-api:$fiatVersion"
implementation "io.spinnaker.fiat:fiat-core:$fiatVersion"
implementation "io.spinnaker.kork:kork-exceptions"
implementation "io.spinnaker.kork:kork-retrofit"
implementation "io.spinnaker.kork:kork-security"
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 381f554

Please sign in to comment.