Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Create tests to cover full auth flow #1277

Closed
alexeykazakov opened this issue Apr 29, 2017 · 3 comments
Closed

Create tests to cover full auth flow #1277

alexeykazakov opened this issue Apr 29, 2017 · 3 comments

Comments

@alexeykazakov
Copy link
Contributor

Currently our tests cover only the first part of the flow when we call /api/login/authorize to create a state and redirect to KC. We need to cover the second part when after successful authentication KC redirects back to /api/login/authorize and passing the state from the first call.

@sbose78
Copy link
Member

sbose78 commented Jun 1, 2017

Hi

We need to cover the second part when after successful authentication KC redirects back to /api/login/authorize and passing the state from the first call.

/api/authorize/login is called using state and code .
We can't really have a positive test for code because it is generated after a successful user interaction.

We already have

  • test for incorrect state.
  • test for correct state & incorrect code.

So no matter what, config.Exchange(ctx, code) would always return an error.

I don't see what tests more we can add for this second step, do you have something different in mind, @alexeykazakov ?

@alexeykazakov
Copy link
Contributor Author

alexeykazakov commented Jun 1, 2017

This is a standard (statefull) oauth workflow. What we could do here is to simulate our Keycloak and browser:

  1. Call Perform() As a response we will get a redirect URL with the state.
  2. Extract this state and call Perform() again passing all needed params simulating a callback/redirect from Keycloak/browser.

@alexeykazakov
Copy link
Contributor Author

Moved to fabric8-services/fabric8-auth#34
Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants