]> Entropealabs - wampex_router.git/commitdiff
fix challenge bug multi-auth
authorChristopher Coté <ccote@cohesionib.com>
Thu, 19 Nov 2020 03:49:44 +0000 (21:49 -0600)
committerChristopher Coté <ccote@cohesionib.com>
Thu, 19 Nov 2020 03:49:44 +0000 (21:49 -0600)
lib/router/session.ex

index 5ee1e13fa61e01709915730c51f321a4901abe4f..5cba8367fcbb01930de717b36ba216c43eac567e 100644 (file)
@@ -187,7 +187,7 @@ defmodule Wampex.Router.Session do
             } = data
         } = sl
       ) do
-    {actions, challenge, module} = maybe_challenge(auth, realm, options, session_id, tt, t)
+    {actions, challenge, mod} = maybe_challenge(auth, realm, options, session_id, tt, t)
 
     {:ok,
      %SL{
@@ -197,7 +197,7 @@ defmodule Wampex.Router.Session do
            | challenge: challenge,
              hello_received: true,
              realm: realm,
-             authentication_module: module
+             authentication_module: mod
          }
      }, [{:next_event, :internal, :transition}] ++ actions}
   end
@@ -213,7 +213,7 @@ defmodule Wampex.Router.Session do
             transport: tt,
             transport_pid: t,
             authentication_module: auth,
-            challenge: challenge,
+            challenge: %Challenge{extra: challenge},
             realm: realm,
             name: name,
             authenticate: %Authenticate{signature: sig}
@@ -742,7 +742,7 @@ defmodule Wampex.Router.Session do
               t
             )
 
-            {[], ch, auth}
+            {[], chal, auth}
 
           false ->
             Logger.error("Not a supported authentication method: #{inspect(am)}")
@@ -811,8 +811,8 @@ defmodule Wampex.Router.Session do
   defp maybe_update_response(data, resp), do: {data, resp}
 
   def is_authorized?(am, peer, type, uri, method) do
-    am = get_auth_module(am, [method])
-    am.authorized?(type, uri, peer)
+    auth = get_auth_module(am, [method])
+    auth.authorized?(type, uri, peer)
   end
 
   defp remove_nil_values(message) do