Exemplo n.º 1
0
        private static EducationSecurityPrincipal CreateEducationSecurityPrincipal(AuthorizationContext filterContext, System.Security.Claims.ClaimsPrincipal claimsPrincipal)
        {
            System.Security.Claims.ClaimsIdentity claimsIdentity = (System.Security.Claims.ClaimsIdentity)claimsPrincipal.Identity;
            IAccountManager            manager    = DependencyResolver.Current.GetService <IAccountManager>();
            User                       userEntity = manager.EnsureUserEntity(claimsIdentity);
            EducationSecurityIdentity  identity   = new EducationSecurityIdentity(claimsIdentity, userEntity);
            EducationSecurityPrincipal principal  = new EducationSecurityPrincipal(identity);

            if (_AuditOnMapCollection.Contains(userEntity.UserKey))
            {
                _AuditOnMapCollection.Remove(userEntity.UserKey);
                manager.AuditLogin(principal);
            }
            if (!(filterContext.RequestContext.RouteData.Values["action"].ToString() == "Index" && filterContext.RequestContext.RouteData.Values["controller"].ToString() == "Agreement"))
            {
                manager.ValidateEulaAccepted(principal.Identity.User);
            }
            return(principal);
        }