Browse Source
Feature/ability to disable OIDC "profile" scope (#1207 )
* PRFL-10747. Added ability to disable OIDC profile scope.
* Added documentation to the appsettings.
---------
Co-authored-by: Osipenko Maksim <MaViOsipenko@beeline.ru>
pull/1210/head
Max O
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
17 additions and
1 deletions
backend/src/Squidex/Config/Authentication/OidcServices.cs
backend/src/Squidex/Config/MyIdentityOptions.cs
backend/src/Squidex/appsettings.json
@ -24,6 +24,12 @@ public static class OidcServices
authBuilder . AddOpenIdConnect ( Constants . ExternalScheme , displayName , options = >
{
if ( identityOptions . OidcDisableProfileScope )
{
options . Scope . Clear ( ) ;
options . Scope . Add ( OpenIddict . Abstractions . OpenIddictConstants . Scopes . OpenId ) ;
}
options . Events = new OidcHandler ( identityOptions ) ;
options . Authority = identityOptions . OidcAuthority ;
options . Prompt = identityOptions . OidcPrompt ;
@ -61,6 +61,13 @@ public sealed class MyIdentityOptions
public string [ ] OidcScopes { get ; set ; }
/// <summary>
/// <see cref="Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions"/>
/// by default contains scopes "openid" and "profile".
/// When <see cref="OidcDisableProfileScope"/> is set to true scope "profile" will be removed.
/// </summary>
public bool OidcDisableProfileScope { get ; set ; }
public bool OidcGetClaimsFromUserInfoEndpoint { get ; set ; }
public bool OidcOverridePermissionsWithCustomClaimsOnLogin { get ; set ; }
@ -687,7 +687,10 @@
"oidcResponseType" : "id_token" , / / o r "code"
"oidcGetClaimsFromUserInfoEndpoint" : false ,
"oidcOverridePermissionsWithCustomClaimsOnLogin" : false ,
"oidcOnSignoutRedirectUrl" : "" ,
"oidcOnSignoutRedirectUrl" : "" ,
/ / M i c r o s o f t . A s p N e t C o r e . A u t h e n t i c a t i o n . O p e n I d C o n n e c t . O p e n I d C o n n e c t O p t i o n s b y d e f a u l t c o n t a i n s s c o p e s "openid" a n d "profile" .
/ / W h e n o i d c D i s a b l e P r o f i l e S c o p e i s s e t t o true s c o p e "profile" w i l l b e r e m o v e d .
"oidcDisableProfileScope" : true ,
/ / L o c k n e w u s e r s a u t o m a t i c a l l y , t h e a d m i n i s t r a t o r m u s t u n l o c k t h e m .
"lockAutomatically" : false ,