Skip to content
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

New saml 0530 decrypt #3118

Closed
wants to merge 179 commits into from
Closed

New saml 0530 decrypt #3118

wants to merge 179 commits into from

Conversation

strehle
Copy link
Member

@strehle strehle commented Nov 11, 2024

No description provided.

swalchemist and others added 30 commits July 12, 2024 10:44
Co-authored-by: Peter Chen <[email protected]>
Co-authored-by: Bruce Ricard <[email protected]>
Co-authored-by: Danny Faught <[email protected]>
* Instead of calling fail(). We have a suspicion that there is a bug in
  the way the tests are running (most of them are somehow not running
  with "./gradlew test" and we have a theory that a combination of mixing
  junit4 imports and the junit5 fail() might be contributing.
* I was careful to use @ignore for tests importing the junit4 @test, and
  @disabled for tests using the junit5 @test.
* These annotations were added, with the idea that you can search for
  '@ignore("SAML' and '@disabled("SAML' to find the tests that need
  attention before we finish the SAML library conversion.
@ignore("SAML test fails")
@ignore("SAML test doesn't compile")
@ignore("SAML test setup doesn't compile")
@disabled("SAML test fails")
@disabled("SAML test doesn't compile")
* A few tests are set to ignore because they're failing for the right
  reasons, but more work is needed to finish that and get back to green.
  The goal is to start tracking these annotations instead of failing
  tests, so we can stay green.
* Tests now running:
    server module: 3,435 (in IntelliJ) (98 total ignored)
    uaa module: 67 (command line run of "./gradlew test" for all tests
    - still needs troubleshooting)

Co-authored-by: Danny Faught <[email protected]>
* Removed commented-out references to the outdated SAML extension library

Co-authored-by: Duane May <[email protected]>
- Adds back endpoint and incorporates forwarding for new pattern saml2 endpoints, Still has some wip elements WithHttpsNotRequired > samlMetadataReturnsOk still red RelyingPartyRegistration is hardcoded in xml, /saml/metadata/ with trailing slash not working missing parity with develop

[#186986697]

Co-authored-by: Peter Chen <[email protected]>
…NotRequired -> samlMetadataReturnsOk is green

- fixed one test but still WithHttpsRequired > samlMetadataReturnsOk is red after fixing this test -
HealthzShouldNotBeProtectedMockMvcTests > WithHttpsRequired > samlMetadataRedirects() FAILED
    java.lang.AssertionError: Range for response status value 200 expected:<REDIRECTION> but was:<SUCCESSFUL>

[#186986697]

Co-authored-by: Duane May <[email protected]>
Co-authored-by: Peter Chen <[email protected]>
Co-authored-by: Bruce Ricard <[email protected]>
Co-authored-by: Danny Faught <[email protected]>
* Instead of calling fail(). We have a suspicion that there is a bug in
  the way the tests are running (most of them are somehow not running
  with "./gradlew test" and we have a theory that a combination of mixing
  junit4 imports and the junit5 fail() might be contributing.
* I was careful to use @ignore for tests importing the junit4 @test, and
  @disabled for tests using the junit5 @test.
* These annotations were added, with the idea that you can search for
  '@ignore("SAML' and '@disabled("SAML' to find the tests that need
  attention before we finish the SAML library conversion.
@ignore("SAML test fails")
@ignore("SAML test doesn't compile")
@ignore("SAML test setup doesn't compile")
@disabled("SAML test fails")
@disabled("SAML test doesn't compile")
* A few tests are set to ignore because they're failing for the right
  reasons, but more work is needed to finish that and get back to green.
  The goal is to start tracking these annotations instead of failing
  tests, so we can stay green.
* Tests now running:
    server module: 3,435 (in IntelliJ) (98 total ignored)
    uaa module: 67 (command line run of "./gradlew test" for all tests
    - still needs troubleshooting)

Co-authored-by: Danny Faught <[email protected]>
- Adds back endpoint and incorporates forwarding for new pattern saml2 endpoints, Still has some wip elements WithHttpsNotRequired > samlMetadataReturnsOk still red RelyingPartyRegistration is hardcoded in xml, /saml/metadata/ with trailing slash not working missing parity with develop

[#186986697]

Co-authored-by: Peter Chen <[email protected]>
…NotRequired -> samlMetadataReturnsOk is green

- fixed one test but still WithHttpsRequired > samlMetadataReturnsOk is red after fixing this test -
HealthzShouldNotBeProtectedMockMvcTests > WithHttpsRequired > samlMetadataRedirects() FAILED
    java.lang.AssertionError: Range for response status value 200 expected:<REDIRECTION> but was:<SUCCESSFUL>

[#186986697]

Co-authored-by: Peter Chen <[email protected]>
- With the new SAML lib, SAML SP metadata generation relies on a relyingPartyRegistration,
which requires a valid SAML IDP
metadata. In the context of UAA external SAML IDP login, UAA does not know what the SAML IDP
metadata is, until the operator adds it via the /identity-providers endpoint. Also, some SAML
IDPs might require you to supply the SAML SP metadata first before you can obtain the
SAML IDP metadata. See relevant issue: spring-projects/spring-security#11369
- Previously, to solve this problem, the SAML SP metadata generation relies
on relyingPartyRegistration values in saml-providers.xml, which
hardcodes a SAML IDP metadata URL (point to some example Okta SAML instance);
this means that UAA's SP metadata generation relies on the
example Okta SAML instance to be running.
- This commit, instead, supplies a hardcoded dummy SAML IDP metadata here to unblock the SAML
SP metadata generation, at the advice of Spring Security team, so that UAA's functioning
does not rely on some external running Okta instance.
- code reference: https://github.com/spring-projects/spring-security-samples/blob/1b28351693d60f01a511cbcc18b64590452a3851/servlet/java-configuration/saml2/login/src/main/java/example/SecurityConfiguration.java#L62

[#186986697]

Co-authored-by: Peter Chen <[email protected]>
- A continuation of 65d1f0f
- This test is failing as early as
  e7beec7 due to the removal of SAML
  code, as this test is related the SAML feature

[#186986697]

Co-authored-by: Peter Chen <[email protected]>
* Has to be commented out of the erb file even when the test method used @disabled.

Co-authored-by: Peter Chen <[email protected]>
- A continuation of 65d1f0f
- This is a test recently added to develop branch, so
ignoring this here because the SAML feature is still being
built.

[#186986697]

Co-authored-by: Peter Chen <[email protected]>
- to reflect the fact that this IDP metadata just needs
to exist in its bare minimal form, where the specific fields
in it do not affect the SP metadata generation

[#186986697]

Co-authored-by: Peter Chen <[email protected]>
- previously some tests error with:
```
net.shibboleth.utilities.java.support.xml.XMLParserException: Unable to parse inputstream, it contained invalid XML
```
- this issue is fixed once we switch to loading
the idp saml metadata via a file (instead of an InputStream)

[186822654]

Co-authored-by: Danny Faught <[email protected]>
* We're reprioritizing the test to get this test to pass.

Co-authored-by: Bruce Ricard <[email protected]>
Co-authored-by: Duane May <[email protected]>
Co-authored-by: Duane May <[email protected]>
…ect request

- Tests are failing but they are behaving as expected with curl and browser for /saml/metadata /saml/metadata/example and /saml/metadata/example/

- /saml/metadata/ is not returning xml

- The dispatcher ordering along with position in the filter-mapping must be set properly.

[#186986697]

Co-authored-by: Bruce Ricard <[email protected]>
…VC Tests

- /saml/metadata/ is not returning xml

[#186986697]

Co-authored-by: Filip Hanik <[email protected]>
Co-authored-by: Alicia Yingling <[email protected]>
Co-authored-by: Duane May <[email protected]>
* Must be changed back to /saml/metadata later, removing "example".

Co-authored-by: Alicia Yingling <[email protected]>
Co-authored-by: Duane May <[email protected]>
Co-authored-by: Alicia Yingling <[email protected]>
Co-authored-by: Duane May <[email protected]>
…ault

- Updated to use direct GetMapping

[#186986697]

Co-authored-by: Filip Hanik <[email protected]>
…pulated in SPSSODescriptor

- Building out EntityDescriptor in the RelyingPartyRegistration which contains the SPSSODescriptor picked up by the resolve method

[#186986697]

Co-authored-by: Duane May <[email protected]>
- Need to fix credential type being empty

Caused by: java.lang.IllegalArgumentException: credentials types cannot be empty
....(SamlRelyingPartyRegistrationRepository.java:84)
[#186986697]

Co-authored-by: Duane May <[email protected]>
achrinza and others added 28 commits November 4, 2024 17:05
Updates the `JAVA_HOME` env var for the `build-uaa-truststore` init contianer to match the updated path used by the Paketo buildpack.

fixes: #2388
Signed-off-by: Rifa Achrinza <[email protected]>
Bumps [rexml](https://github.com/ruby/rexml) from 3.3.8 to 3.3.9.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](ruby/rexml@v3.3.8...v3.3.9)

---
updated-dependencies:
- dependency-name: rexml
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps `versions.jacksonVersion` from 2.18.0 to 2.18.1.

Updates `com.fasterxml.jackson.core:jackson-annotations` from 2.18.0 to 2.18.1
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `com.fasterxml.jackson.core:jackson-databind` from 2.18.0 to 2.18.1
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-yaml` from 2.18.0 to 2.18.1
- [Commits](FasterXML/jackson-dataformats-text@jackson-dataformats-text-2.18.0...jackson-dataformats-text-2.18.1)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-annotations
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps `versions.seleniumVersion` from 4.25.0 to 4.26.0.

Updates `org.seleniumhq.selenium:selenium-java` from 4.25.0 to 4.26.0
- [Release notes](https://github.com/SeleniumHQ/selenium/releases)
- [Commits](SeleniumHQ/selenium@selenium-4.25.0...selenium-4.26.0)

Updates `org.seleniumhq.selenium:selenium-remote-driver` from 4.25.0 to 4.26.0
- [Release notes](https://github.com/SeleniumHQ/selenium/releases)
- [Commits](SeleniumHQ/selenium@selenium-4.25.0...selenium-4.26.0)

---
updated-dependencies:
- dependency-name: org.seleniumhq.selenium:selenium-java
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.seleniumhq.selenium:selenium-remote-driver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.34.2 to 1.35.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](onsi/gomega@v1.34.2...v1.35.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
#3105)

Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.35.0 to 1.35.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](onsi/gomega@v1.35.0...v1.35.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Conflicts:
#	samples/api/src/test/java/org/cloudfoundry/identity/api/web/ApiControllerTests.java
#	server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/FilesystemMetadataProvider.java
#	server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/LoginSamlAuthenticationToken.java
#	server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/LoginSamlDiscovery.java
#	server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/LoginSamlEntryPoint.java
#	server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/SPWebSSOProfileImpl.java
#	server/src/test/java/org/cloudfoundry/identity/uaa/login/AddBcProvider.java
#	server/src/test/java/org/cloudfoundry/identity/uaa/login/SamlLoginServerKeyManagerTests.java
Signed-off-by: Duane May <[email protected]>
* renovate: : update dependency webrick to v1.9.0

* Refactor and fix duplicate

found by sonar in https://sonarcloud.io/component_measures?metric=new_duplicated_lines_density&selected=cloudfoundry-identity-parent%3Aserver%2Fsrc%2Fmain%2Fjava%2Forg%2Fcloudfoundry%2Fidentity%2Fuaa%2Fauthentication%2FPasscodeAuthenticationFilter.java&view=list&pullRequest=2908&id=cloudfoundry-identity-parent

* Only show failed tests

make it easier to find the failed tests in output

Signed-off-by: Duane May <[email protected]>

* reduce duplicates

* rebase

* reduce duplicates

* Refactor and fix duplicate (#3112)

found by sonar in https://sonarcloud.io/component_measures?metric=new_duplicated_lines_density&selected=cloudfoundry-identity-parent%3Aserver%2Fsrc%2Fmain%2Fjava%2Forg%2Fcloudfoundry%2Fidentity%2Fuaa%2Fauthentication%2FPasscodeAuthenticationFilter.java&view=list&pullRequest=2908&id=cloudfoundry-identity-parent

* cleanup

* refactor saml bearer usage

* Migrate to Caffeine Caching (#3114)

* Migrate to Caffeine Caching

Guava Cache recommends moving to Caffeine
Mostly a drop-in replacement
Although the refreshAfterWrite works a little different

* more test coverage

* again more test coverage

* sonar

* sonar

---------

Co-authored-by: strehle <[email protected]>

* fix rebase

* fix rebase

---------

Signed-off-by: Duane May <[email protected]>
Co-authored-by: Duane May <[email protected]>
Co-authored-by: Duane May <[email protected]>
# Conflicts:
#	server/src/main/java/org/cloudfoundry/identity/uaa/authentication/PasscodeAuthenticationFilter.java
#	server/src/main/java/org/cloudfoundry/identity/uaa/cache/StaleUrlCache.java
#	server/src/test/java/org/cloudfoundry/identity/uaa/cache/StaleUrlCacheTests.java
in case of decryption issue (wrong key) do not show
class internals
@strehle strehle closed this Nov 11, 2024
@strehle strehle deleted the new-saml-0530-decrypt branch November 11, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

9 participants