Browse Source

Prompt setting for oidc.

pull/1072/head
Sebastian Stehle 3 years ago
parent
commit
01f73b20e4
  1. 9
      backend/src/Squidex/Config/Authentication/OidcServices.cs
  2. 2
      backend/src/Squidex/Config/MyIdentityOptions.cs
  3. 5
      backend/src/Squidex/appsettings.json

9
backend/src/Squidex/Config/Authentication/OidcServices.cs

@ -7,6 +7,7 @@
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Squidex.Infrastructure;
namespace Squidex.Config.Authentication; namespace Squidex.Config.Authentication;
@ -20,11 +21,12 @@ public static class OidcServices
authBuilder.AddOpenIdConnect("ExternalOidc", displayName, options => authBuilder.AddOpenIdConnect("ExternalOidc", displayName, options =>
{ {
options.Events = new OidcHandler(identityOptions);
options.Authority = identityOptions.OidcAuthority; options.Authority = identityOptions.OidcAuthority;
options.Prompt = identityOptions.OidcPrompt;
options.ClientId = identityOptions.OidcClient; options.ClientId = identityOptions.OidcClient;
options.ClientSecret = identityOptions.OidcSecret; options.ClientSecret = identityOptions.OidcSecret;
options.RequireHttpsMetadata = identityOptions.RequiresHttps; options.RequireHttpsMetadata = identityOptions.RequiresHttps;
options.Events = new OidcHandler(identityOptions);
if (!string.IsNullOrEmpty(identityOptions.OidcMetadataAddress)) if (!string.IsNullOrEmpty(identityOptions.OidcMetadataAddress))
{ {
@ -40,10 +42,7 @@ public static class OidcServices
if (identityOptions.OidcScopes != null) if (identityOptions.OidcScopes != null)
{ {
foreach (var scope in identityOptions.OidcScopes) options.Scope.AddRange(identityOptions.OidcScopes);
{
options.Scope.Add(scope);
}
} }
}); });
} }

2
backend/src/Squidex/Config/MyIdentityOptions.cs

@ -45,6 +45,8 @@ public sealed class MyIdentityOptions
public string OidcSecret { get; set; } public string OidcSecret { get; set; }
public string OidcPrompt { get; set; }
public string OidcAuthority { get; set; } public string OidcAuthority { get; set; }
public string OidcMetadataAddress { get; set; } public string OidcMetadataAddress { get; set; }

5
backend/src/Squidex/appsettings.json

@ -585,8 +585,8 @@
"suppressXFrameOptionsHeader": false, "suppressXFrameOptionsHeader": false,
// Initial admin user. // Initial admin user.
"adminEmail": "hello@squidex.io", "adminEmail": "",
"adminPassword": "1q2w3e$R", "adminPassword": "",
// Recreate the admin if it does not exist or the password does not match. // Recreate the admin if it does not exist or the password does not match.
"adminRecreate": true, "adminRecreate": true,
@ -618,6 +618,7 @@
"oidcAuthority": "", "oidcAuthority": "",
"oidcClient": "", "oidcClient": "",
"oidcSecret": "", "oidcSecret": "",
"oidcPrompt": null,
"oidcMetadataAddress": "", "oidcMetadataAddress": "",
"oidcScopes": [ "oidcScopes": [
"email" "email"

Loading…
Cancel
Save