Allow POST on oauth userinfo (#3395)

This commit is contained in:
Jason 2025-02-04 01:22:32 -05:00 committed by GitHub
parent d4c5a6f4a9
commit 99e37e987a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 1 deletions

View file

@ -46,6 +46,7 @@
- Christopher-Robin (cebbinghaus)
- Fabian Kammel (datosh)
- Andris Raugulis (arthepsy)
- Jason (argonaut0)
## Acknowledgements

View file

@ -774,7 +774,9 @@ pub fn route_setup(state: ServerState) -> Router<ServerState> {
// // IF YOU CHANGE THESE VALUES YOU MUST UPDATE OIDC DISCOVERY URLS
.route(
"/oauth2/openid/:client_id/userinfo",
get(oauth2_openid_userinfo_get).options(oauth2_preflight_options),
get(oauth2_openid_userinfo_get)
.post(oauth2_openid_userinfo_get)
.options(oauth2_preflight_options),
)
// // ⚠️ ⚠️ WARNING ⚠️ ⚠️
// // IF YOU CHANGE THESE VALUES YOU MUST UPDATE OIDC DISCOVERY URLS

View file

@ -447,6 +447,24 @@ async fn test_oauth2_openid_basic_flow_impl(
assert_eq!(userinfo, oidc);
let response = client
.post(rsclient.make_url("/oauth2/openid/test_integration/userinfo"))
.bearer_auth(atr.access_token.clone())
.send()
.await
.expect("Failed to send userinfo POST request.");
tracing::trace!("{:?}", response.headers());
assert!(
response.headers().get(CONTENT_TYPE) == Some(&HeaderValue::from_static(APPLICATION_JSON))
);
let userinfo_post = response
.json::<OidcToken>()
.await
.expect("Unable to decode OidcToken from POST userinfo");
assert_eq!(userinfo_post, userinfo);
// Step 6 - Show that our client can perform a client credentials grant
let form_req: AccessTokenRequest = GrantTypeReq::ClientCredentials {