Ejemplo n.º 1
0
 public Query(TestService testService, IOwinContextAccessor contextAccessor)
 {
     _service = testService
                ?? throw new ArgumentNullException(nameof(testService));
     _contextAccessor = contextAccessor
                        ?? throw new ArgumentNullException(nameof(contextAccessor));
 }
Ejemplo n.º 2
0
 public AccountController(EnhancedApplicationUserManager userManager,
                          IOwinContextAccessor owinContext,
                          IChaufferDbContext _context)
 {
     UserManager  = userManager;
     _owinContext = owinContext;
     context      = _context;
 }
        public AuthorizationHelper(IOwinContextAccessor owinContextAccessor)
        {
            if (owinContextAccessor == null)
            {
                throw new ArgumentNullException(nameof(owinContextAccessor));
            }

            _owinContextAccessor = owinContextAccessor;
        }
Ejemplo n.º 4
0
        public SecurityService(IOwinContextAccessor owinContextAccessor, UserManager <ApplicationUser, long> userManager)
        {
            _signInManager = new Lazy <SignInManager <ApplicationUser, long> >(() =>
            {
                var manager = new SignInManager <ApplicationUser, long>(userManager, owinContextAccessor.CurrentContext.Authentication);

                manager.UserManager.UserValidator = new UserValidator <ApplicationUser, long>(manager.UserManager)
                {
                    AllowOnlyAlphanumericUserNames = false,
                    RequireUniqueEmail             = true
                };
                manager.UserManager.UserTokenProvider = new UserTokenProvider();
                return(manager);
            });
        }
Ejemplo n.º 5
0
 public PrincipalAccessor(IOwinContextAccessor owinContextAccessor, IHubRequestAccessor hubRequestAccessor)
 {
     _owinContextAccessor = owinContextAccessor;
     _hubRequestAccessor  = hubRequestAccessor;
 }
Ejemplo n.º 6
0
 public string GetRequestPath3([Service] IOwinContextAccessor context)
 {
     return(context.OwinContext.Request.Path.Value);
 }
Ejemplo n.º 7
0
 public static int GetCurrentUserId(this IOwinContextAccessor owinContextAccessor)
 {
     return(owinContextAccessor.GetCurrentUserId <int>());
 }
Ejemplo n.º 8
0
 public static T GetCurrentUserId <T>(this IOwinContextAccessor owinContextAccessor)
     where T : IConvertible
 {
     return(owinContextAccessor.OwinContext.Request.User.Identity.GetUserId <T>());
 }
Ejemplo n.º 9
0
 public static IPrincipal GetCurrentUser(this IOwinContextAccessor owinContextAccessor)
 {
     return(owinContextAccessor.OwinContext.Request.User);
 }
Ejemplo n.º 10
0
 public static IAuthenticationManager GetAuthenticationManager(this IOwinContextAccessor owinContextAccessor)
 {
     return(owinContextAccessor.OwinContext.Authentication);
 }
Ejemplo n.º 11
0
 public static UserManager <IdentityUser, int> GetUserManager(this IOwinContextAccessor owinContextAccessor)
 {
     return(owinContextAccessor.OwinContext.Get <ApplicationUserManager>());
 }