diff --git a/src/Umbraco.Web/Editors/AuthenticationController.cs b/src/Umbraco.Web/Editors/AuthenticationController.cs index c2c481e8e4..92e396cd6b 100644 --- a/src/Umbraco.Web/Editors/AuthenticationController.cs +++ b/src/Umbraco.Web/Editors/AuthenticationController.cs @@ -26,6 +26,7 @@ using Umbraco.Core.Logging; using Umbraco.Core.Persistence; using Umbraco.Web.Composing; using IUser = Umbraco.Core.Models.Membership.IUser; +using Umbraco.Web.Editors.Filters; namespace Umbraco.Web.Editors { @@ -75,6 +76,7 @@ namespace Umbraco.Web.Editors /// This will also update the security stamp for the user so it can only be used once /// [ValidateAngularAntiForgeryToken] + [DenyLocalLoginAuthorization] public async Task PostVerifyInvite([FromUri]int id, [FromUri]string token) { if (string.IsNullOrWhiteSpace(token)) @@ -110,6 +112,8 @@ namespace Umbraco.Web.Editors [ValidateAngularAntiForgeryToken] public async Task PostUnLinkLogin(UnLinkLoginModel unlinkLoginModel) { + // TODO: If DenyLocalLogin is enabled for this provider we cannot unlink + var result = await UserManager.RemoveLoginAsync( User.Identity.GetUserId(), new UserLoginInfo(unlinkLoginModel.LoginProvider, unlinkLoginModel.ProviderKey)); @@ -178,6 +182,7 @@ namespace Umbraco.Web.Editors /// [WebApi.UmbracoAuthorize(requireApproval: false)] [SetAngularAntiForgeryTokens] + [DenyLocalLoginAuthorization] public UserDetail GetCurrentInvitedUser() { var user = UmbracoContext.Security.CurrentUser; @@ -213,6 +218,7 @@ namespace Umbraco.Web.Editors /// /// [SetAngularAntiForgeryTokens] + [DenyLocalLoginAuthorization] public async Task PostLogin(LoginModel loginModel) { var http = EnsureHttpContext(); @@ -286,6 +292,7 @@ namespace Umbraco.Web.Editors /// /// [SetAngularAntiForgeryTokens] + [DenyLocalLoginAuthorization] public async Task PostRequestPasswordReset(RequestPasswordResetModel model) { // If this feature is switched off in configuration the UI will be amended to not make the request to reset password available. diff --git a/src/Umbraco.Web/Editors/Filters/DenyLocalLoginAuthorizationAttribute.cs b/src/Umbraco.Web/Editors/Filters/DenyLocalLoginAuthorizationAttribute.cs new file mode 100644 index 0000000000..35b4984dae --- /dev/null +++ b/src/Umbraco.Web/Editors/Filters/DenyLocalLoginAuthorizationAttribute.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; +using System.Web.Http.Controllers; + +namespace Umbraco.Web.Editors.Filters +{ + internal class DenyLocalLoginAuthorizationAttribute : AuthorizeAttribute + { + protected override bool IsAuthorized(HttpActionContext actionContext) + { + return base.IsAuthorized(actionContext); + } + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index e39687bed8..702535ad7a 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -149,6 +149,7 @@ +