@@ -24,6 +24,9 @@ defmodule Neurow.JwtAuthPlugTest do
24
24
send_forbidden: fn conn , error_code , error_message ->
25
25
conn |> assign ( :forbidden_error , { error_code , error_message } )
26
26
end ,
27
+ send_unauthorized: fn conn , error_code , error_message ->
28
+ conn |> assign ( :unauthorized_error , { error_code , error_message } )
29
+ end ,
27
30
jwk_provider: fn issuer ->
28
31
case issuer do
29
32
"issuer_1" -> [ @ issuer_1_jwk_1 , @ issuer_1_jwk_2 ]
@@ -82,7 +85,7 @@ defmodule Neurow.JwtAuthPlugTest do
82
85
assert response . assigns [ :jwt_payload ] == nil
83
86
end
84
87
85
- test "don not provide details about authentication errors if verbose_authentication_errors is set to false" ,
88
+ test "do not provide details about authentication errors if verbose_authentication_errors is set to false" ,
86
89
% {
87
90
default_opts: opts
88
91
} do
@@ -94,8 +97,8 @@ defmodule Neurow.JwtAuthPlugTest do
94
97
95
98
assert response . halted
96
99
97
- assert response . assigns [ :forbidden_error ] ==
98
- { :invalid_authentication_token , "Invalid authentication token " } ,
100
+ assert response . assigns [ :unauthorized_error ] ==
101
+ { :invalid_authorization_header , "Invalid authorization header " } ,
99
102
"Error details"
100
103
end
101
104
@@ -106,7 +109,7 @@ defmodule Neurow.JwtAuthPlugTest do
106
109
assert response . halted , "Response halted"
107
110
assert response . halted
108
111
109
- assert response . assigns [ :forbidden_error ] ==
112
+ assert response . assigns [ :unauthorized_error ] ==
110
113
{ :invalid_authorization_header , "Invalid authorization header" } ,
111
114
"Error details"
112
115
end
@@ -122,7 +125,7 @@ defmodule Neurow.JwtAuthPlugTest do
122
125
123
126
assert response . halted
124
127
125
- assert response . assigns [ :forbidden_error ] ==
128
+ assert response . assigns [ :unauthorized_error ] ==
126
129
{ :invalid_authorization_header , "Invalid authorization header" } ,
127
130
"Error details"
128
131
end
@@ -138,7 +141,7 @@ defmodule Neurow.JwtAuthPlugTest do
138
141
139
142
assert response . halted
140
143
141
- assert response . assigns [ :forbidden_error ] ==
144
+ assert response . assigns [ :unauthorized_error ] ==
142
145
{ :invalid_jwt_token , "Invalid JWT token" } ,
143
146
"Error details"
144
147
end
@@ -220,7 +223,7 @@ defmodule Neurow.JwtAuthPlugTest do
220
223
221
224
assert response . halted
222
225
223
- assert response . assigns [ :forbidden_error ] ==
226
+ assert response . assigns [ :unauthorized_error ] ==
224
227
{ :invalid_jwt_token , "Invalid JWT token" } ,
225
228
"Error details"
226
229
end
0 commit comments