Closed 7stud closed 4 years ago
Merging #602 into master will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #602 +/- ##
=======================================
Coverage 86.22% 86.22%
=======================================
Files 21 21
Lines 421 421
=======================================
Hits 363 363
Misses 58 58
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update dfb7772...f71184f. Read the comment docs.
@7stud any news on this?
Hi @7stud. We love to have this change, how is it coming along?
closes #600
1) Because the tutorial says that you can use your own User module instead of doing:
it should be made explicit that if you do use your own User module, then you need to define certain functions for the tutorial to work properly.
2) In the file
lib/auth_me/user_manager/user_manager.ex
, the tutorial doesn't specify the required import statement to allow the query to work without error:The required import statement is:
3) The tutorial alternately uses
"/secret"
and"/protected"
for the route to the protected page. The route needs to be the same everywhere in the tutorial.4) As currently written, the function
AuthMeWeb.SessionController.login_reply()
(in the filelib/auth_me_web/controllers/session_controller.ex
) will result in the error:Here's the offending code:
Due to the alias, the line:
is equivalent to:
And, because a connection is piped in as the first argument, the call becomes:
If you refer to the
Guardian.Plug.sign_in()
docs , the arguments are correct. However, the definition of the function:in the guardian source code is different than the definition in docs for the function:
How is that possible? The function
AuthMe.UserManager.Guardian.Plug.sign_in()
is injected into the file/lib/auth_me/user_manager/guardian.ex
by the statement:which calls the
Guardian.__using__()
macro. TheGuardian.__using__()
macro is defined in the source code here and contains the line:which calls the
Guardian.Plug.__using__()
macro. TheGuardian.Plug.__using__()
macro is defined in the source code here, and it contains the code:As can be see in that definition for
sign_in()
, the function should be called with two arguments:conn
and the resource, i.e.user
, not:conn, Guardian, user
. Whensign_in()
is called with the latter arguments,user
gets assigned to the parameter variableclaims
, and elsewhere in the guardian.ex source code the following executes:which causes the error:
protocol Enumerable not implemented for %AuthMe.UserManager.User
4) A similar problem as in 3) exists for the logout() function in AuthMeWeb.SessionController.
5) At the end of the tutorial, I changed the description of how a user can verify that Guardian is actually working. The new description instructs the user to try to gain access to the "/protected" route without first logging in, as well as steps to experiment with the logout feature.
6) Fixed other minor errors.