mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.5 KiB
36 lines
1.5 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Microsoft.AspNetCore.Authentication;
|
|
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Squidex.Web;
|
|
|
|
namespace Squidex.Config.Authentication
|
|
{
|
|
public static class OidcServices
|
|
{
|
|
public static AuthenticationBuilder AddMyExternalOdic(this AuthenticationBuilder authBuilder, MyIdentityOptions identityOptions)
|
|
{
|
|
if (identityOptions.IsOidcConfigured())
|
|
{
|
|
var displayName = !string.IsNullOrWhiteSpace(identityOptions.OidcName) ? identityOptions.OidcName : OpenIdConnectDefaults.DisplayName;
|
|
|
|
authBuilder.AddOpenIdConnect("ExternalOidc", displayName, options =>
|
|
{
|
|
options.Authority = identityOptions.OidcAuthority;
|
|
options.ClientId = identityOptions.OidcClient;
|
|
options.ClientSecret = identityOptions.OidcSecret;
|
|
options.Scope.Add(Constants.PermissionsScope);
|
|
options.RequireHttpsMetadata = false;
|
|
});
|
|
}
|
|
|
|
return authBuilder;
|
|
}
|
|
}
|
|
}
|
|
|