mirror of
				https://github.com/dani-garcia/vaultwarden.git
				synced 2025-10-31 10:18:19 +02:00 
			
		
		
		
	Remove whitespace before processing tokens
This commit is contained in:
		| @@ -51,7 +51,9 @@ pub fn decode_jwt(token: &str) -> Result<JWTClaims, Error> { | ||||
|         algorithms: vec![JWT_ALGORITHM], | ||||
|     }; | ||||
|  | ||||
|     jsonwebtoken::decode(token, &PUBLIC_RSA_KEY, &validation) | ||||
|     let token = token.replace(char::is_whitespace, ""); | ||||
|  | ||||
|     jsonwebtoken::decode(&token, &PUBLIC_RSA_KEY, &validation) | ||||
|         .map(|d| d.claims) | ||||
|         .map_res("Error decoding login JWT") | ||||
| } | ||||
| @@ -68,7 +70,9 @@ pub fn decode_invite_jwt(token: &str) -> Result<InviteJWTClaims, Error> { | ||||
|         algorithms: vec![JWT_ALGORITHM], | ||||
|     }; | ||||
|  | ||||
|     jsonwebtoken::decode(token, &PUBLIC_RSA_KEY, &validation) | ||||
|     let token = token.replace(char::is_whitespace, ""); | ||||
|  | ||||
|     jsonwebtoken::decode(&token, &PUBLIC_RSA_KEY, &validation) | ||||
|         .map(|d| d.claims) | ||||
|         .map_res("Error decoding invite JWT") | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user