|
@@ -133,7 +133,7 @@ t_hmac_based(_) ->
|
|
|
Credential4 = Credential#{password => JWS4},
|
|
Credential4 = Credential#{password => JWS4},
|
|
|
?assertMatch({ok, #{is_superuser := false}}, emqx_authn_jwt:authenticate(Credential4, State3)),
|
|
?assertMatch({ok, #{is_superuser := false}}, emqx_authn_jwt:authenticate(Credential4, State3)),
|
|
|
|
|
|
|
|
- %% Issued At
|
|
|
|
|
|
|
+ %% Issued At (iat) should not matter
|
|
|
Payload5 = #{
|
|
Payload5 = #{
|
|
|
<<"username">> => <<"myuser">>,
|
|
<<"username">> => <<"myuser">>,
|
|
|
<<"iat">> => erlang:system_time(second) - 60,
|
|
<<"iat">> => erlang:system_time(second) - 60,
|
|
@@ -149,9 +149,7 @@ t_hmac_based(_) ->
|
|
|
},
|
|
},
|
|
|
JWS6 = generate_jws('hmac-based', Payload6, Secret),
|
|
JWS6 = generate_jws('hmac-based', Payload6, Secret),
|
|
|
Credential6 = Credential#{password => JWS6},
|
|
Credential6 = Credential#{password => JWS6},
|
|
|
- ?assertEqual(
|
|
|
|
|
- {error, bad_username_or_password}, emqx_authn_jwt:authenticate(Credential6, State3)
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ ?assertMatch({ok, #{is_superuser := false}}, emqx_authn_jwt:authenticate(Credential6, State3)),
|
|
|
|
|
|
|
|
%% Not Before
|
|
%% Not Before
|
|
|
Payload7 = #{
|
|
Payload7 = #{
|