Example #1
0
        public static NspiPrincipal FromUserSid(SecurityIdentifier sid, string userDomain)
        {
            NspiPrincipal principal = null;

            if (!string.IsNullOrEmpty(userDomain))
            {
                MiniRecipient miniRecipient = NspiPrincipal.FindMiniRecipientBySid(ADSessionSettings.RootOrgOrSingleTenantFromAcceptedDomainAutoDetect(userDomain), sid);
                if (miniRecipient != null)
                {
                    principal = new NspiPrincipal(miniRecipient);
                }
            }
            else if (Configuration.IsDatacenter)
            {
                ExTraceGlobals.NspiTracer.TraceWarning <SecurityIdentifier>(0L, "We have to do a fan out query for user {0} because of legacy client.", sid);
                DirectoryHelper.DoAdCallAndTranslateExceptions(delegate
                {
                    MiniRecipient miniRecipientFromUserId = PartitionDataAggregator.GetMiniRecipientFromUserId(sid);
                    if (miniRecipientFromUserId != null)
                    {
                        principal = new NspiPrincipal(miniRecipientFromUserId);
                    }
                }, "ADAccountPartitionLocator::GetAllAccountPartitionIds");
            }
            else
            {
                principal = NspiPrincipal.FromUserSid(ADSessionSettings.FromRootOrgScopeSet(), sid);
            }
            return(principal ?? new NspiPrincipal(sid));
        }
Example #2
0
        public static NspiPrincipal FromUserSid(ADSessionSettings sessionSettings, SecurityIdentifier sid)
        {
            MiniRecipient miniRecipient = NspiPrincipal.FindMiniRecipientBySid(sessionSettings, sid);

            if (miniRecipient != null)
            {
                return(new NspiPrincipal(miniRecipient));
            }
            return(new NspiPrincipal(sid));
        }