Merge remote-tracking branch 'origin/netcore/netcore' into netcore/task/6666-auth-policies

This commit is contained in:
Bjarke Berg
2020-11-26 11:59:36 +01:00
21 changed files with 453 additions and 177 deletions

View File

@@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Core;
using Umbraco.Core.Cache;
@@ -214,7 +213,7 @@ namespace Umbraco.Extensions
// /// <param name="htmlHelper"></param>
// /// <param name="actionName"></param>
// /// <returns></returns>
// public static IHtmlContent Action<T>(this HtmlHelper htmlHelper, string actionName)
// public static IHtmlContent Action<T>(this IHtmlHelper htmlHelper, string actionName)
// where T : SurfaceController
// {
// return htmlHelper.Action(actionName, typeof(T));
@@ -274,7 +273,6 @@ namespace Umbraco.Extensions
/// <param name="controllerName"></param>
/// <param name="controllerAction"></param>
/// <param name="area"></param>
/// <param name="method"></param>
/// <param name="additionalRouteVals"></param>
public UmbracoForm(
ViewContext viewContext,
@@ -282,19 +280,15 @@ namespace Umbraco.Extensions
string controllerName,
string controllerAction,
string area,
FormMethod method,
object additionalRouteVals = null)
: base(viewContext, htmlEncoder)
{
_viewContext = viewContext;
_method = method;
_controllerName = controllerName;
_encryptedString = EncryptionHelper.CreateEncryptedRouteString(GetRequiredService<IDataProtectionProvider>(viewContext), controllerName, controllerAction, area, additionalRouteVals);
}
private readonly ViewContext _viewContext;
private readonly FormMethod _method;
private bool _disposed;
private readonly string _encryptedString;
private readonly string _controllerName;
@@ -330,7 +324,7 @@ namespace Umbraco.Extensions
/// <param name="controllerName">Name of the controller.</param>
/// <param name="method">The method.</param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, FormMethod method)
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName, FormMethod method)
{
return html.BeginUmbracoForm(action, controllerName, null, new Dictionary<string, object>(), method);
}
@@ -342,7 +336,7 @@ namespace Umbraco.Extensions
/// <param name="action"></param>
/// <param name="controllerName"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName)
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName)
{
return html.BeginUmbracoForm(action, controllerName, null, new Dictionary<string, object>());
}
@@ -356,7 +350,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, object additionalRouteVals, FormMethod method)
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName, object additionalRouteVals, FormMethod method)
{
return html.BeginUmbracoForm(action, controllerName, additionalRouteVals, new Dictionary<string, object>(), method);
}
@@ -369,7 +363,7 @@ namespace Umbraco.Extensions
/// <param name="controllerName"></param>
/// <param name="additionalRouteVals"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, object additionalRouteVals)
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName, object additionalRouteVals)
{
return html.BeginUmbracoForm(action, controllerName, additionalRouteVals, new Dictionary<string, object>());
}
@@ -384,7 +378,7 @@ namespace Umbraco.Extensions
/// <param name="htmlAttributes"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName,
object additionalRouteVals,
object htmlAttributes,
FormMethod method)
@@ -401,7 +395,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="htmlAttributes"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName,
object additionalRouteVals,
object htmlAttributes)
{
@@ -418,7 +412,7 @@ namespace Umbraco.Extensions
/// <param name="htmlAttributes"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName,
object additionalRouteVals,
IDictionary<string, object> htmlAttributes,
FormMethod method)
@@ -440,7 +434,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="htmlAttributes"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName,
object additionalRouteVals,
IDictionary<string, object> htmlAttributes)
{
@@ -460,7 +454,7 @@ namespace Umbraco.Extensions
/// <param name="surfaceType">The surface controller to route to</param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType, FormMethod method)
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, Type surfaceType, FormMethod method)
{
return html.BeginUmbracoForm(action, surfaceType, null, new Dictionary<string, object>(), method);
}
@@ -472,7 +466,7 @@ namespace Umbraco.Extensions
/// <param name="action"></param>
/// <param name="surfaceType">The surface controller to route to</param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType)
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, Type surfaceType)
{
return html.BeginUmbracoForm(action, surfaceType, null, new Dictionary<string, object>());
}
@@ -485,7 +479,7 @@ namespace Umbraco.Extensions
/// <param name="action"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, FormMethod method)
public static MvcForm BeginUmbracoForm<T>(this IHtmlHelper html, string action, FormMethod method)
where T : SurfaceController
{
return html.BeginUmbracoForm(action, typeof(T), method);
@@ -498,7 +492,7 @@ namespace Umbraco.Extensions
/// <param name="html"></param>
/// <param name="action"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action)
public static MvcForm BeginUmbracoForm<T>(this IHtmlHelper html, string action)
where T : SurfaceController
{
return html.BeginUmbracoForm(action, typeof(T));
@@ -513,7 +507,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, Type surfaceType,
object additionalRouteVals, FormMethod method)
{
return html.BeginUmbracoForm(action, surfaceType, additionalRouteVals, new Dictionary<string, object>(), method);
@@ -527,7 +521,7 @@ namespace Umbraco.Extensions
/// <param name="surfaceType">The surface controller to route to</param>
/// <param name="additionalRouteVals"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, Type surfaceType,
object additionalRouteVals)
{
return html.BeginUmbracoForm(action, surfaceType, additionalRouteVals, new Dictionary<string, object>());
@@ -542,7 +536,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, object additionalRouteVals, FormMethod method)
public static MvcForm BeginUmbracoForm<T>(this IHtmlHelper html, string action, object additionalRouteVals, FormMethod method)
where T : SurfaceController
{
return html.BeginUmbracoForm(action, typeof(T), additionalRouteVals, method);
@@ -556,7 +550,7 @@ namespace Umbraco.Extensions
/// <param name="action"></param>
/// <param name="additionalRouteVals"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action, object additionalRouteVals)
public static MvcForm BeginUmbracoForm<T>(this IHtmlHelper html, string action, object additionalRouteVals)
where T : SurfaceController
{
return html.BeginUmbracoForm(action, typeof(T), additionalRouteVals);
@@ -572,7 +566,7 @@ namespace Umbraco.Extensions
/// <param name="htmlAttributes"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, Type surfaceType,
object additionalRouteVals,
object htmlAttributes,
FormMethod method)
@@ -589,7 +583,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="htmlAttributes"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, Type surfaceType,
object additionalRouteVals,
object htmlAttributes)
{
@@ -606,7 +600,7 @@ namespace Umbraco.Extensions
/// <param name="htmlAttributes"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action,
public static MvcForm BeginUmbracoForm<T>(this IHtmlHelper html, string action,
object additionalRouteVals,
object htmlAttributes,
FormMethod method)
@@ -624,7 +618,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="htmlAttributes"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action,
public static MvcForm BeginUmbracoForm<T>(this IHtmlHelper html, string action,
object additionalRouteVals,
object htmlAttributes)
where T : SurfaceController
@@ -642,7 +636,7 @@ namespace Umbraco.Extensions
/// <param name="htmlAttributes"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, Type surfaceType,
object additionalRouteVals,
IDictionary<string, object> htmlAttributes,
FormMethod method)
@@ -652,18 +646,19 @@ namespace Umbraco.Extensions
if (string.IsNullOrWhiteSpace(action)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(action));
if (surfaceType == null) throw new ArgumentNullException(nameof(surfaceType));
var area = "";
var surfaceControllerTypeCollection = GetRequiredService<SurfaceControllerTypeCollection>(html);
var surfaceController = surfaceControllerTypeCollection.SingleOrDefault(x => x == surfaceType);
if (surfaceController == null)
throw new InvalidOperationException("Could not find the surface controller of type " + surfaceType.FullName);
var metaData = PluginController.GetMetadata(surfaceController);
var area = string.Empty;
if (metaData.AreaName.IsNullOrWhiteSpace() == false)
{
//set the area to the plugin area
// Set the area to the plugin area
area = metaData.AreaName;
}
return html.BeginUmbracoForm(action, metaData.ControllerName, area, additionalRouteVals, htmlAttributes, method);
}
@@ -676,7 +671,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="htmlAttributes"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, Type surfaceType,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, Type surfaceType,
object additionalRouteVals,
IDictionary<string, object> htmlAttributes)
{
@@ -693,7 +688,7 @@ namespace Umbraco.Extensions
/// <param name="htmlAttributes"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action,
public static MvcForm BeginUmbracoForm<T>(this IHtmlHelper html, string action,
object additionalRouteVals,
IDictionary<string, object> htmlAttributes,
FormMethod method)
@@ -711,7 +706,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="htmlAttributes"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm<T>(this HtmlHelper html, string action,
public static MvcForm BeginUmbracoForm<T>(this IHtmlHelper html, string action,
object additionalRouteVals,
IDictionary<string, object> htmlAttributes)
where T : SurfaceController
@@ -728,7 +723,7 @@ namespace Umbraco.Extensions
/// <param name="area"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, string area, FormMethod method)
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName, string area, FormMethod method)
{
return html.BeginUmbracoForm(action, controllerName, area, null, new Dictionary<string, object>(), method);
}
@@ -741,7 +736,7 @@ namespace Umbraco.Extensions
/// <param name="controllerName"></param>
/// <param name="area"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, string area)
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName, string area)
{
return html.BeginUmbracoForm(action, controllerName, area, null, new Dictionary<string, object>());
}
@@ -757,7 +752,7 @@ namespace Umbraco.Extensions
/// <param name="htmlAttributes"></param>
/// <param name="method"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, string area,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName, string area,
object additionalRouteVals,
IDictionary<string, object> htmlAttributes,
FormMethod method)
@@ -782,7 +777,7 @@ namespace Umbraco.Extensions
/// <param name="additionalRouteVals"></param>
/// <param name="htmlAttributes"></param>
/// <returns></returns>
public static MvcForm BeginUmbracoForm(this HtmlHelper html, string action, string controllerName, string area,
public static MvcForm BeginUmbracoForm(this IHtmlHelper html, string action, string controllerName, string area,
object additionalRouteVals,
IDictionary<string, object> htmlAttributes)
{
@@ -804,7 +799,7 @@ namespace Umbraco.Extensions
/// <remarks>
/// This code is pretty much the same as the underlying MVC code that writes out the form
/// </remarks>
private static MvcForm RenderForm(this HtmlHelper htmlHelper,
private static MvcForm RenderForm(this IHtmlHelper htmlHelper,
string formAction,
FormMethod method,
IDictionary<string, object> htmlAttributes,
@@ -837,12 +832,13 @@ namespace Umbraco.Extensions
var htmlEncoder = GetRequiredService<HtmlEncoder>(htmlHelper);
//new UmbracoForm:
var theForm = new UmbracoForm(htmlHelper.ViewContext, htmlEncoder, surfaceController, surfaceAction, area, method, additionalRouteVals);
var theForm = new UmbracoForm(htmlHelper.ViewContext, htmlEncoder, surfaceController, surfaceAction, area, additionalRouteVals);
if (traditionalJavascriptEnabled)
{
htmlHelper.ViewContext.FormContext.FormData["FormId"] = tagBuilder.Attributes["id"];
}
return theForm;
}
@@ -859,7 +855,7 @@ namespace Umbraco.Extensions
/// <returns>
/// The HTML encoded value.
/// </returns>
public static IHtmlContent If(this HtmlHelper html, bool test, string valueIfTrue)
public static IHtmlContent If(this IHtmlHelper html, bool test, string valueIfTrue)
{
return If(html, test, valueIfTrue, string.Empty);
}
@@ -874,7 +870,7 @@ namespace Umbraco.Extensions
/// <returns>
/// The HTML encoded value.
/// </returns>
public static IHtmlContent If(this HtmlHelper html, bool test, string valueIfTrue, string valueIfFalse)
public static IHtmlContent If(this IHtmlHelper html, bool test, string valueIfTrue, string valueIfFalse)
{
return new HtmlString(HttpUtility.HtmlEncode(test ? valueIfTrue : valueIfFalse));
}

View File

@@ -4,7 +4,6 @@ using Umbraco.Core.Composing;
using Umbraco.Web.Common.Controllers;
using Umbraco.Web.Website.Controllers;
namespace Umbraco.Extensions
{
/// <summary>

View File

@@ -1,32 +1,173 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Security;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.Web.Models;
namespace Umbraco.Web.Website.Security
{
public class UmbracoWebsiteSecurity : IUmbracoWebsiteSecurity
{
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IMemberService _memberService;
private readonly IMemberTypeService _memberTypeService;
private readonly IShortStringHelper _shortStringHelper;
public UmbracoWebsiteSecurity(IHttpContextAccessor httpContextAccessor)
public UmbracoWebsiteSecurity(IHttpContextAccessor httpContextAccessor,
IMemberService memberService,
IMemberTypeService memberTypeService,
IShortStringHelper shortStringHelper)
{
_httpContextAccessor = httpContextAccessor;
_memberService = memberService;
_memberTypeService = memberTypeService;
_shortStringHelper = shortStringHelper;
}
/// <inheritdoc/>
public RegisterModel CreateRegistrationModel(string memberTypeAlias = null)
{
var providedOrDefaultMemberTypeAlias = memberTypeAlias ?? Constants.Conventions.MemberTypes.DefaultAlias;
var memberType = _memberTypeService.Get(providedOrDefaultMemberTypeAlias);
if (memberType == null)
{
throw new InvalidOperationException($"Could not find a member type with alias: {providedOrDefaultMemberTypeAlias}.");
}
var model = RegisterModel.CreateModel();
model.MemberTypeAlias = providedOrDefaultMemberTypeAlias;
model.MemberProperties = GetMemberPropertiesViewModel(memberType);
return model;
}
private List<UmbracoProperty> GetMemberPropertiesViewModel(IMemberType memberType, IMember member = null)
{
var viewProperties = new List<UmbracoProperty>();
var builtIns = ConventionsHelper.GetStandardPropertyTypeStubs(_shortStringHelper).Select(x => x.Key).ToArray();
var propertyTypes = memberType.PropertyTypes
.Where(x => builtIns.Contains(x.Alias) == false && memberType.MemberCanEditProperty(x.Alias))
.OrderBy(p => p.SortOrder);
foreach (var prop in propertyTypes)
{
var value = string.Empty;
if (member != null)
{
var propValue = member.Properties[prop.Alias];
if (propValue != null && propValue.GetValue() != null)
{
value = propValue.GetValue().ToString();
}
}
var viewProperty = new UmbracoProperty
{
Alias = prop.Alias,
Name = prop.Name,
Value = value
};
// TODO: Perhaps one day we'll ship with our own EditorTempates but for now developers
// can just render their own.
////This is a rudimentary check to see what data template we should render
//// if developers want to change the template they can do so dynamically in their views or controllers
//// for a given property.
////These are the default built-in MVC template types: “Boolean”, “Decimal”, “EmailAddress”, “HiddenInput”, “HTML”, “Object”, “String”, “Text”, and “Url”
//// by default we'll render a text box since we've defined that metadata on the UmbracoProperty.Value property directly.
//if (prop.DataTypeId == new Guid(Constants.PropertyEditors.TrueFalse))
//{
// viewProperty.EditorTemplate = "UmbracoBoolean";
//}
//else
//{
// switch (prop.DataTypeDatabaseType)
// {
// case DataTypeDatabaseType.Integer:
// viewProperty.EditorTemplate = "Decimal";
// break;
// case DataTypeDatabaseType.Ntext:
// viewProperty.EditorTemplate = "Text";
// break;
// case DataTypeDatabaseType.Date:
// case DataTypeDatabaseType.Nvarchar:
// break;
// }
//}
viewProperties.Add(viewProperty);
}
return viewProperties;
}
public Task<RegisterMemberStatus> RegisterMemberAsync(RegisterModel model, bool logMemberIn = true)
{
throw new System.NotImplementedException();
}
/// <inheritdoc/>
public async Task<ProfileModel> GetCurrentMemberProfileModelAsync()
{
if (IsLoggedIn() == false)
{
return null;
}
var member = GetCurrentPersistedMember();
// This shouldn't happen but will if the member is deleted in the back office while the member is trying
// to use the front-end!
if (member == null)
{
// Log them out since they've been removed
await LogOutAsync();
return null;
}
var model = new ProfileModel
{
Name = member.Name,
MemberTypeAlias = member.ContentTypeAlias,
// TODO: get ASP.NET Core Identity equiavlant of MemberShipUser in order to get common membership properties such as Email
// and UserName (see MembershipProviderExtensions.GetCurrentUserName()for legacy membership provider implementation).
//Email = membershipUser.Email,
//UserName = membershipUser.UserName,
//Comment = membershipUser.Comment,
//IsApproved = membershipUser.IsApproved,
//IsLockedOut = membershipUser.IsLockedOut,
//LastLockoutDate = membershipUser.LastLockoutDate,
//CreationDate = membershipUser.CreationDate,
//LastLoginDate = membershipUser.LastLoginDate,
//LastActivityDate = membershipUser.LastActivityDate,
//LastPasswordChangedDate = membershipUser.LastPasswordChangedDate
};
var memberType = _memberTypeService.Get(member.ContentTypeId);
model.MemberProperties = GetMemberPropertiesViewModel(memberType, member);
return model;
}
/// <inheritdoc/>
public Task<UpdateMemberProfileResult> UpdateMemberProfileAsync(ProfileModel model)
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}
/// <inheritdoc/>
@@ -36,10 +177,55 @@ namespace Umbraco.Web.Website.Security
return httpContext?.User != null && httpContext.User.Identity.IsAuthenticated;
}
/// <inheritdoc/>
public async Task<LoginStatusModel> GetCurrentLoginStatusAsync()
{
var model = LoginStatusModel.CreateModel();
if (IsLoggedIn() == false)
{
model.IsLoggedIn = false;
return model;
}
var member = GetCurrentPersistedMember();
// This shouldn't happen but will if the member is deleted in the back office while the member is trying
// to use the front-end!
if (member == null)
{
// Log them out since they've been removed.
await LogOutAsync();
model.IsLoggedIn = false;
return model;
}
model.Name = member.Name;
model.Username = member.Username;
model.Email = member.Email;
model.IsLoggedIn = true;
return model;
}
/// <summary>
/// Returns the currently logged in IMember object - this should never be exposed to the front-end since it's returning a business logic entity!
/// </summary>
/// <returns></returns>
private IMember GetCurrentPersistedMember()
{
// TODO: get user name from ASP.NET Core Identity (see MembershipProviderExtensions.GetCurrentUserName()
// for legacy membership provider implementation).
var username = "";
// The result of this is cached by the MemberRepository
return _memberService.GetByUsername(username);
}
/// <inheritdoc/>
public Task<bool> LoginAsync(string username, string password)
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}
/// <inheritdoc/>
@@ -51,7 +237,7 @@ namespace Umbraco.Web.Website.Security
/// <inheritdoc/>
public bool IsMemberAuthorized(IEnumerable<string> allowTypes = null, IEnumerable<string> allowGroups = null, IEnumerable<int> allowMembers = null)
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}
}
}