-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #578 from Muxoid/role_based_auth
Adding a custom claims Option<serde_json::Value> to the UserClaims struct.
- Loading branch information
Showing
6 changed files
with
61 additions
and
9 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
30 changes: 30 additions & 0 deletions
30
src/auth/snapshots/loco_rs__auth__jwt__tests__valid token and custom 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,30 @@ | ||
--- | ||
source: src/auth/jwt.rs | ||
assertion_line: 133 | ||
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: Some( | ||
Object {}, | ||
), | ||
}, | ||
}, | ||
) |
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 |
---|---|---|
|
@@ -21,6 +21,7 @@ Ok( | |
claims: UserClaims { | ||
pid: "pid", | ||
exp: EXP, | ||
claims: None, | ||
}, | ||
}, | ||
) |