-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: flatten (de)serialization of custom user claims (#1159)
* feat: initial implementation * test: implement more jwt tests * test: reduce code duplication with rstest * test: rename variables * test: remove unreferenced snapshot * fix: examples compilation * test: add missing snapshot * test: add missing snapshot * test: fix broken template * fix: fix starters compilation * Update examples/demo/src/models/users.rs Co-authored-by: Jorge Hermo <[email protected]> * chore: remove todos * feat: only derive eq and partial eq in test target * chore: undo changes in starters * fix: CI compilation * Added `total_items` to pagination view & response (#1197) Co-authored-by: Elad Kaplan <[email protected]> --------- Co-authored-by: Elad Kaplan <[email protected]> Co-authored-by: Timon Klinkert <[email protected]>
- Loading branch information
1 parent
fcc60c7
commit 7f2e5f8
Showing
12 changed files
with
281 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/auth/snapshots/loco_rs__auth__jwt__tests__valid token and custom array claims.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
source: src/auth/jwt.rs | ||
expression: jwt.validate(&token) | ||
--- | ||
Ok( | ||
TokenData { | ||
header: Header { | ||
typ: Some( | ||
"JWT", | ||
), | ||
alg: HS512, | ||
cty: None, | ||
jku: None, | ||
jwk: None, | ||
kid: None, | ||
x5u: None, | ||
x5c: None, | ||
x5t: None, | ||
x5t_s256: None, | ||
}, | ||
claims: UserClaims { | ||
pid: "pid", | ||
exp: EXP, | ||
claims: { | ||
"array": Array [ | ||
Number(1), | ||
Number(2), | ||
Number(3), | ||
], | ||
}, | ||
}, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...auth/snapshots/loco_rs__auth__jwt__tests__valid token and custom nested array claims.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
source: src/auth/jwt.rs | ||
expression: jwt.validate(&token) | ||
--- | ||
Ok( | ||
TokenData { | ||
header: Header { | ||
typ: Some( | ||
"JWT", | ||
), | ||
alg: HS512, | ||
cty: None, | ||
jku: None, | ||
jwk: None, | ||
kid: None, | ||
x5u: None, | ||
x5c: None, | ||
x5t: None, | ||
x5t_s256: None, | ||
}, | ||
claims: UserClaims { | ||
pid: "pid", | ||
exp: EXP, | ||
claims: { | ||
"level1": Object { | ||
"level2": Object { | ||
"level3": Array [ | ||
Number(1), | ||
Number(2), | ||
Number(3), | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
) |
Oops, something went wrong.