Skip to content

Commit

Permalink
fix(jans-cedarling): update example authorize_without_jwt_validation (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
rmarinn authored Dec 3, 2024
1 parent a2dee8c commit be3a3eb
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
})?;

// the following tokens are expired

// access_token claims:
// {
// "sub": "boG8dfc5MKTn37o7gsdCeyqL8LpWQtgoO41m1KZwdq0",
Expand All @@ -50,7 +49,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// "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": "[email protected]",
// "name": "Default Admin User",
// "status": {
// "status_list": {
Expand All @@ -59,7 +59,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// }
// }
// }
let access_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJib0c4ZGZjNU1LVG4zN283Z3NkQ2V5cUw4THBXUXRnb080MW0xS1p3ZHEwIiwiY29kZSI6ImJmMTkzNGY2LTM5MDUtNDIwYS04Mjk5LTZiMmUzZmZkZGQ2ZSIsImlzcyI6Imh0dHBzOi8vYWRtaW4tdWktdGVzdC5nbHV1Lm9yZyIsInRva2VuX3R5cGUiOiJCZWFyZXIiLCJjbGllbnRfaWQiOiI1YjQ0ODdjNC04ZGIxLTQwOWQtYTY1My1mOTA3YjgwOTQwMzkiLCJhdWQiOiI1YjQ0ODdjNC04ZGIxLTQwOWQtYTY1My1mOTA3YjgwOTQwMzkiLCJhY3IiOiJiYXNpYyIsIng1dCNTMjU2IjoiIiwic2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CJzdGF0dXMiOnsic3RhdHVzX2xpc3QiOnsiaWR4IjoyMDEsInVyaSI6Imh0dHBzOi8vYWRtaW4tdWktdGVzdC5nbHV1Lm9yZy9qYW5zLWF1dGgvcmVzdHYxL3N0YXR1c19saXN0In19fQ.D6q28qP-rZ3LayPsVlvUzXCwHtl7g3VTntMQvG_f3mM".to_string();

// id_token claims:
// {
Expand All @@ -72,7 +72,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// "acr": "basic",
// "amr": "pwd",
// "username": "[email protected]",
// "country": "usa",
// "country": "US",
// "x5t#S256": "",
// "scope": [
// "openid",
Expand All @@ -82,7 +82,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// "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": {
Expand All @@ -91,20 +91,22 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// }
// }
// }
let id_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJib0c4ZGZjNU1LVG4zN283Z3NkQ2V5cUw4THBXUXRnb080MW0xS1p3ZHEwIiwiY29kZSI6ImJmMTkzNGY2LTM5MDUtNDIwYS04Mjk5LTZiMmUzZmZkZGQ2ZSIsImlzcyI6Imh0dHBzOi8vYWRtaW4tdWktdGVzdC5nbHV1Lm9yZyIsInRva2VuX3R5cGUiOiJCZWFyZXIiLCJjbGllbnRfaWQiOiI1YjQ0ODdjNC04ZGIxLTQwOWQtYTY1My1mOTA3YjgwOTQwMzkiLCJhdWQiOiI1YjQ0ODdjNC04ZGIxLTQwOWQtYTY1My1mOTA3YjgwOTQwMzkiLCJhY3IiOiJiYXNpYyIsImFtciI6InB3ZCIsInVzZXJuYW1lIjoiYWRtaW5AZ2x1dS5vcmci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hwIjoxNzI0OTQ1OTc4LCJpYXQiOjE3MjQ4MzIyNTksImp0aSI6ImlkX3Rrbl9qdGkiLCJuYW1lIjoiRGVmYXVsdCBBZG1pbiBVc2VyIiwic3RhdHVzIjp7InN0YXR1c19saXN0Ijp7ImlkeCI6MjAxLCJ1cmkiOiJodHRwczovL2FkbWluLXVpLXRlc3QuZ2x1dS5vcmcvamFucy1hdXRoL3Jlc3R2MS9zdGF0dXNfbGlzdCJ9fX0.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": "[email protected]",
// "name": "Default Admin User",
// "email": "[email protected]"
// "email": "[email protected]",
// "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,
Expand Down

0 comments on commit be3a3eb

Please sign in to comment.