2FA for users in management API (#15607)
* Added 2FA management endpoints * Ensure not found do not lead to forbidden results * Do not inherit the requirement to have access to users, from the current user base class * Updated OpenApi.json * Handle 2FA in login scenario (only backend) * Added the endpoint to use for client to post 2FA code * Fixed tests and allow injecting the authentication type settings * fix test build * Fallback to use Constants.Security.BackOfficeAuthenticationType * remove unused variable * Review fixes * Build fix * Update src/Umbraco.Cms.Api.Management/Controllers/User/Current/DisableTwoFactorProviderCurrentUserController.cs Co-authored-by: Sven Geusens <geusens@gmail.com> * Handle case where 2fa provider is already setup --------- Co-authored-by: Sven Geusens <geusens@gmail.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Composing;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Events;
|
||||
using Umbraco.Cms.Core.Security;
|
||||
using Umbraco.Cms.Web.BackOffice.Security;
|
||||
using Umbraco.Cms.Web.Common.Security;
|
||||
|
||||
namespace Umbraco.Cms.Web.UI;
|
||||
|
||||
public class UseLegacyBackofficeSignInManagerComposer : IComposer
|
||||
{
|
||||
public void Compose(IUmbracoBuilder builder)
|
||||
{
|
||||
builder.Services.Configure<BackOfficeAuthenticationTypeSettings>(options =>
|
||||
{
|
||||
options.AuthenticationType = Constants.Security.BackOfficeAuthenticationType;
|
||||
options.ExternalAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType;
|
||||
options.TwoFactorAuthenticationType = Constants.Security.BackOfficeTwoFactorAuthenticationType;
|
||||
options.TwoFactorRememberMeAuthenticationType = Constants.Security.BackOfficeTwoFactorRememberMeAuthenticationType;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user