2020-11-30 00:45:38 +00:00
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using NUnit.Framework;
|
2021-02-22 20:55:12 +00:00
|
|
|
using Umbraco.Cms.Core.DependencyInjection;
|
2021-02-23 09:05:06 +01:00
|
|
|
using Umbraco.Cms.Core.Security;
|
2021-02-22 20:55:12 +00:00
|
|
|
using Umbraco.Cms.Tests.Integration.Testing;
|
|
|
|
|
using Umbraco.Extensions;
|
2020-11-30 00:45:38 +00:00
|
|
|
|
2021-02-14 12:57:48 +00:00
|
|
|
namespace Umbraco.Tests.Integration.Umbraco.Web.Common
|
2020-11-30 00:45:38 +00:00
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2020-12-08 02:07:27 +00:00
|
|
|
public class MembersServiceCollectionExtensionsTests : UmbracoIntegrationTest
|
2020-11-30 00:45:38 +00:00
|
|
|
{
|
Implements Public Access in netcore (#10137)
* Getting new netcore PublicAccessChecker in place
* Adds full test coverage for PublicAccessChecker
* remove PublicAccessComposer
* adjust namespaces, ensure RoleManager works, separate public access controller, reduce content controller
* Implements the required methods on IMemberManager, removes old migrated code
* Updates routing to be able to re-route, Fixes middleware ordering ensuring endpoints are last, refactors pipeline options, adds public access middleware, ensures public access follows all hops
* adds note
* adds note
* Cleans up ext methods, ensures that members identity is added on both front-end and back ends. updates how UmbracoApplicationBuilder works in that it explicitly starts endpoints at the time of calling.
* Changes name to IUmbracoEndpointBuilder
* adds note
* Fixing tests, fixing error describers so there's 2x one for back office, one for members, fixes TryConvertTo, fixes login redirect
* fixing build
* Fixes keepalive, fixes PublicAccessMiddleware to not throw, updates startup code to be more clear and removes magic that registers middleware.
* adds note
* removes unused filter, fixes build
* fixes WebPath and tests
* Looks up entities in one query
* remove usings
* Fix test, remove stylesheet
* Set status code before we write to response to avoid error
* Ensures that users and members are validated when logging in. Shares more code between users and members.
* Fixes RepositoryCacheKeys to ensure the keys are normalized
* oops didn't mean to commit this
* Fix casing issues with caching, stop boxing value types for all cache operations, stop re-creating string keys in DefaultRepositoryCachePolicy
* bah, far out this keeps getting recommitted. sorry
Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2021-04-20 15:11:45 +10:00
|
|
|
protected override void CustomTestSetup(IUmbracoBuilder builder) => builder.AddMembersIdentity();
|
2021-01-04 17:04:05 +00:00
|
|
|
|
2020-11-30 00:45:38 +00:00
|
|
|
[Test]
|
2020-12-09 09:53:34 +00:00
|
|
|
public void AddMembersIdentity_ExpectMembersUserStoreResolvable()
|
2020-11-30 00:45:38 +00:00
|
|
|
{
|
2021-03-04 17:29:11 +00:00
|
|
|
IUserStore<MemberIdentityUser> userStore = Services.GetService<IUserStore<MemberIdentityUser>>();
|
2020-11-30 00:45:38 +00:00
|
|
|
|
|
|
|
|
Assert.IsNotNull(userStore);
|
2021-03-04 17:29:11 +00:00
|
|
|
Assert.AreEqual(typeof(MemberUserStore), userStore.GetType());
|
2020-11-30 00:45:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2020-12-08 02:07:27 +00:00
|
|
|
public void AddMembersIdentity_ExpectMembersUserManagerResolvable()
|
2020-11-30 00:45:38 +00:00
|
|
|
{
|
2021-02-12 14:38:20 +00:00
|
|
|
IMemberManager userManager = Services.GetService<IMemberManager>();
|
2020-11-30 00:45:38 +00:00
|
|
|
|
|
|
|
|
Assert.NotNull(userManager);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|