DotNetOpenAuth.OpenId.Realm.Discover C# (CSharp) Method

Discover() private method

Searches for an XRDS document at the realm URL.
private Discover ( IDirectWebRequestHandler requestHandler, bool allowRedirects ) : DotNetOpenAuth.Xrds.XrdsDocument
requestHandler IDirectWebRequestHandler The mechanism to use for sending HTTP requests.
allowRedirects bool Whether redirects may be followed when discovering the Realm. /// This may be true when creating an unsolicited assertion, but must be /// false when performing return URL verification per 2.0 spec section 9.2.1.
return DotNetOpenAuth.Xrds.XrdsDocument
		internal virtual XrdsDocument Discover(IDirectWebRequestHandler requestHandler, bool allowRedirects) {
			// Attempt YADIS discovery
			DiscoveryResult yadisResult = Yadis.Discover(requestHandler, this.UriWithWildcardChangedToWww, false);
			if (yadisResult != null) {
				// Detect disallowed redirects, since realm discovery never allows them for security.
				ErrorUtilities.VerifyProtocol(allowRedirects || yadisResult.NormalizedUri == yadisResult.RequestUri, OpenIdStrings.RealmCausedRedirectUponDiscovery, yadisResult.RequestUri);
				if (yadisResult.IsXrds) {
					try {
						return new XrdsDocument(yadisResult.ResponseText);
					} catch (XmlException ex) {
						throw ErrorUtilities.Wrap(ex, XrdsStrings.InvalidXRDSDocument);
					}
				}
			}

			return null;
		}