Exemple #1
0
        // Token: 0x06000280 RID: 640 RVA: 0x0001142C File Offset: 0x0000F62C
        private static bool RedirectCaller(OperationContext operationContext, string smtpAddress)
        {
            string redirectServer = MServe.GetRedirectServer(smtpAddress);

            if (!string.IsNullOrEmpty(redirectServer))
            {
                return(AutodiscoverAuthorizationManager.BuildRedirectUrlAndRedirectCaller(operationContext, redirectServer));
            }
            string reason = string.Format("No redirection server for Identity: {0}; ", smtpAddress.ToString());

            return(AutodiscoverAuthorizationManager.Return403UnauthorizedResponse(operationContext, reason));
        }
Exemple #2
0
        internal override AutodiscoverResponseMessage Execute()
        {
            GetFederationInformationResponseMessage getFederationInformationResponseMessage = new GetFederationInformationResponseMessage();
            GetFederationInformationResponse        response = getFederationInformationResponseMessage.Response;

            if (this.Request == null || this.Request.Domain == null || !SmtpAddress.IsValidDomain(this.Request.Domain))
            {
                response.ErrorCode    = ErrorCode.InvalidRequest;
                response.ErrorMessage = Strings.InvalidRequest;
            }
            else
            {
                ExternalAuthentication current = ExternalAuthentication.GetCurrent();
                if (!current.Enabled)
                {
                    response.ErrorCode    = ErrorCode.NotFederated;
                    response.ErrorMessage = Strings.NotFederated;
                }
                else
                {
                    IEnumerable <string> enumerable     = null;
                    OrganizationId       organizationId = DomainToOrganizationIdCache.Singleton.Get(new SmtpDomain(this.Request.Domain));
                    if (organizationId != null)
                    {
                        OrganizationIdCacheValue organizationIdCacheValue = OrganizationIdCache.Singleton.Get(organizationId);
                        enumerable = organizationIdCacheValue.FederatedDomains;
                    }
                    else
                    {
                        try
                        {
                            string text = MserveDomainCache.Singleton.Get(this.Request.Domain);
                            if (!string.IsNullOrEmpty(text))
                            {
                                AutodiscoverAuthorizationManager.BuildRedirectUrlAndRedirectCaller(OperationContext.Current, text);
                                return(null);
                            }
                        }
                        catch (OverBudgetException arg)
                        {
                            ExTraceGlobals.FrameworkTracer.TraceError <OverBudgetException>(0L, "GetFederationInformationRequestMessage.Execute() returning ServerBusy for exception: {0}.", arg);
                            response.ErrorCode    = ErrorCode.ServerBusy;
                            response.ErrorMessage = Strings.ServerBusy;
                            return(getFederationInformationResponseMessage);
                        }
                    }
                    if (enumerable == null)
                    {
                        response.ErrorCode    = ErrorCode.InvalidDomain;
                        response.ErrorMessage = Strings.InvalidDomain;
                    }
                    else
                    {
                        List <TokenIssuer>   list = new List <TokenIssuer>(2);
                        SecurityTokenService securityTokenService = current.GetSecurityTokenService(organizationId);
                        if (securityTokenService != null)
                        {
                            list.Add(new TokenIssuer(securityTokenService.TokenIssuerUri, securityTokenService.TokenIssuerEndpoint));
                        }
                        response.ErrorCode      = ErrorCode.NoError;
                        response.ApplicationUri = current.ApplicationUri;
                        response.Domains        = new DomainCollection(enumerable);
                        response.TokenIssuers   = new TokenIssuerCollection(list);
                    }
                }
            }
            return(getFederationInformationResponseMessage);
        }