mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-12-28 10:42:25 +08:00
Make disabled auth mode explicit in code (#1114)
This commit is contained in:
parent
5acbd2efad
commit
d3ebf42b32
1 changed files with 4 additions and 4 deletions
|
@ -41,15 +41,15 @@ defmodule LivebookWeb.AuthPlug do
|
|||
@spec authenticated?(map(), non_neg_integer(), Livebook.Config.auth_mode()) :: boolean()
|
||||
def authenticated?(session, port, mode)
|
||||
|
||||
def authenticated?(_session, _port, :disabled) do
|
||||
true
|
||||
end
|
||||
|
||||
def authenticated?(session, port, mode) when mode in [:token, :password] do
|
||||
secret = session[key(port, mode)]
|
||||
is_binary(secret) and Plug.Crypto.secure_compare(secret, expected(mode))
|
||||
end
|
||||
|
||||
def authenticated?(_session, _port, _mode) do
|
||||
true
|
||||
end
|
||||
|
||||
defp authenticate(conn, :password) do
|
||||
redirect_to_authenticate(conn)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue