mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-23 00:47:33 +00:00
fix: Work around MSC4484 lockout when disabled
This commit is contained in:
1 parent
62fc507798
commit
49207a42f8
4 files changed
+16
-21
No files matched your search
@@ -107,7 +107,7 @@ pub struct RawScopes(String);
|
||||
|
||||
impl RawScopes {
|
||||
#[allow(clippy::trivial_regex)]
|
||||
pub fn to_scopes(&self, msc4484: bool) -> Result<RequestedScopes, String> {
|
||||
pub fn to_scopes(&self) -> Result<RequestedScopes, String> {
|
||||
let client_api_token_regex =
|
||||
regex!(r"urn:matrix:(client|org.matrix.msc2967.client):api:\*");
|
||||
let device_token_regex =
|
||||
@@ -121,7 +121,7 @@ impl RawScopes {
|
||||
let scope_was_new = {
|
||||
if client_api_token_regex.is_match(token) {
|
||||
scopes.scopes.insert(OAuthClientScope::ApiFullAccess)
|
||||
} else if msc4484 && server_administration_regex.is_match(token) {
|
||||
} else if server_administration_regex.is_match(token) {
|
||||
scopes.scopes.insert(OAuthClientScope::ServerAdministration)
|
||||
} else if let Some(captures) = device_token_regex.captures(token) {
|
||||
scopes
|
||||
|
||||
@@ -286,9 +286,7 @@ impl Service {
|
||||
}
|
||||
}
|
||||
|
||||
let requested_scopes = query
|
||||
.scope
|
||||
.to_scopes(self.services.config.experiments.msc4484.is_enabled())?;
|
||||
let requested_scopes = query.scope.to_scopes()?;
|
||||
|
||||
let redirect_uri_query_separator = match query.response_mode {
|
||||
| ResponseMode::Fragment => '#',
|
||||
@@ -347,7 +345,7 @@ impl Service {
|
||||
|
||||
let requested_scopes = query
|
||||
.scope
|
||||
.to_scopes(self.services.config.experiments.msc4484.is_enabled())
|
||||
.to_scopes()
|
||||
.map_err(|err| OAuthError::new(ErrorCode::InvalidGrant, err))?;
|
||||
|
||||
let device_code = Self::generate_token();
|
||||
|
||||
Reference in new issue
Block a user