Skip to content

Commit

Permalink
Make all opts optional for consistency (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
doomspork authored Jan 9, 2020
1 parent b8a4945 commit 37d075f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/guardian/plug.ex
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ if Code.ensure_loaded?(Plug) do
end

@spec authenticated?(Plug.Conn.t(), Guardian.options()) :: true | false
def authenticated?(conn, opts) do
def authenticated?(conn, opts \\ []) do
key =
conn
|> fetch_key(opts)
Expand Down Expand Up @@ -215,7 +215,7 @@ if Code.ensure_loaded?(Plug) do
end

@spec sign_out(Plug.Conn.t(), module, Guardian.options()) :: Plug.Conn.t()
def sign_out(conn, impl, opts) do
def sign_out(conn, impl, opts \\ []) do
key = Keyword.get(opts, :key, :all)
result = do_sign_out(conn, impl, key, opts)

Expand All @@ -242,7 +242,7 @@ if Code.ensure_loaded?(Plug) do
makes a compliant client forget it.
"""
@spec clear_remember_me(Plug.Conn.t(), module, Guardian.options()) :: Plug.Conn.t()
def clear_remember_me(conn, mod, opts) do
def clear_remember_me(conn, mod, opts \\ []) do
key = fetch_token_key(conn, opts)
# Any value could be used here as the cookie is set to expire immediately anyway
token = ""
Expand Down Expand Up @@ -289,7 +289,7 @@ if Code.ensure_loaded?(Plug) do
end

@spec maybe_halt(Plug.Conn.t(), Keyword.t()) :: Plug.Conn.t()
def maybe_halt(conn, opts) do
def maybe_halt(conn, opts \\ []) do
if Keyword.get(opts, :halt, true) do
Plug.Conn.halt(conn)
else
Expand All @@ -298,7 +298,7 @@ if Code.ensure_loaded?(Plug) do
end

@spec find_token_from_cookies(conn :: Plug.Conn.t(), Keyword.t()) :: {:ok, String.t()} | :no_token_found
def find_token_from_cookies(conn, opts) do
def find_token_from_cookies(conn, opts \\ []) do
key =
conn
|> Pipeline.fetch_key(opts)
Expand Down

0 comments on commit 37d075f

Please sign in to comment.