Beispiel #1
0
        public static void LogOn(IIdentity identity)
        {
            OfaIdentity  customIdentity  = OfaIdentity.GetIdentity(identity);
            OfaPrincipal customPrincipal = new OfaPrincipal(customIdentity);

            SetPrincipal(customPrincipal);
        }
Beispiel #2
0
        public static void SetPrincipal(OfaPrincipal principal)
        {
            if (principal != null && principal.Identity.IsAuthenticated)
            {
                //if (HttpContext.Current != null)
                //{
                //	HttpContext.Current.User = principal;
                //}

                Thread.CurrentPrincipal = principal;
            }
        }
        public OfaPrincipal GetCachedPrincipal()
        {
            var          principalName = GetPrincipalName(GetPrincipal());
            OfaPrincipal principal     = null;

            _cache.TryGetValue(CACHE_KEY, out string cacheValue);

            if (cacheValue.Contains(principalName))
            {
                principal = (OfaPrincipal)_cache.Get(principalName);
            }

            return(principal);
        }