Repository navigation
Conversation
|
All relevant checks now pass on head |
DaleSeo
left a comment
There was a problem hiding this comment.
I left a couple of small suggestions. Nothing blocking.
| let mut scope_parts: Vec<&str> = scope.split_whitespace().collect(); | ||
| scope_parts.sort_unstable(); | ||
| assert_eq!(scope_parts, vec!["read"]); |
There was a problem hiding this comment.
The test token server leaves scope out of its response, so resolve_granted_scopes falls back to requested_scopes. That means the old code also saved the ungranted offline_access scope in granted_scopes, which caused every later refresh to fail. Can we assert what gets saved to the credential store too?
| let requested_scopes = stored_credentials.granted_scopes.clone(); | ||
| for scope in requested_scopes.iter().cloned() { | ||
| refresh_request = refresh_request.add_scope(Scope::new(scope)); | ||
| } |
There was a problem hiding this comment.
granted_scopes is cloned into a new Vec, and then each element is cloned again. So the resolve_granted_scopes call below can take requested_scopes directly instead of &requested_scopes.
| let requested_scopes = stored_credentials.granted_scopes.clone(); | |
| for scope in requested_scopes.iter().cloned() { | |
| refresh_request = refresh_request.add_scope(Scope::new(scope)); | |
| } | |
| let requested_scopes = &stored_credentials.granted_scopes; | |
| refresh_request = | |
| refresh_request.add_scopes(requested_scopes.iter().cloned().map(Scope::new)); |
Summary
Send only the scopes recorded in the stored grant on OAuth refresh. Authorization and 403 scope-upgrade requests continue to add
offline_accesswhen supported.Fixes #1330
Testing
cargo test -p rmcp --features "auth transport-io"passed: 417 unit tests and 39 doctests; 9 doctests and 4 live Keycloak tests were ignored as configured.cargo +nightly fmt --all -- --checkpassed.cargo clippy -p rmcp --features auth --libpassed with three existingdead_codewarnings.