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

Redirect login, logout, account linking requests from WIT to AUTH #1650

Merged
merged 9 commits into from
Sep 21, 2017

Conversation

alexeykazakov
Copy link
Contributor

  • Redirect requests from WIT to AUTH for login, logout, account linking
  • Delegate requests for token refresh from WIT to AUTH. (Delegate instead of redirect, because here a payload needs to be forwarded too, which is easier when delegated instead of redirected.)
  • Delegate user profile update from WIT to AUTH

Part of fabric8-services/fabric8-auth#79

@fabric8cd
Copy link

@alexeykazakov snapshot fabric8-wit image is available for testing. docker pull docker.io/fabric8/fabric8-wit:SNAPSHOT-PR-1650-2

@alexeykazakov
Copy link
Contributor Author

[test]

Copy link
Member

@sbose78 sbose78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine, a lot of code gone too - already feels light.
will test it locally now.


brokerEndpoint, err := c.configuration.GetKeycloakEndpointBroker(ctx.Request)
func RedirectLocation(params url.Values, location string) (string, error) {
Copy link
Member

@sbose78 sbose78 Sep 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is being used in the controller package only , we needn't have it as an exported method then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.
Done.

@@ -600,6 +625,104 @@ func (c *UsersController) Update(ctx *app.UpdateUsersContext) error {
return returnResponse
}

func (c *UsersController) createAuthUpdateClient(ctx *app.UpdateUsersContext) (*authservice.Client, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine for now, but we should consolidate the client initialization methods somewhere in future, for re-use.

return client, nil
}

func (c *UsersController) updateInAuth(ctx *app.UpdateUsersContext) (*app.User, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too should be consolidated and maintained as part of a separate interface spec , something like RemoteAuthService - but definitely fine for now.

@fabric8cd
Copy link

@alexeykazakov snapshot fabric8-wit image is available for testing. docker pull docker.io/fabric8/fabric8-wit:SNAPSHOT-PR-1650-3

@fabric8cd
Copy link

@alexeykazakov snapshot fabric8-wit image is available for testing. docker pull docker.io/fabric8/fabric8-wit:SNAPSHOT-PR-1650-4

@sbose78
Copy link
Member

sbose78 commented Sep 21, 2017

Tested out , looks fine -

  1. Setup AUTH locally in dev mode.
  2. Setup WIT locally in dev mode with export F8_AUTH_URL=http://localhost:8089
  3. Setup fabric8-UI ( master ) locally with
export FABRIC8_WIT_API_URL="http://localhost:8080/api/"
export FABRIC8_REALM="fabric8-test"
  1. Tested out login, logout, refresh workflows from the UI - Looked fine in general!

Found a couple of issues one during login where I was getting a Found Keycloak identity is not linked to any User , and another issue with profile page not loading ( for a new user ) which was because of the filter api call failing.

Both the fixes are part of fabric8-services/fabric8-auth#112

@sbose78
Copy link
Member

sbose78 commented Sep 21, 2017

[test]

@alexeykazakov
Copy link
Contributor Author

[test]

@alexeykazakov alexeykazakov merged commit 61aadce into fabric8-services:master Sep 21, 2017
@alexeykazakov alexeykazakov deleted the phase2 branch September 21, 2017 15:44
@codecov-io
Copy link

codecov-io commented Sep 21, 2017

Codecov Report

Merging #1650 into master will increase coverage by 0.15%.
The diff coverage is 23.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1650      +/-   ##
==========================================
+ Coverage   54.21%   54.36%   +0.15%     
==========================================
  Files         130      129       -1     
  Lines       16720    16304     -416     
==========================================
- Hits         9065     8864     -201     
+ Misses       6953     6753     -200     
+ Partials      702      687      -15
Impacted Files Coverage Δ
login/service.go 8.52% <ø> (-29.08%) ⬇️
goasupport/forward_signer.go 100% <ø> (+100%) ⬆️
design/auth.go 0% <ø> (ø) ⬆️
auth/resource.go 0% <0%> (ø) ⬆️
main.go 0% <0%> (ø) ⬆️
controller/logout.go 10.34% <28.57%> (-20.91%) ⬇️
controller/users.go 67.52% <31.81%> (-4.49%) ⬇️
configuration/configuration.go 74.03% <33.33%> (-1.97%) ⬇️
controller/login.go 2.52% <8.06%> (+2.52%) ⬆️
log/context.go 75% <0%> (-18.75%) ⬇️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05bf070...baa7556. Read the comment docs.

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

Successfully merging this pull request may close these issues.

None yet

4 participants