diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2011-07-11 06:52:30 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2011-07-11 06:52:30 -0700 |
commit | da851e98f33f76e2937ac193f3f529c088b9425a (patch) | |
tree | 25dac91167e313916973616cf975e990a63ede2a /src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs | |
parent | ea9d0bb76e032b35ab290f10bd2267c2bdc768c9 (diff) | |
download | DotNetOpenAuth-da851e98f33f76e2937ac193f3f529c088b9425a.zip DotNetOpenAuth-da851e98f33f76e2937ac193f3f529c088b9425a.tar.gz DotNetOpenAuth-da851e98f33f76e2937ac193f3f529c088b9425a.tar.bz2 |
Functionality and one sample is fixed up enough to permit an OpenID login to complete successfully.
Diffstat (limited to 'src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs')
-rw-r--r-- | src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs b/src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs index 305976a..2d919ea 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs @@ -12,6 +12,7 @@ namespace DotNetOpenAuth.OpenId { using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.RelyingParty; + using DotNetOpenAuth.Messaging.Reflection; /// <summary> /// An Identifier is either a "http" or "https" URI, or an XRI. @@ -22,6 +23,18 @@ namespace DotNetOpenAuth.OpenId { [ContractClass(typeof(IdentifierContract))] public abstract class Identifier { /// <summary> + /// Initializes the <see cref="Identifier"/> class. + /// </summary> + static Identifier() { + Func<string, Identifier> safeIdentifier = str => { + Contract.Assume(str != null); + ErrorUtilities.VerifyFormat(str.Length > 0, MessagingStrings.NonEmptyStringExpected); + return Identifier.Parse(str, true); + }; + MessagePart.Map<Identifier>(id => id.SerializedString, id => id.OriginalString, safeIdentifier); + } + + /// <summary> /// Initializes a new instance of the <see cref="Identifier"/> class. /// </summary> /// <param name="originalString">The original string before any normalization.</param> |