behai-nguyen / behai-nguyen.github.io

My GitHub page.
1 stars 0 forks source link

2023/11/17/rust-13-jwt-simple #7

Open utterances-bot opened 3 months ago

utterances-bot commented 3 months ago

Rust: JSON Web Token – some investigative studies on crate jwt-simple. | behai-nguyen software development learnings and documentation

Via experimentations, I seek to answer the following question regarding crate jwt-simple how do we check if a token is still valid, i.e. not already expired? I’ve found the answer to this question, and I hope it’s a correct answer.

https://behai-nguyen.github.io/2023/11/17/rust-13-jwt-simple.html

kgday commented 3 months ago

Thank you for this article. I would like to draw your attention to the part where you come to the conclusion that it seems that the claims are not using the standard jwt claims values. However if you look into the source code you will see that when the token is serialized and deserialized, it is in fact mapping to the standard jwt claims keys. For example issue maps to 'iss'. It is the same with other fields. You can see this in the JWTClaims struct in claims.rs.

#[serde(rename = "iss", default, skip_serializing_if = "Option::is_none")]
    pub issuer: Option<String>
behai-nguyen commented 3 months ago

Thank you for this article. I would like to draw your attention to the part where you come to the conclusion that it seems that the claims are not using the standard jwt claims values. However if you look into the source code you will see that when the token is serialized and deserialized, it is in fact mapping to the standard jwt claims keys. For example issue maps to 'iss'. It is the same with other fields. You can see this in the JWTClaims struct in claims.rs.

#[serde(rename = "iss", default, skip_serializing_if = "Option::is_none")]
    pub issuer: Option<String>

Thank your Mr. Day @kgday for the information. I did miss that. I appreciate your helps.

Best regards,

...behai.