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

Refactor auth config #2650

Merged
merged 1 commit into from
Jun 14, 2024
Merged

Refactor auth config #2650

merged 1 commit into from
Jun 14, 2024

Conversation

jonatanklosko
Copy link
Member

Currently auth is controlled by several configuration keys, namely :authentication_mode, :password, :token. I moved it to a single :authentication key. For :token we use a persistent term to generate and cache a random value. I also simplified the auth code a bit.

Copy link

github-actions bot commented Jun 14, 2024

Uffizzi Preview deployment-53062 was deleted.

Comment on lines 29 to -34
def authenticate(conn, %{"password" => password}) do
conn = AuthPlug.store(conn, :password, password)

if AuthPlug.authenticated?(conn, :password) do
Copy link
Member Author

Choose a reason for hiding this comment

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

We used to pass :password here explicitly and compare that it matches with the configured mode. I don't think it's necessary though. We have a controller plug that ensures the user is not already authenticated, so the only way they become authenticated here is if the submitted password is valid and the mode is actually password.

@jonatanklosko jonatanklosko merged commit 81f6744 into main Jun 14, 2024
8 checks passed
@jonatanklosko jonatanklosko deleted the jk-auth branch June 14, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants