mirror of https://github.com/abpframework/eventhub
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
using System.Collections.Generic;
|
|
using System.Security.Claims;
|
|
using Volo.Abp.DependencyInjection;
|
|
using Volo.Abp.Security.Claims;
|
|
|
|
namespace EventHub.Security
|
|
{
|
|
[Dependency(ReplaceServices = true)]
|
|
public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor
|
|
{
|
|
private readonly EventHubTestData _eventHubTestData;
|
|
|
|
public FakeCurrentPrincipalAccessor(EventHubTestData eventHubTestData)
|
|
{
|
|
_eventHubTestData = eventHubTestData;
|
|
}
|
|
|
|
protected override ClaimsPrincipal GetClaimsPrincipal()
|
|
{
|
|
return GetPrincipal();
|
|
}
|
|
|
|
private ClaimsPrincipal GetPrincipal()
|
|
{
|
|
return new ClaimsPrincipal(
|
|
new ClaimsIdentity(
|
|
new List<Claim>
|
|
{
|
|
new Claim(AbpClaimTypes.UserId,_eventHubTestData.UserAdminId.ToString()),
|
|
new Claim(AbpClaimTypes.UserName,_eventHubTestData.UserAdminUserName),
|
|
new Claim(AbpClaimTypes.Email,"admin@abp.io")
|
|
}
|
|
)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|