spring-projects / spring-projects/spring-security

proxy with spring security oauth2

Open
#16,875 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: oauth2 type: bug
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

I am not really developer, so someone needs to check this but I have the impression these are buggy. Important with testing is thus that you block every other outgoing traffic except to the proxy. Otherwise you do not notice that some request are going past the proxy.

  1. when running in a proxy environment only, the issuer-uri is being gotten without proxy, resulting in a startup failure

java -Dhttps.proxyHost= -Dhttps.proxyPort= etc

  1. when commenting out the issuer-uri, something changes in the auth process and even though all custom endpoints are taken directly from the issuer-uri. Some issue arises during Spring Security's processing of the token, likely in .oauth2Login, when it tries to validate the token's claims or associate it with the client registration.
     27     oauth2:
     28       resourceserver:
     29         jwt:
     30           issuer-uri: ${JWT_URI}
     31           jwt-custom-uri: ${JWT_URI}
     32           jwk-set-uri: ${OIDC_JWKCRTURI}
     33           connect-timeout: 5000
     34           read-timeout: 5000
     35       client:
     36         registration:
     37           keycloak:
     38             client-id: ${OIDC_CLIENTID}
     39             client-secret: ${OIDC_CLIENTSECRET}
     40             authorization-grant-type: authorization_code
     41             scope: ${OIDC_SCOPE:openid}
     42             provider: keycloak
     43             redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}"
     44         provider:
     45           keycloak:
     46             #issuer-uri: ${OIDC_ISSUERURI} #breaks startup
     47             authorization-uri: ${OIDC_AUTHURI}
     48             token-uri: ${OIDC_TOKENURI}
     49             user-info-uri: ${OIDC_USERURI}
     50             jwk-set-uri: ${OIDC_JWKCRTURI}
  1. I think it is also weird that an application fails on startup when some external service is not available. The default should be just starting no need to check and download stuff.

https://stackoverflow.com/questions/79551156/spring-boot-starter-oauth2-client-app-never-starts-when-oauth-host-unreachable

https://github.com/spring-projects/spring-boot/issues/44985#event-17107137936

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the proxy-only startup scenario using the issuer-uri configuration, then compare it with the configuration using custom authorization, token, user-info, and JWK-set URIs. Inspect the oauth2Login processing and resource-server JWT startup paths, and verify that all external requests use the proxy and that startup behavior matches the intended requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authentication, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.