-
Notifications
You must be signed in to change notification settings - Fork 335
Decoding with x509 certs #77
Copy link
Copy link
Closed
Description
I'm having a hard time authenticating a token using a x5c. (MS OAuth/Azure)
Below is the code...
// Trying to isolate the problem by only checking the signature.
let validation_config = jsonwebtoken::Validation {
algorithms: vec![jsonwebtoken::Algorithm::RS256],
leeway: 0,
validate_exp: false,
validate_iat: false,
validate_nbf: false,
aud: None,
iss: None,
sub: None
};
let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIn...";
let x5c_cert = "MIIDBTCCAe2gAwIBAgIQKOfEJNDyDplBSXKYcM...";
let raw_der = base64::decode_config(der, base64::STANDARD).unwrap();
let d = jsonwebtoken::decode::<MsOAuthPayload>(&token, &raw_der, &validation_config);The above always returns InvalidSignature.
- RS265 is the correct algo.
- The cert is correct. I tried it on jwt.io by adding a BEGIN/END cert and it validates fine.
- I used ssl to convert the BEGIN/END pem to DER and the bytes match up from the base 64 decode.
- The key URL is: https://login.microsoftonline.com/common/discovery/v2.0/keys but my specific tenant returns the same keys.
Anyone have some insight on what I'm doing wrong here?
Thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels