Exemplo n.º 1
0
        public void Invoke()
        {
            if (_context.IsAuthenticated())
            {
                InnerBehavior.Invoke();
            }

            _failure.Handle();
        }
Exemplo n.º 2
0
        public void AttachPrincipal()
        {
            if (!_context.IsAuthenticated())
            {
                return;
            }

            IIdentity identity = _context.CurrentIdentity;

            _context.CurrentUser = _factory.CreatePrincipal(identity);
        }
Exemplo n.º 3
0
        public ChangePasswordModel Get(ChangePasswordRequest request)
        {
            if (!_securityContext.IsAuthenticated())
            {
                throw new HttpException(403, "Must be signed in to change password");
            }


            return(new ChangePasswordModel()
            {
                UserName = _securityContext.CurrentUser.Identity.Name
            });
        }
Exemplo n.º 4
0
        public LoginStatusViewModel Get(LoginStatusRequest request)
        {
            if (_securityContext.IsAuthenticated())
            {
                return(new LoginStatusViewModel()
                {
                    IsAuthenticated = true,
                    UserName = _securityContext.CurrentUser.Identity.Name,
                    RawUrl = _urlRegistry.UrlFor(new LogoffRequest())
                });
            }

            return(new LoginStatusViewModel()
            {
                IsAuthenticated = false,
                UserName = "",
                RawUrl = _urlRegistry.UrlFor(new LoginRequest()
                {
                    ReturnUrl = "/"
                })
            });
        }
 public bool RequiresAuthentication(ISecurityContext securityContext)
 {
     return securityContext.RequiresAuthentication() && securityContext.IsAuthenticated();
 }
Exemplo n.º 6
0
 public bool ShouldExecute()
 {
     return(_securityContext.IsAuthenticated());
 }
Exemplo n.º 7
0
 public bool RequiresAuthentication(ISecurityContext securityContext)
 {
     return(securityContext.RequiresAuthentication() && securityContext.IsAuthenticated());
 }
Exemplo n.º 8
0
 public AuthorizationRight RightsFor(IFubuRequest request)
 {
     return(_securityContext.IsAuthenticated()
         ? AuthorizationRight.Allow
         : AuthorizationRight.Deny);
 }