diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-01-09 20:45:24 -0800 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2009-01-09 20:45:24 -0800 |
commit | 595f8997d544db90536081479c20c661411b3ead (patch) | |
tree | 2f1b3d5e84b86d5eadee6e6dc7ef84bd8cf6a549 /src | |
parent | a6f2f706640b337f7d9d1b7fc44127e3ba639ae6 (diff) | |
download | DotNetOpenAuth-595f8997d544db90536081479c20c661411b3ead.zip DotNetOpenAuth-595f8997d544db90536081479c20c661411b3ead.tar.gz DotNetOpenAuth-595f8997d544db90536081479c20c661411b3ead.tar.bz2 |
UriIdentifier discovery now preserves the userSuppliedIdentifier in the generated ServiceEndpoints.
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/OpenId/OpenIdXrdsHelper.cs | 8 | ||||
-rw-r--r-- | src/DotNetOpenAuth/OpenId/UriIdentifier.cs | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/DotNetOpenAuth/OpenId/OpenIdXrdsHelper.cs b/src/DotNetOpenAuth/OpenId/OpenIdXrdsHelper.cs index a11c3d1..b8cd802 100644 --- a/src/DotNetOpenAuth/OpenId/OpenIdXrdsHelper.cs +++ b/src/DotNetOpenAuth/OpenId/OpenIdXrdsHelper.cs @@ -39,14 +39,14 @@ namespace DotNetOpenAuth.OpenId { /// <returns> /// A sequence of OpenID Providers that can assert ownership of the <paramref name="claimedIdentifier"/>. /// </returns> - internal static IEnumerable<ServiceEndpoint> CreateServiceEndpoints(this XrdsDocument xrds, UriIdentifier claimedIdentifier) { + internal static IEnumerable<ServiceEndpoint> CreateServiceEndpoints(this XrdsDocument xrds, UriIdentifier claimedIdentifier, UriIdentifier userSuppliedIdentifier) { var endpoints = new List<ServiceEndpoint>(); endpoints.AddRange(xrds.GenerateOPIdentifierServiceEndpoints(claimedIdentifier)); // If any OP Identifier service elements were found, we must not proceed // to return any Claimed Identifier services. if (endpoints.Count == 0) { - endpoints.AddRange(xrds.GenerateClaimedIdentifierServiceEndpoints(claimedIdentifier)); + endpoints.AddRange(xrds.GenerateClaimedIdentifierServiceEndpoints(claimedIdentifier, userSuppliedIdentifier)); } Logger.DebugFormat("Total services discovered in XRDS: {0}", endpoints.Count); Logger.Debug(endpoints.ToStringDeferred(true)); @@ -95,11 +95,11 @@ namespace DotNetOpenAuth.OpenId { /// <param name="xrds">The XrdsDocument instance to use in this process.</param> /// <param name="claimedIdentifier">The claimed identifier.</param> /// <returns>A sequence of the providers that can assert ownership of the given identifier.</returns> - private static IEnumerable<ServiceEndpoint> GenerateClaimedIdentifierServiceEndpoints(this XrdsDocument xrds, UriIdentifier claimedIdentifier) { + private static IEnumerable<ServiceEndpoint> GenerateClaimedIdentifierServiceEndpoints(this XrdsDocument xrds, UriIdentifier claimedIdentifier, UriIdentifier userSuppliedIdentifier) { return from service in xrds.FindClaimedIdentifierServices() from uri in service.UriElements let providerEndpoint = new ProviderEndpointDescription(uri.Uri, service.TypeElementUris) - select ServiceEndpoint.CreateForClaimedIdentifier(claimedIdentifier, service.ProviderLocalIdentifier, providerEndpoint, service.Priority, uri.Priority); + select ServiceEndpoint.CreateForClaimedIdentifier(claimedIdentifier, userSuppliedIdentifier, service.ProviderLocalIdentifier, providerEndpoint, service.Priority, uri.Priority); } /// <summary> diff --git a/src/DotNetOpenAuth/OpenId/UriIdentifier.cs b/src/DotNetOpenAuth/OpenId/UriIdentifier.cs index 4f9e0e4..40d5549 100644 --- a/src/DotNetOpenAuth/OpenId/UriIdentifier.cs +++ b/src/DotNetOpenAuth/OpenId/UriIdentifier.cs @@ -211,7 +211,7 @@ namespace DotNetOpenAuth.OpenId { if (yadisResult != null) { if (yadisResult.IsXrds) { XrdsDocument xrds = new XrdsDocument(yadisResult.ResponseText); - var xrdsEndpoints = xrds.CreateServiceEndpoints(yadisResult.NormalizedUri); + var xrdsEndpoints = xrds.CreateServiceEndpoints(yadisResult.NormalizedUri, this); // Filter out insecure endpoints if high security is required. if (IsDiscoverySecureEndToEnd) { @@ -222,7 +222,7 @@ namespace DotNetOpenAuth.OpenId { // Failing YADIS discovery of an XRDS document, we try HTML discovery. if (endpoints.Count == 0) { - ServiceEndpoint ep = DiscoverFromHtml(yadisResult.NormalizedUri, yadisResult.ResponseText); + ServiceEndpoint ep = DiscoverFromHtml(yadisResult.NormalizedUri, this, yadisResult.ResponseText); if (ep != null) { Logger.Debug("HTML discovery found a service endpoint."); Logger.Debug(ep); @@ -321,7 +321,7 @@ namespace DotNetOpenAuth.OpenId { /// OpenID 2.0 tags are always used if they are present, otherwise /// OpenID 1.x tags are used if present. /// </remarks> - private static ServiceEndpoint DiscoverFromHtml(Uri claimedIdentifier, string html) { + private static ServiceEndpoint DiscoverFromHtml(Uri claimedIdentifier, UriIdentifier userSuppliedIdentifier, string html) { Uri providerEndpoint = null; Protocol discoveredProtocol = null; Identifier providerLocalIdentifier = null; @@ -361,7 +361,7 @@ namespace DotNetOpenAuth.OpenId { // Choose the TypeURI to match the OpenID version detected. string[] typeURIs = { discoveredProtocol.ClaimedIdentifierServiceTypeURI }; var providerDescription = new ProviderEndpointDescription(providerEndpoint, typeURIs); - return ServiceEndpoint.CreateForClaimedIdentifier(claimedIdentifier, providerLocalIdentifier, providerDescription, (int?)null, (int?)null); + return ServiceEndpoint.CreateForClaimedIdentifier(claimedIdentifier, userSuppliedIdentifier, providerLocalIdentifier, providerDescription, (int?)null, (int?)null); } /// <summary> |