123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using Microsoft.AspNetCore.Http;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Claims;
- using System.Text;
- using System.Threading.Tasks;
- using XF.Domain.Authentications;
- namespace Hotline.Application.Tests;
- public class DefaultHttpContextAccessor : IHttpContextAccessor, ISessionContext
- {
- private HttpContext _content = new DefaultHttpContext();
- private HttpContext GetContext()
- {
- var context = new DefaultHttpContext();
- //var openId = new Claim(AppClaimTypes.OpenId, "测试生成的OpenId");
- var id = new ClaimsIdentity("身份");
- //id.AddClaim(openId);
- context.User = new ClaimsPrincipal(id);
- //OpenId = context.User.FindFirstValue(AppClaimTypes.OpenId);
- return context;
- }
- public HttpContext? HttpContext { get => GetContext(); set => _content = value; }
- public string? UserId => throw new NotImplementedException();
- public string RequiredUserId => throw new NotImplementedException();
- public string? UserName => throw new NotImplementedException();
- public string? Phone => throw new NotImplementedException();
- public string[] Roles => throw new NotImplementedException();
- public string? OrgId { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string RequiredOrgId => throw new NotImplementedException();
- public string? OrgName { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public int OrgLevel { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string? OrgAreaCode { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public bool OrgIsCenter { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string? OrgAreaName { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string? AreaId => throw new NotImplementedException();
- public string? ClientId => throw new NotImplementedException();
- public string? StaffNo => throw new NotImplementedException();
- public string? OpenId { get; set; }
- }
|