コード例 #1
0
        /// <summary>
        /// Tests equality between this URI and another URI.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            UriIdentifier other = obj as UriIdentifier;

            if (obj != null && other == null && Identifier.EqualityOnStrings)
            { // test hook to enable MockIdentifier comparison
                other = Identifier.Parse(obj.ToString()) as UriIdentifier;
            }
            if (other == null)
            {
                return(false);
            }
            return(this.Uri == other.Uri);
        }
コード例 #2
0
        /// <summary>
        /// Creates the service endpoints described in this document, useful for requesting
        /// authentication of one of the OpenID Providers that result from it.
        /// </summary>
        /// <param name="xrds">The XrdsDocument instance to use in this process.</param>
        /// <param name="claimedIdentifier">The claimed identifier that was used to discover this XRDS document.</param>
        /// <param name="userSuppliedIdentifier">The user supplied identifier.</param>
        /// <returns>
        /// A sequence of OpenID Providers that can assert ownership of the <paramref name="claimedIdentifier"/>.
        /// </returns>
        internal static IEnumerable <IdentifierDiscoveryResult> CreateServiceEndpoints(this IEnumerable <XrdElement> xrds, UriIdentifier claimedIdentifier, UriIdentifier userSuppliedIdentifier)
        {
            var endpoints = new List <IdentifierDiscoveryResult>();

            endpoints.AddRange(xrds.GenerateOPIdentifierServiceEndpoints(userSuppliedIdentifier));
            endpoints.AddRange(xrds.GenerateClaimedIdentifierServiceEndpoints(claimedIdentifier, userSuppliedIdentifier));
            return(endpoints);
        }
コード例 #3
0
 /// <summary>
 /// Generates the OpenID Providers that are capable of asserting ownership
 /// of a particular URI claimed identifier.
 /// </summary>
 /// <param name="xrds">The XrdsDocument instance to use in this process.</param>
 /// <param name="claimedIdentifier">The claimed identifier.</param>
 /// <param name="userSuppliedIdentifier">The user supplied identifier.</param>
 /// <returns>
 /// A sequence of the providers that can assert ownership of the given identifier.
 /// </returns>
 private static IEnumerable <IdentifierDiscoveryResult> GenerateClaimedIdentifierServiceEndpoints(this IEnumerable <XrdElement> xrds, UriIdentifier claimedIdentifier, UriIdentifier userSuppliedIdentifier)
 {
     return(from service in xrds.FindClaimedIdentifierServices()
            from uri in service.UriElements
            where uri.Uri != null
            let providerEndpoint = new ProviderEndpointDescription(uri.Uri, service.TypeElementUris)
                                   select IdentifierDiscoveryResult.CreateForClaimedIdentifier(claimedIdentifier, userSuppliedIdentifier, service.ProviderLocalIdentifier, providerEndpoint, service.Priority, uri.Priority));
 }
コード例 #4
0
 public static bool IsValid(string identifier)
 {
     return(XriIdentifier.IsValidXri(identifier) || UriIdentifier.IsValidUri(identifier));
 }