1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-07 17:03:01 +03:00

Fix client auth test

This commit is contained in:
Quentin Gliech
2022-01-06 09:44:21 +01:00
parent a965e488e2
commit ef3da801a3

View File

@@ -313,6 +313,20 @@ mod tests {
}, },
redirect_uris: Vec::new(), redirect_uris: Vec::new(),
}); });
config.clients.push(OAuth2ClientConfig {
client_id: "secret-jwt".to_string(),
client_auth_method: OAuth2ClientAuthMethodConfig::ClientSecretJwt {
client_secret: CLIENT_SECRET.to_string(),
},
redirect_uris: Vec::new(),
});
config.clients.push(OAuth2ClientConfig {
client_id: "secret-jwt-2".to_string(),
client_auth_method: OAuth2ClientAuthMethodConfig::ClientSecretJwt {
client_secret: CLIENT_SECRET.to_string(),
},
redirect_uris: Vec::new(),
});
config config
} }
@@ -343,8 +357,8 @@ mod tests {
let store = SharedSecret::new(&CLIENT_SECRET); let store = SharedSecret::new(&CLIENT_SECRET);
let claims = ClientAssertionClaims { let claims = ClientAssertionClaims {
issuer: "confidential".to_string(), issuer: "secret-jwt".to_string(),
subject: "confidential".to_string(), subject: "secret-jwt".to_string(),
audience, audience,
jwt_id: None, jwt_id: None,
}; };
@@ -364,7 +378,7 @@ mod tests {
.method("POST") .method("POST")
.header("Content-Type", mime::APPLICATION_WWW_FORM_URLENCODED.to_string()) .header("Content-Type", mime::APPLICATION_WWW_FORM_URLENCODED.to_string())
.body(serde_urlencoded::to_string(json!({ .body(serde_urlencoded::to_string(json!({
"client_id": "confidential", "client_id": "secret-jwt",
"client_assertion": jwt, "client_assertion": jwt,
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"foo": "baz", "foo": "baz",
@@ -375,7 +389,7 @@ mod tests {
.unwrap(); .unwrap();
assert_eq!(auth, ClientAuthenticationMethod::ClientSecretJwt); assert_eq!(auth, ClientAuthenticationMethod::ClientSecretJwt);
assert_eq!(client.client_id, "confidential"); assert_eq!(client.client_id, "secret-jwt");
assert_eq!(body.foo, "baz"); assert_eq!(body.foo, "baz");
assert_eq!(body.bar, "foobar"); assert_eq!(body.bar, "foobar");
@@ -397,7 +411,7 @@ mod tests {
let res = warp::test::request() let res = warp::test::request()
.method("POST") .method("POST")
.body(serde_urlencoded::to_string(json!({ .body(serde_urlencoded::to_string(json!({
"client_id": "confidential-2", "client_id": "secret-jwt-2",
"client_assertion": jwt, "client_assertion": jwt,
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"foo": "baz", "foo": "baz",