File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change 1
1
/// Example for the backend to backend implementation
2
2
use std:: collections:: HashMap ;
3
3
4
- use jsonwebtoken:: jwk:: { AlgorithmParameters , JwkSet } ;
4
+ use jsonwebtoken:: jwk:: JwkSet ;
5
5
use jsonwebtoken:: { DecodingKey , Validation , decode, decode_header} ;
6
6
7
7
const TOKEN : & str = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjFaNTdkX2k3VEU2S1RZNTdwS3pEeSJ9.eyJpc3MiOiJodHRwczovL2Rldi1kdXp5YXlrNC5ldS5hdXRoMC5jb20vIiwic3ViIjoiNDNxbW44c281R3VFU0U1N0Fkb3BhN09jYTZXeVNidmRAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vZGV2LWR1enlheWs0LmV1LmF1dGgwLmNvbS9hcGkvdjIvIiwiaWF0IjoxNjIzNTg1MzAxLCJleHAiOjE2MjM2NzE3MDEsImF6cCI6IjQzcW1uOHNvNUd1RVNFNTdBZG9wYTdPY2E2V3lTYnZkIiwic2NvcGUiOiJyZWFkOnVzZXJzIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.0MpewU1GgvRqn4F8fK_-Eu70cUgWA5JJrdbJhkCPCxXP-8WwfI-qx1ZQg2a7nbjXICYAEl-Z6z4opgy-H5fn35wGP0wywDqZpqL35IPqx6d0wRvpPMjJM75zVXuIjk7cEhDr2kaf1LOY9auWUwGzPiDB_wM-R0uvUMeRPMfrHaVN73xhAuQWVjCRBHvNscYS5-i6qBQKDMsql87dwR72DgHzMlaC8NnaGREBC-xiSamesqhKPVyGzSkFSaF3ZKpGrSDapqmHkNW9RDBE3GQ9OHM33vzUdVKOjU1g9Leb9PDt0o1U4p3NQoGJPShQ6zgWSUEaqvUZTfkbpD_DoYDRxA" ;
@@ -21,10 +21,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
21
21
return Err ( "No matching JWK found for the given kid" . into ( ) ) ;
22
22
} ;
23
23
24
- let decoding_key = match & jwk. algorithm {
25
- AlgorithmParameters :: RSA ( rsa) => DecodingKey :: from_rsa_components ( & rsa. n , & rsa. e ) ?,
26
- _ => unreachable ! ( "algorithm should be a RSA in this example" ) ,
27
- } ;
24
+ let decoding_key = DecodingKey :: from_jwk ( jwk) ?;
28
25
29
26
let validation = {
30
27
let mut validation = Validation :: new ( header. alg ) ;
You can’t perform that action at this time.
0 commit comments