Several hundred StyleCop fixes.
[dotnetoauth.git] / src / DotNetOpenAuth / OpenId / NoDiscoveryIdentifier.cs
blobd5ed2ebab349aaf3f061456e8dd3bf75ef72066e
1 //-----------------------------------------------------------------------
2 // <copyright file="NoDiscoveryIdentifier.cs" company="Andrew Arnott">
3 // Copyright (c) Andrew Arnott. All rights reserved.
4 // </copyright>
5 //-----------------------------------------------------------------------
7 namespace DotNetOpenAuth.OpenId {
8 using System.Collections.Generic;
9 using System.Linq;
10 using DotNetOpenAuth.Messaging;
11 using DotNetOpenAuth.OpenId.RelyingParty;
13 /// <summary>
14 /// Wraps an existing Identifier and prevents it from performing discovery.
15 /// </summary>
16 internal class NoDiscoveryIdentifier : Identifier {
17 /// <summary>
18 /// The wrapped identifier.
19 /// </summary>
20 private Identifier wrappedIdentifier;
22 /// <summary>
23 /// Initializes a new instance of the <see cref="NoDiscoveryIdentifier"/> class.
24 /// </summary>
25 /// <param name="wrappedIdentifier">The ordinary Identifier whose discovery is being masked.</param>
26 internal NoDiscoveryIdentifier(Identifier wrappedIdentifier)
27 : base(false) {
28 ErrorUtilities.VerifyArgumentNotNull(wrappedIdentifier, "wrappedIdentifier");
30 this.wrappedIdentifier = wrappedIdentifier;
33 /// <summary>
34 /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
35 /// </summary>
36 /// <returns>
37 /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
38 /// </returns>
39 public override string ToString() {
40 return this.wrappedIdentifier.ToString();
43 /// <summary>
44 /// Tests equality between two <see cref="Identifier"/>s.
45 /// </summary>
46 /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
47 /// <returns>
48 /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
49 /// </returns>
50 /// <exception cref="T:System.NullReferenceException">
51 /// The <paramref name="obj"/> parameter is null.
52 /// </exception>
53 public override bool Equals(object obj) {
54 return this.wrappedIdentifier.Equals(obj);
57 /// <summary>
58 /// Gets the hash code for an <see cref="Identifier"/> for storage in a hashtable.
59 /// </summary>
60 /// <returns>
61 /// A hash code for the current <see cref="T:System.Object"/>.
62 /// </returns>
63 public override int GetHashCode() {
64 return this.wrappedIdentifier.GetHashCode();
67 /// <summary>
68 /// Performs discovery on the Identifier.
69 /// </summary>
70 /// <param name="requestHandler">The web request handler to use for discovery.</param>
71 /// <returns>
72 /// An initialized structure containing the discovered provider endpoint information.
73 /// </returns>
74 internal override IEnumerable<ServiceEndpoint> Discover(IDirectSslWebRequestHandler requestHandler) {
75 return Enumerable.Empty<ServiceEndpoint>();
78 /// <summary>
79 /// Returns an <see cref="Identifier"/> that has no URI fragment.
80 /// Quietly returns the original <see cref="Identifier"/> if it is not
81 /// a <see cref="UriIdentifier"/> or no fragment exists.
82 /// </summary>
83 /// <returns>
84 /// A new <see cref="Identifier"/> instance if there was a
85 /// fragment to remove, otherwise this same instance..
86 /// </returns>
87 internal override Identifier TrimFragment() {
88 return new NoDiscoveryIdentifier(this.wrappedIdentifier.TrimFragment());
91 /// <summary>
92 /// Converts a given identifier to its secure equivalent.
93 /// UriIdentifiers originally created with an implied HTTP scheme change to HTTPS.
94 /// Discovery is made to require SSL for the entire resolution process.
95 /// </summary>
96 /// <param name="secureIdentifier">The newly created secure identifier.
97 /// If the conversion fails, <paramref name="secureIdentifier"/> retains
98 /// <i>this</i> identifiers identity, but will never discover any endpoints.</param>
99 /// <returns>
100 /// True if the secure conversion was successful.
101 /// False if the Identifier was originally created with an explicit HTTP scheme.
102 /// </returns>
103 internal override bool TryRequireSsl(out Identifier secureIdentifier) {
104 return this.wrappedIdentifier.TryRequireSsl(out secureIdentifier);