protected override Scope GetScope(IClaimsPrincipal principal, RequestSecurityToken request) { this.scopeModel = this.ValidateAppliesTo(request.AppliesTo); var scope = new Scope(request.AppliesTo.Uri.OriginalString, SecurityTokenServiceConfiguration.SigningCredentials); scope.TokenEncryptionRequired = false; string replyTo; if (!string.IsNullOrEmpty(request.ReplyTo)) { replyTo = request.ReplyTo; } else if (this.scopeModel.Url != null) { replyTo = this.scopeModel.Url.ToString(); } else { replyTo = scope.AppliesToAddress; } scope.ReplyToAddress = replyTo; return scope; }
protected override Scope GetScope(IClaimsPrincipal principal, RequestSecurityToken request) { this.scopeModel = this.ValidateAppliesTo(request.AppliesTo); var scope = new Scope(request.AppliesTo.Uri.OriginalString, SecurityTokenServiceConfiguration.SigningCredentials); scope.TokenEncryptionRequired = false; string replyTo; if (!string.IsNullOrEmpty(request.ReplyTo)) { replyTo = request.ReplyTo; } else if (this.scopeModel.Url != null) { replyTo = this.scopeModel.Url.ToString(); } else { replyTo = scope.AppliesToAddress; } scope.ReplyToAddress = replyTo; return(scope); }
protected override Scope GetScope(ClaimsPrincipal principal, RequestSecurityToken request) { this.scopeModel = this.ValidateAppliesTo(new EndpointAddress(request.AppliesTo.Uri)); var scope = new Scope(request.AppliesTo.Uri.OriginalString, SecurityTokenServiceConfiguration.SigningCredentials); scope.TokenEncryptionRequired = false; string replyTo; if (!string.IsNullOrEmpty(request.ReplyTo)) { replyTo = request.ReplyTo; if (ConfigurationManager.AppSettings.GetBoolSetting("UseRelativeConfiguration")) { var uri = new Uri(replyTo); if (uri.IsAbsoluteUri) { replyTo = new Uri(uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped)).MakeRelativeUri(uri).ToString(); } } } else if (scopeModel.Url != null) { replyTo = scopeModel.Url.ToString(); if (ConfigurationManager.AppSettings.GetBoolSetting("UseRelativeConfiguration")) { replyTo = new Uri( new Uri(HttpContext.Current.Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped)), new Uri(scopeModel.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped)) .MakeRelativeUri ( scopeModel.Url)).ToString(); } } else { replyTo = scope.AppliesToAddress; } scope.ReplyToAddress = replyTo; return scope; }
protected override Scope GetScope(ClaimsPrincipal principal, RequestSecurityToken request) { scopeModel = ValidateAppliesTo(new EndpointAddress(request.AppliesTo.Uri)); var scope = new Scope(request.AppliesTo.Uri.OriginalString, SecurityTokenServiceConfiguration.SigningCredentials) { TokenEncryptionRequired = false }; string replyTo; if (!string.IsNullOrEmpty(request.ReplyTo)) { replyTo = request.ReplyTo; } else if (scopeModel.Url != null) { replyTo = scopeModel.Url.ToString(); if (scopeModel.UseRelativeUri) { replyTo = new Uri( new Uri(HttpContext.Current.Request.UrlConsideringLoadBalancerHeaders().GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped)), new Uri(scopeModel.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped)) .MakeRelativeUri ( scopeModel.Url)).ToString(); } } else { replyTo = scope.AppliesToAddress; } scope.ReplyToAddress = replyTo; return(scope); }