From be3a3eba862d481a8dbd8029199f7dcfa31a7198 Mon Sep 17 00:00:00 2001 From: Richard Marin <34529290+rmarinn@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:38:04 +0800 Subject: [PATCH] fix(jans-cedarling): update example authorize_without_jwt_validation (#10308) - update example authorize_without_jwt_validation.rs to have the correct args so the call to `authorize` won't fail. Signed-off-by: rmarinn <34529290+rmarinn@users.noreply.github.com> --- .../authorize_without_jwt_validation.rs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/jans-cedarling/cedarling/examples/authorize_without_jwt_validation.rs b/jans-cedarling/cedarling/examples/authorize_without_jwt_validation.rs index 5b5844cd7cc..5ab4bf10d52 100644 --- a/jans-cedarling/cedarling/examples/authorize_without_jwt_validation.rs +++ b/jans-cedarling/cedarling/examples/authorize_without_jwt_validation.rs @@ -31,7 +31,6 @@ fn main() -> Result<(), Box> { })?; // the following tokens are expired - // access_token claims: // { // "sub": "boG8dfc5MKTn37o7gsdCeyqL8LpWQtgoO41m1KZwdq0", @@ -50,7 +49,8 @@ fn main() -> Result<(), Box> { // "auth_time": 1724830746, // "exp": 1724945978, -> Aug 29, 2024 23:39:38 GMT+0800 // "iat": 1724832259, -> Aug 28, 2024 16:0419 GMT+0800 - // "jti": "lxTmCVRFTxOjJgvEEpozMQ", + // "jti": "access_tkn_jti", + // "username": "admin@gluu.org", // "name": "Default Admin User", // "status": { // "status_list": { @@ -59,7 +59,7 @@ fn main() -> Result<(), Box> { // } // } // } - let access_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJib0c4ZGZjNU1LVG4zN283Z3NkQ2V5cUw4THBXUXRnb080MW0xS1p3ZHEwIiwiY29kZSI6ImJmMTkzNGY2LTM5MDUtNDIwYS04Mjk5LTZiMmUzZmZkZGQ2ZSIsImlzcyI6Imh0dHBzOi8vYWRtaW4tdWktdGVzdC5nbHV1Lm9yZyIsInRva2VuX3R5cGUiOiJCZWFyZX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dfaWQiOiJzb21lX2xvbmdfaWQiLCJhdXRoX3RpbWUiOjE3MjQ4MzA3NDYsImV4cCI6MTcyNDk0NTk3OCwiaWF0IjoxNzI0ODMyMjU5LCJqdGkiOiJhY2Nlc3NfdGtuX2p0aSIsIm5hbWUiOiJEZWZhdWx0IEFkbWluIFVzZXIiLCJzdGF0dXMiOnsic3RhdHVzX2xpc3QiOnsiaWR4IjoyMDEsInVyaSI6Imh0dHBzOi8vYWRtaW4tdWktdGVzdC5nbHV1Lm9yZy9qYW5zLWF1dGgvcmVzdHYxL3N0YXR1c19saXN0In19fQ.D6q28qP-rZ3LayPsVlvUzXCwHtl7g3VTntMQvG_f3mM".to_string(); // id_token claims: // { @@ -72,7 +72,7 @@ fn main() -> Result<(), Box> { // "acr": "basic", // "amr": "pwd", // "username": "admin@gluu.org", - // "country": "usa", + // "country": "US", // "x5t#S256": "", // "scope": [ // "openid", @@ -82,7 +82,7 @@ fn main() -> Result<(), Box> { // "auth_time": 1724830746, // "exp": 1724945978, -> Aug 29, 2024 23:39:38 GMT+0800 // "iat": 1724832259, -> Aug 28, 2024 16:0419 GMT+0800 - // "jti": "lxTmCVRFTxOjJgvEEpozMQ", + // "jti": "id_tkn_jti", // "name": "Default Admin User", // "status": { // "status_list": { @@ -91,20 +91,22 @@ fn main() -> Result<(), Box> { // } // } // } - let id_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJib0c4ZGZjNU1LVG4zN283Z3NkQ2V5cUw4THBXUXRnb080MW0xS1p3ZHEwIiwiY29kZSI6ImJmMTkzNGY2LTM5MDUtNDIwYS04Mjk5LTZiMmUzZmZkZGQ2ZSIsImlzcyI6Imh0dHBzOi8vYWRtaW4tdWktdGVzdC5nbHV1Lm9yZyIsInRva2VuX3R5cGUiOiJCZWFyZXIiLCJjbGllbnRfaWQiOiI1YjQ0ODdjNC04ZGIxLTQwOWQtYTY1My1mOTA3YjgwOTQwMzkiLCJhdWQiOiI1YjQ0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I1MyNTYiOiIiLCJzY29wZSI6WyJvcGVuaWQiLCJwcm9maWxlIl0sIm9yZ19pZCI6InNvbWVfbG9uZ19pZCIsImF1dGhfdGltZSI6MTcyNDgzMDc0NiwiZXhwIjoxNzI0OTQ1OTc4LCJpYXQiOjE3MjQ4MzIyNTksImp0aSI6ImlkX3Rrbl9qdGkiLCJuYW1lIjoiRGVmYXVsdCBBZG1pbiBVc2VyIiwic3RhdHVzIjp7InN0YXR1c19saXN0Ijp7ImlkeCI6MjAxLCJ1cmkiOiJodHRwczovL2FkbWluLXVpLXRlc3QuZ2x1dS5vcmcvamFucy1hdXRoL3Jlc3R2MS9zdGF0dXNfbGlzdCJ9fX0.xVRNRN7RW3Y2n4bzW0k93zbe5Tn0htQS6JiVq9NP0NE".to_string(); // userinfo_token claims: // { + // "iss": "https://admin-ui-test.gluu.org", // "sub": "boG8dfc5MKTn37o7gsdCeyqL8LpWQtgoO41m1KZwdq0", // "client_id": "5b4487c4-8db1-409d-a653-f907b8094039", // "aud": "5b4487c4-8db1-409d-a653-f907b8094039", + // "ueyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FkbWluLXVpLXRlc3QuZ2x1dS5vcmciLCJzdWIiOiJib0c4ZGZjNU1LVG4zN283Z3NkQ2V5cUw4THBXUXRnb080MW0xS1p3ZHEwIiwiY2xpZW50X2lkIjoiNWI0NDg3YzQtOGRiMS00MDlkLWE2NTMtZjkwN2I4MDk0MDM5IiwiYXVkIjoiNWI0NDg3YzQtOGRiMS00MDlkLWE2NTMtZjkwN2I4MDk0MDM5IiwibmFtZSI6IkRlZmF1bHQgQWRtaW4gVXNlciIsImVtYWlsIjoiYWRtaW5AZ2x1dS5vcmciLCJjb3VudHJ5IjoiVVMiLCJqdGkiOiJ1c3JpbmZvX3Rrbl9qdGkifQ.sUrKttbzHktPYtSelizTJZJr_8mqkVBpStA5fjNJU9ksername": "admin@gluu.org", // "name": "Default Admin User", - // "email": "admin@gluu.org" + // "email": "admin@gluu.org", + // "country": "US", + // "jti": "usrinfo_tkn_jti" // } - let userinfo_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJib0c4ZGZjNU1LVG4zN283Z3NkQ2V5cUw4THBXUXRnb080MW0xS1p3ZHEwIiwiY2xpZW50X2lkIjoiNWI0NDg3YzQtOGRiMS00MDlkLWE2NTMtZjkwN2I4MDk0MDM5IiwiYXVkIjoiNWI0NDg3YzQtOGRiMS00MDlkLWE2NTMtZjkwN2I4MDk0MDM5IiwibmFtZSI6IkRlZmF1bHQgQWRtaW4gVXNlciIsImVtYWlsIjoiYWRtaW5AZ2x1dS5vcmcifQ.MNebnjubvPtn9eq5j4RvWOTw7NBkjqt2Z8hTyFSJz0w".to_string(); + let userinfo_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FkbWluLXVpLXRlc3QuZ2x1dS5vcmciLCJzdWIiOiJib0c4ZGZjNU1LVG4zN283Z3NkQ2V5cUw4THBXUXRnb080MW0xS1p3ZHEwIiwiY2xpZW50X2lkIjoiNWI0NDg3YzQtOGRiMS00MDlkLWE2NTMtZjkwN2I4MDk0MDM5IiwiYXVkIjoiNWI0NDg3YzQtOGRiMS00MDlkLWE2NTMtZjkwN2I4MDk0MDM5IiwidXNlcm5hbWUiOiJhZG1pbkBnbHV1Lm9yZyIsIm5hbWUiOiJEZWZhdWx0IEFkbWluIFVzZXIiLCJlbWFpbCI6ImFkbWluQGdsdXUub3JnIiwiY291bnRyeSI6IlVTIiwianRpIjoidXNyaW5mb190a25fanRpIn0.NoR53vPZFpfb4vFk85JH9RPx7CHsaJMZwrH3fnB-N60".to_string(); - // TODO: make access_token, id_token, and userinfo_token optional since they are not needed - // when validation is off let result = cedarling.authorize(Request { access_token, id_token,