mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-11-10 06:01:44 +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()
|
@spec authenticated?(map(), non_neg_integer(), Livebook.Config.auth_mode()) :: boolean()
|
||||||
def authenticated?(session, port, mode)
|
def authenticated?(session, port, mode)
|
||||||
|
|
||||||
|
def authenticated?(_session, _port, :disabled) do
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
def authenticated?(session, port, mode) when mode in [:token, :password] do
|
def authenticated?(session, port, mode) when mode in [:token, :password] do
|
||||||
secret = session[key(port, mode)]
|
secret = session[key(port, mode)]
|
||||||
is_binary(secret) and Plug.Crypto.secure_compare(secret, expected(mode))
|
is_binary(secret) and Plug.Crypto.secure_compare(secret, expected(mode))
|
||||||
end
|
end
|
||||||
|
|
||||||
def authenticated?(_session, _port, _mode) do
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
defp authenticate(conn, :password) do
|
defp authenticate(conn, :password) do
|
||||||
redirect_to_authenticate(conn)
|
redirect_to_authenticate(conn)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue