1

Have anyone tell the three concepts. I'm a little confused about them. And what are used for explicitly?

public void Should_Return_NotNull_When_Find_User_By_Updated_Email()
{
    var userDao = new UserDaoImpl(_context);
    var accessorMock = new Mock<IHttpContextAccessor>();
    var userClaimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new[]
    {
        new Claim(ClaimTypes.Sid, "1"),
    }, "mock"));
    HttpContext httpContext = new DefaultHttpContext { User = userClaimsPrincipal };
    accessorMock.Setup(accessor => accessor.HttpContext).Returns(httpContext);
    var userService = new UserServiceImpl(userDao,MockConfiguration(), accessorMock.Object);
Lucas
  • 23
  • 4
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 01 '22 at 13:23
  • A ClaimsPrincipal can have many ClaimsIdentity objects. – GH DevOps Dec 01 '22 at 13:26
  • Yeah,thanks, You're right. And a ClaimsIdentity can have many claims, right? but I'm just not sure what it's used for? for example why ClaimTypes.Sid – Lucas Dec 01 '22 at 13:32
  • [answer](https://stackoverflow.com/questions/50120968/extract-values-from-httpcontext-user-claims) – Lucas Dec 01 '22 at 13:45

0 Answers0