// Token: 0x06000676 RID: 1654 RVA: 0x000136BC File Offset: 0x000118BC
        public static OwaCompositeIdentity CreateFromCompositeIdentity(CompositeIdentity compositeIdentity)
        {
            if (compositeIdentity == null)
            {
                throw new ArgumentNullException("compositeIdentity", "You must specify the source CompositeIdentity.");
            }
            OwaIdentity owaIdentity = OwaIdentity.GetOwaIdentity(compositeIdentity.PrimaryIdentity);

            if (owaIdentity == null)
            {
                ExTraceGlobals.CoreCallTracer.TraceError(0L, "[OwaIdentity::CreateFromCompositeIdentity] - failed to resolve primary identity.");
                throw new OwaIdentityException("Cannot create security context for the specified composite identity. Failed to resolve the primary identity.");
            }
            OwaIdentity[] array = new OwaIdentity[compositeIdentity.SecondaryIdentitiesCount];
            int           num   = 0;

            foreach (IIdentity identity in compositeIdentity.SecondaryIdentities)
            {
                array[num] = OwaIdentity.GetOwaIdentity(identity);
                if (array[num] == null)
                {
                    ExTraceGlobals.CoreCallTracer.TraceError(0L, string.Format("[OwaIdentity::CreateFromCompositeIdentity] - failed to resolve secondary identity {0}.", num));
                    throw new OwaIdentityException(string.Format("Cannot create security context for the specified composite identity. Failed to resolve a secondary identity {0}.", num));
                }
                num++;
            }
            return(new OwaCompositeIdentity(owaIdentity, array));
        }
Ejemplo n.º 2
0
        protected override void AddProtocolSpecificHeadersToServerRequest(WebHeaderCollection headers)
        {
            IIdentity         identity          = base.HttpContext.User.Identity;
            CompositeIdentity compositeIdentity = base.HttpContext.User.Identity as CompositeIdentity;

            if (compositeIdentity != null)
            {
                identity = compositeIdentity.PrimaryIdentity;
            }
            if (!base.ProxyToDownLevel || identity is OAuthIdentity || identity is OAuthPreAuthIdentity || identity is MSAIdentity)
            {
                ExTraceGlobals.VerboseTracer.TraceDebug((long)this.GetHashCode(), "[OwaProxyRequestHandler::AddProtocolSpecificHeadersToServerRequest]: Skip adding downlevel proxy headers.");
            }
            else
            {
                ExTraceGlobals.VerboseTracer.TraceDebug <string>((long)this.GetHashCode(), "[OwaProxyRequestHandler::AddProtocolSpecificHeadersToServerRequest]: User identity type is {0}.", identity.GetType().FullName);
                headers["X-OWA-ProxySid"] = identity.GetSecurityIdentifier().ToString();
                OwaProxyRequestHandler.AddProxyUriHeader(base.ClientRequest, headers);
                headers["X-OWA-ProxyVersion"] = HttpProxyGlobals.ApplicationVersion;
            }
            if (UrlUtilities.IsCmdWebPart(base.ClientRequest) && !OwaProxyRequestHandler.IsOwa15Url(base.ClientRequest))
            {
                headers["X-OWA-ProxyWebPart"] = "1";
            }
            headers["RPSPUID"]      = (string)base.HttpContext.Items["RPSPUID"];
            headers["RPSOrgIdPUID"] = (string)base.HttpContext.Items["RPSOrgIdPUID"];
            headers["logonLatency"] = (string)base.HttpContext.Items["logonLatency"];
            if (base.IsExplicitSignOn)
            {
                headers["X-OWA-ExplicitLogonUser"] = HttpUtility.UrlDecode(base.ExplicitSignOnAddress);
            }
            base.AddProtocolSpecificHeadersToServerRequest(headers);
        }
Ejemplo n.º 3
0
        protected static OwaIdentity GetOwaIdentity(IIdentity identity)
        {
            CompositeIdentity compositeIdentity = identity as CompositeIdentity;

            if (compositeIdentity != null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[OwaIdentity::ResolveLogonIdentity] - Trying to resolve CompositeIdentity.");
                return(OwaCompositeIdentity.CreateFromCompositeIdentity(compositeIdentity));
            }
            WindowsIdentity windowsIdentity = identity as WindowsIdentity;

            if (windowsIdentity != null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[OwaIdentity::ResolveLogonIdentity] - Trying to resolve WindowsIdentity.");
                if (windowsIdentity.IsAnonymous)
                {
                    ExTraceGlobals.CoreCallTracer.TraceError(0L, "[OwaIdentity::ResolveLogonIdentity] - Windows identity cannot be anonymous.");
                    throw new OwaIdentityException("Cannot create security context for anonymous windows identity.");
                }
                return(OwaWindowsIdentity.CreateFromWindowsIdentity(windowsIdentity));
            }
            else
            {
                LiveIDIdentity liveIDIdentity = identity as LiveIDIdentity;
                if (liveIDIdentity != null)
                {
                    ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[OwaIdentity::ResolveLogonIdentity] - Trying to resolve LiveIDIdentity.");
                    return(OwaClientSecurityContextIdentity.CreateFromLiveIDIdentity(liveIDIdentity));
                }
                WindowsTokenIdentity windowsTokenIdentity = identity as WindowsTokenIdentity;
                if (windowsTokenIdentity != null)
                {
                    ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[OwaIdentity::ResolveLogonIdentity] - Trying to resolve WindowsTokenIdentity.");
                    return(OwaClientSecurityContextIdentity.CreateFromClientSecurityContextIdentity(windowsTokenIdentity));
                }
                OAuthIdentity oauthIdentity = identity as OAuthIdentity;
                if (oauthIdentity != null)
                {
                    ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[OwaIdentity::ResolveLogonIdentity] - Trying to resolve OAuthIdentity.");
                    return(OwaClientSecurityContextIdentity.CreateFromOAuthIdentity(oauthIdentity));
                }
                AdfsIdentity adfsIdentity = identity as AdfsIdentity;
                if (adfsIdentity != null)
                {
                    ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[OwaIdentity::ResolveLogonIdentity] - Trying to resolve AdfsIdentity.");
                    return(OwaClientSecurityContextIdentity.CreateFromAdfsIdentity(identity as AdfsIdentity));
                }
                SidBasedIdentity sidBasedIdentity = identity as SidBasedIdentity;
                if (sidBasedIdentity != null)
                {
                    ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[OwaIdentity::ResolveLogonIdentity] - Trying to resolve SidBasedIdentity.");
                    return(OwaClientSecurityContextIdentity.CreateFromsidBasedIdentity(sidBasedIdentity));
                }
                ExTraceGlobals.CoreCallTracer.TraceError <Type>(0L, "[OwaIdentity::ResolveLogonIdentity] - Cannot resolve unsupported identity type: {0}.", identity.GetType());
                throw new NotSupportedException(string.Format("Unexpected identity type. {0}", identity.GetType()));
            }
        }
Ejemplo n.º 4
0
        public static string GetOriginalIdentitySid(HttpContext httpContext)
        {
            CompositeIdentity  compositeIdentity = httpContext.User.Identity as CompositeIdentity;
            SecurityIdentifier securityIdentifier;

            if (compositeIdentity != null)
            {
                securityIdentifier = compositeIdentity.CanarySid;
            }
            else
            {
                securityIdentifier = httpContext.User.Identity.GetSecurityIdentifier();
            }
            return(securityIdentifier.ToString());
        }
 public override int GetHashCode()
 {
     return(CompositeIdentity.GetHashCode());
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////
 ///
 /// Composite Keys - keep NHibernate happy
 /// See https://nhibernate.info/doc/nhibernate-reference/components.html#components-compositeid section 8.4
 ///
 ////////////////////////////////////////////////////////////////////////////////////////////////
 public override bool Equals(object obj)
 {
     return(CompositeIdentity.Equals((obj as ORMGOGroupRole)?.CompositeIdentity));
 }
Ejemplo n.º 7
0
 protected bool Equals(CompositeIdentity <TId, TSubId> other)
 {
     return(SubID.Equals(other.SubID) && ID.Equals(other.ID));
 }