oops didn't mean to commit that
This commit is contained in:
@@ -4,12 +4,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Infrastructure.DependencyInjection;
|
||||
using Umbraco.Cms.Web.BackOffice.ModelsBuilder;
|
||||
using Microsoft.Identity.Web;
|
||||
using Umbraco.Extensions;
|
||||
using Umbraco.Cms.Web.BackOffice.Security;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Umbraco.Cms.Web.UI.NetCore
|
||||
{
|
||||
@@ -45,69 +40,7 @@ namespace Umbraco.Cms.Web.UI.NetCore
|
||||
{
|
||||
#pragma warning disable IDE0022 // Use expression body for methods
|
||||
services.AddUmbraco(_env, _config)
|
||||
.AddBackOffice()
|
||||
.AddBackOfficeExternalLogins(logins =>
|
||||
{
|
||||
var loginProviderOptions = new BackOfficeExternalLoginProviderOptions(
|
||||
"btn-google",
|
||||
"fa-google",
|
||||
new ExternalSignInAutoLinkOptions(true)
|
||||
{
|
||||
OnAutoLinking = (user, login) =>
|
||||
{
|
||||
},
|
||||
OnExternalLogin = (user, login) =>
|
||||
{
|
||||
user.Claims.Add(new IdentityUserClaim<string>
|
||||
{
|
||||
ClaimType = "hello",
|
||||
ClaimValue = "world"
|
||||
});
|
||||
return true;
|
||||
}
|
||||
},
|
||||
denyLocalLogin: false,
|
||||
autoRedirectLoginToExternalProvider: false);
|
||||
|
||||
logins.AddBackOfficeLogin(
|
||||
loginProviderOptions,
|
||||
auth =>
|
||||
{
|
||||
auth.AddGoogle(
|
||||
auth.SchemeForBackOffice("Google"), // The scheme must be set with this method to work for the back office
|
||||
options =>
|
||||
{
|
||||
// By default this is '/signin-google' but it needs to be changed to this
|
||||
options.CallbackPath = "/umbraco-google-signin";
|
||||
options.ClientId = "1072120697051-p41pro11srud3o3n90j7m00geq426jqt.apps.googleusercontent.com";
|
||||
options.ClientSecret = "cs_LJTXh2rtI01C5OIt9WFkt";
|
||||
});
|
||||
|
||||
// NOTE: Adding additional providers here is possible via the API but
|
||||
// it will mean that the same BackOfficeExternalLoginProviderOptions will be registered
|
||||
// for them. In some weird cases maybe people would want that?
|
||||
});
|
||||
|
||||
logins.AddBackOfficeLogin(
|
||||
new BackOfficeExternalLoginProviderOptions("btn-microsoft", "fa-windows"),
|
||||
auth =>
|
||||
{
|
||||
auth.AddMicrosoftIdentityWebApp(
|
||||
options =>
|
||||
{
|
||||
options.SaveTokens = true;
|
||||
|
||||
// By default this is '/signin-oidc' but it needs to be changed to this
|
||||
options.CallbackPath = "/umbraco-signin-oidc";
|
||||
options.Instance = "https://login.microsoftonline.com/";
|
||||
options.TenantId = "3bb0b4c5-364f-4394-ad36-0f29f95e5ddd";
|
||||
options.ClientId = "56e98cad-ed2d-4f1b-8f85-bef11adc163f";
|
||||
options.ClientSecret = "-1E9_fdPHi_ZkSQOb2.O5LG025sv6-NQ3h";
|
||||
},
|
||||
openIdConnectScheme: auth.SchemeForBackOffice("AzureAD"), // The scheme must be set with this method to work for the back office
|
||||
cookieScheme: "Fake");
|
||||
});
|
||||
})
|
||||
.AddBackOffice()
|
||||
.AddWebsite()
|
||||
.AddComposers()
|
||||
.Build();
|
||||
|
||||
Reference in New Issue
Block a user