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

Unable to use Auth Providers when running locally #9138

Closed
richard-cox opened this issue Jun 16, 2023 · 8 comments · Fixed by #9262
Closed

Unable to use Auth Providers when running locally #9138

richard-cox opened this issue Jun 16, 2023 · 8 comments · Fixed by #9262
Assignees
Labels
Milestone

Comments

@richard-cox
Copy link
Member

Setup

  • Rancher version: v2.7.5 dev
  • Rancher UI Extensions:
  • Browser type & version:

Describe the bug
It looks like configuring an Auth Provider, like Github, does not work when serving the dashboard locally (due to the server middleware which redirects /verify-auth to /auth/verify not being wired in). I had to add the following to routes in shell/config/router.js

{
    path:     '/verify-auth',
    redirect: (to) => {
      return 'auth/verify';
    },
  }

To Reproduce

  • setup github auth provider

Result
redirect after accepting in github redirects to a 404 page

Expected Result
redirect succesfuly closes window and auth provider detail page shown

@richard-cox
Copy link
Member Author

We should get this working, bugs are creeping in because people are developing / testing AP group use cases (basically anything to do with permissions, roles, etc)

@cnotv
Copy link
Contributor

cnotv commented Jun 27, 2023

How can you get redirected locally from GH? You need to specify an IP address to be redirected, so or you set local IP or the hosted one.

@richard-cox
Copy link
Member Author

The redirect is done locally, so localhost previously worked fine.

For whoever picks this up, the routing above was previously done only in dev world when serving locally. We'd need to do similar here. In production the redirect is handled via Rancher.

@gaktive
Copy link
Member

gaktive commented Jun 28, 2023

A unit test would help here but this bug isn't production facing.

@gaktive
Copy link
Member

gaktive commented Jun 28, 2023

This routing logic may have been tied to Nuxt before it was removed. Maybe we can do something in the Vue config.

@gaktive gaktive added size/1 Size Estimate 1 [zube]: Groomed and removed [zube]: Backlog labels Jun 28, 2023
@richard-cox
Copy link
Member Author

richard-cox commented Jun 28, 2023

We should ensure that this redirect is not added in production. There should be a process.env.isDev that can be used if we're not in production.

There might be an issue with our middleware

res.writeHead(301, { Location: req.url.replace(/verify-auth(-azure)?/, 'auth/verify') });
which is initialised via serverMiddleware.push(path.resolve(dir, SHELL, 'server', 'server-middleware'));

however.... in 2.7.5 that serverMiddleware isn't actually used anywhere.

We should investigate that side first (bringing up serverMiddleware in post/manual nuxt world). @codyrancher can provide some assistance

@sowmyav27
Copy link

QA will validate if this continues to work on Rancher prod environment

@ronhorton
Copy link

Pass
verified github workflow and authentication with rancher v2.7-head 027246f

  1. clicked hamburger > users & authentication > auth providers
  2. selected github oAuth tile
  3. completed required fields in github and rancher
  4. enabled github auth
  5. logged out
  6. logging in with github

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

Successfully merging a pull request may close this issue.

8 participants