Skip to content

Commit 632904a

Browse files
committed
Make the default scope on upstream providers config openid
1 parent 5d58d9d commit 632904a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

crates/config/src/sections/upstream_oauth2.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,14 @@ pub struct SignInWithApple {
400400
pub key_id: String,
401401
}
402402

403+
fn default_scope() -> String {
404+
"openid".to_owned()
405+
}
406+
407+
fn is_default_scope(scope: &str) -> bool {
408+
scope == default_scope()
409+
}
410+
403411
/// Configuration for one upstream OAuth 2 provider.
404412
#[skip_serializing_none]
405413
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
@@ -495,6 +503,9 @@ pub struct Provider {
495503
pub id_token_signed_response_alg: JsonWebSignatureAlg,
496504

497505
/// The scopes to request from the provider
506+
///
507+
/// Defaults to `openid`.
508+
#[serde(default = "default_scope", skip_serializing_if = "is_default_scope")]
498509
pub scope: String,
499510

500511
/// How to discover the provider's configuration

docs/config.schema.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,6 @@
19741974
"required": [
19751975
"client_id",
19761976
"id",
1977-
"scope",
19781977
"token_endpoint_auth_method"
19791978
],
19801979
"properties": {
@@ -2044,7 +2043,7 @@
20442043
]
20452044
},
20462045
"scope": {
2047-
"description": "The scopes to request from the provider",
2046+
"description": "The scopes to request from the provider\n\nDefaults to `openid`.",
20482047
"type": "string"
20492048
},
20502049
"discovery_mode": {

0 commit comments

Comments
 (0)