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

feat(frontend): authorization frontend #404

Merged
merged 28 commits into from
Apr 4, 2024
Merged

Conversation

Mogge
Copy link
Contributor

@Mogge Mogge commented Mar 27, 2024

🍰 Pullrequest

Based on #403

Issues

Todo

  • None

@Mogge Mogge self-assigned this Mar 27, 2024
@Mogge Mogge mentioned this pull request Mar 28, 2024
1 task
Copy link
Member

@Elweyn Elweyn left a comment

Choose a reason for hiding this comment

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

Seems good but could not test it...

frontend/src/locales/de.json Show resolved Hide resolved
frontend/src/locales/de.json Outdated Show resolved Hide resolved
presenter/src/components/menu/HeaderMenu.vue Show resolved Hide resolved
presenter/src/components/menu/HeaderMenu.vue Show resolved Hide resolved
Elweyn
Elweyn previously approved these changes Mar 28, 2024
Copy link
Member

@Elweyn Elweyn left a comment

Choose a reason for hiding this comment

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

I can't let it run with docker but if I change presenter/server/index.ts to default port 3001 then I test it with:

  • cd authentik && docker compose up
  • cd frontend && npm run dev || prod
  • cd presenter && npm run dev || prod

The logic works fine

Copy link
Member

@ulfgebhardt ulfgebhardt left a comment

Choose a reason for hiding this comment

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

image

The guard throws serious errors - I am fine with merging this and resolve it after - but there is a problem.

Copy link
Member

@ulfgebhardt ulfgebhardt left a comment

Choose a reason for hiding this comment

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

The page /signin contains the signout button. This button must be reactive to the logged in state and not visible when not logged in (can be postponed)

image

Copy link
Member

@ulfgebhardt ulfgebhardt left a comment

Choose a reason for hiding this comment

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

image

I think we should require correct values for this - maybe we want so set a default here, since the frontend only makes sense to operate when authentication is possible.
Furthermore the default values for

 AUTHORITY: (import.meta.env.PUBLIC_ENV__AUTH__AUTHORITY ?? '') as string,
  AUTHORITY_SIGNUP_URI: (import.meta.env.PUBLIC_ENV__AUTH__AUTHORITY_SIGNUP_URI ?? '') as string,

make no sense anymore, since the presenter hides its buttons, not the frontend

Furthermore AUTHORITY_SIGNUP_URI is not needed in the frontend.

@ulfgebhardt
Copy link
Member

image

I think we should require correct values for this - maybe we want so set a default here, since the frontend only makes sense to operate when authentication is possible. Furthermore the default values for

 AUTHORITY: (import.meta.env.PUBLIC_ENV__AUTH__AUTHORITY ?? '') as string,
  AUTHORITY_SIGNUP_URI: (import.meta.env.PUBLIC_ENV__AUTH__AUTHORITY_SIGNUP_URI ?? '') as string,

make no sense anymore, since the presenter hides its buttons, not the frontend

Furthermore AUTHORITY_SIGNUP_URI is not needed in the frontend.

Fixed - I kept the AUTHORITY_SIGNUP_URI since that would cripple the authService if not present.

@ulfgebhardt
Copy link
Member

The page /signin contains the signout button. This button must be reactive to the logged in state and not visible when not logged in (can be postponed)

image

Fixed aswell

image
image

Copy link
Member

@ulfgebhardt ulfgebhardt left a comment

Choose a reason for hiding this comment

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

Still doesn't work in production.

While I can see it working in dev, I don't get it to work on production.

Running on dev I can see the redirect happening on console and browser.

npm install
npm run dev

image
image
image

In production nothing happens neither on console nor in the the browser

npm install
npm build
npm run server:prod

image

@Mogge
Copy link
Contributor Author

Mogge commented Apr 3, 2024

Looks like a build problem to me. The guard does not trigger at all all when building for production. If I remove all the code and just leave a console, no output is seen anywhere

@ulfgebhardt ulfgebhardt merged commit e2af5f1 into master Apr 4, 2024
41 checks passed
@ulfgebhardt ulfgebhardt deleted the authorization-frontend branch April 16, 2024 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

🚀 [Feature] Protect Frontend Routes
3 participants