Esempio n. 1
0
        public void Login(IAuthenticationToken token)
        {
            var subject = SecurityManager.Login(this, token);

            string host = null;
            IPrincipalCollection principals;

            if (subject is DelegatingSubject)
            {
                DelegatingSubject delegating = (DelegatingSubject)subject;
                host       = delegating.Host;
                principals = delegating.Principals;
            }
            else
            {
                principals = subject.Principals;
            }

            if (principals == null || principals.Count == 0)
            {
                throw new InvalidSubjectException(Properties.Resources.NullOrEmptyPrincipalsAfterLoginMessage);
            }

            Principals    = principals;
            Authenticated = true;
            if (token is IHostAuthenticationToken)
            {
                host = ((IHostAuthenticationToken)token).Host;
            }
            if (host != null)
            {
                Host = host;
            }

            var session = subject.GetSession(false);

            if (session == null)
            {
                _session = null;
            }
            else
            {
                _session = Decorate(session);
            }

            ThreadContext.Subject = this;
        }
Esempio n. 2
0
 public StoppingAwareProxiedSession(ISession session, DelegatingSubject owningSubject)
     : base(session)
 {
     _owningSubject = owningSubject;
 }
Esempio n. 3
0
 public StoppingAwareProxiedSession(ISession session, DelegatingSubject owningSubject)
     : base(session)
 {
     _owningSubject = owningSubject;
 }