Пример #1
0
        public void SetUp()
        {
            var config = new Mock <IConfiguration>();

            config.SetupGet(c => c["SETTINGS:MANAGE_BACKEND:SECRET"]).Returns("SETTINGS:MANAGE_BACKEND:SECRET");

            var _mcConfig = new McConfig(config.Object);

            _httpContextAccessor = new Mock <IHttpContextAccessor>();
            var claims = new List <Claim>()
            {
                new Claim(ClaimTypes.NameIdentifier, "manage_courses_api"),
                new Claim(ClaimTypes.Email, "*****@*****.**")
            };

            var identity = new ClaimsIdentity(
                claims,
                BearerTokenDefaults.AuthenticationScheme
                );

            _httpContextAccessor.Setup(x => x.HttpContext.User.Identity).Returns(identity);

            _manageCoursesBackendJwtService = new ManageCoursesBackendJwtService(_httpContextAccessor.Object, _mcConfig);
        }
Пример #2
0
 public ManageCoursesBackendService(HttpClient httpClient, IManageCoursesBackendJwtService manageCoursesBackendJwtService)
 {
     _httpClient = httpClient;
     _manageCoursesBackendJwtService = manageCoursesBackendJwtService;
 }