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

SSO Auth Doesn't Work for Endpoints #4716

Closed
2 of 9 tasks
thomasmitchell opened this issue Oct 23, 2020 · 8 comments
Closed
2 of 9 tasks

SSO Auth Doesn't Work for Endpoints #4716

thomasmitchell opened this issue Oct 23, 2020 · 8 comments
Assignees
Labels
bug community Community Raised Issue
Milestone

Comments

@thomasmitchell
Copy link

Stratos Version

4.2.0

Frontend Deployment type

  • Cloud Foundry Application (cf push)
  • Kubernetes, using a helm chart
  • Docker, single container deploying all components
  • npm run start
  • Other (please specify below)

Backend (Jet Stream) Deployment type

  • Cloud Foundry Application (cf push)
  • Kubernetes, using a helm chart
  • Docker, single container deploying all components
  • Other (please specify below)

Expected behaviour

Performing SSO auth to a CF endpoint should redirect to the SSO token page.

Actual behaviour

The frontend returns a 405 Method Not Allowed.

Steps to reproduce the behavior

  1. Configure an SSO login with Stratos for a Cloud Foundry endpoint.
  2. Attempt to connect to the endpoint using SSO

Log output covering before error and any error statements

Insert log hereCopy

Additional notes

Jetstream listens for SSO auth as of the latest version at GET /pp/v1/auth/tokens, but the frontend attempts to reach it on GET /api/v1/tokens. This gets picked up by the non-SSO auth handler, which only responds to POST methods, hence the 405 error code response from the routing library. Unsure if by design that the backend or frontend path is correct, so I've held off on a PR, but the fix depends on the two agreeing on the path.

@richard-cox
Copy link
Contributor

Hi @thomasmitchell , was just trying to give this a test but hit some environment issues. Could I confirm you're seeing this after checking out the 4.2.0 or stable?

@thomasmitchell
Copy link
Author

yes, 4.2.0.

It looks like it happened in #4555

In the interim, we've manually patched our compilation of the frontend for this line:

const ssoUrl = '/api/v1/tokens?guid=' + action.guid + '&state=' + encodeURIComponent(loc);

to reference /pp/v1/auth/tokens instead, and we're able to auth with SSO again.

@richard-cox
Copy link
Contributor

richard-cox commented Oct 23, 2020

Odd, the token endpoint in 4.2.0 should come from /api. Is it possible your frontend is pointing to an older backend, I think we can do this with the CF_API_URL env var?

@thomasmitchell
Copy link
Author

sessionAuthGroup.GET("/tokens", p.ssoLoginToCNSI)

Notably, the SSO endpoint is nested into the sessionAuthGroup (/pp/v1/auth/), not the stableAPIGroup (/api/v1/)

@richard-cox
Copy link
Contributor

Please accept my apologies, serious case of read the issue. I was confusing the POST with GET, and you clearly stated GET at start. Understand the issue now, we'll look at fixing this in a patch release

@thomasmitchell
Copy link
Author

thank you very much :)

@richard-cox richard-cox self-assigned this Oct 26, 2020
@richard-cox richard-cox added bug community Community Raised Issue labels Oct 26, 2020
@richard-cox richard-cox added this to the 4.2.1 milestone Oct 26, 2020
richard-cox added a commit that referenced this issue Oct 26, 2020
- this means it's available via the api (the redirect is correctly returned but will not show in browser)
- fixes #4716
- test both endpoint and stratos SSO log in
richard-cox added a commit that referenced this issue Oct 26, 2020
* Move GET `/tokens` into `api` group
- this means it's available via the api (the redirect is correctly returned but will not show in browser)
- fixes #4716
- test both endpoint and stratos SSO log in

* Ensure travis runs on the new branch (will be removed after release)
@richard-cox
Copy link
Contributor

Fixed via #4719. This will be in the 4.2.1 release which should be out this week.

richard-cox added a commit to SUSE/stratos that referenced this issue Oct 27, 2020
* Move GET `/tokens` into `api` group (cloudfoundry#4719)

* Move GET `/tokens` into `api` group
- this means it's available via the api (the redirect is correctly returned but will not show in browser)
- fixes cloudfoundry#4716
- test both endpoint and stratos SSO log in

* Ensure travis runs on the new branch (will be removed after release)

* Update version, change log and package lock for 4.2.1 (cloudfoundry#4720)

* Fixes following merge
@richard-cox
Copy link
Contributor

4.2.1 has now been released

richard-cox added a commit that referenced this issue Nov 3, 2020
* Move GET `/tokens` into `api` group (#4719)

* Move GET `/tokens` into `api` group
- this means it's available via the api (the redirect is correctly returned but will not show in browser)
- fixes #4716
- test both endpoint and stratos SSO log in

* Ensure travis runs on the new branch (will be removed after release)

* Update version, change log and package lock for 4.2.1 (#4720)

* Update .travis.yml
richard-cox added a commit to SUSE/stratos that referenced this issue Nov 9, 2020
* Merge upstream (#533)

* Move GET `/tokens` into `api` group (cloudfoundry#4719)

* Move GET `/tokens` into `api` group
- this means it's available via the api (the redirect is correctly returned but will not show in browser)
- fixes cloudfoundry#4716
- test both endpoint and stratos SSO log in

* Ensure travis runs on the new branch (will be removed after release)

* Update version, change log and package lock for 4.2.1 (cloudfoundry#4720)

* Fixes following merge

* Update .travis.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug community Community Raised Issue
Projects
None yet
Development

No branches or pull requests

2 participants