summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OpenId/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.OpenId/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs')
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs
new file mode 100644
index 0000000..985bb54
--- /dev/null
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs
@@ -0,0 +1,83 @@
+//-----------------------------------------------------------------------
+// <copyright file="IDirectedIdentityIdentifierProvider.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.OpenId.Provider {
+ using System;
+ using System.Diagnostics.Contracts;
+
+ /// <summary>
+ /// An interface to provide custom identifiers for users logging into specific relying parties.
+ /// </summary>
+ /// <remarks>
+ /// This interface would allow, for example, the Provider to offer PPIDs to their users,
+ /// allowing the users to log into RPs without leaving any clue as to their true identity,
+ /// and preventing multiple RPs from colluding to track user activity across realms.
+ /// </remarks>
+ [ContractClass(typeof(IDirectedIdentityIdentifierProviderContract))]
+ public interface IDirectedIdentityIdentifierProvider {
+ /// <summary>
+ /// Gets the Identifier to use for the Claimed Identifier and Local Identifier of
+ /// an outgoing positive assertion.
+ /// </summary>
+ /// <param name="localIdentifier">The OP local identifier for the authenticating user.</param>
+ /// <param name="relyingPartyRealm">The realm of the relying party receiving the assertion.</param>
+ /// <returns>
+ /// A valid, discoverable OpenID Identifier that should be used as the value for the
+ /// openid.claimed_id and openid.local_id parameters. Must not be null.
+ /// </returns>
+ Uri GetIdentifier(Identifier localIdentifier, Realm relyingPartyRealm);
+
+ /// <summary>
+ /// Determines whether a given identifier is the primary (non-PPID) local identifier for some user.
+ /// </summary>
+ /// <param name="identifier">The identifier in question.</param>
+ /// <returns>
+ /// <c>true</c> if the given identifier is the valid, unique identifier for some uesr (and NOT a PPID); otherwise, <c>false</c>.
+ /// </returns>
+ [Pure]
+ bool IsUserLocalIdentifier(Identifier identifier);
+ }
+
+ /// <summary>
+ /// Contract class for the <see cref="IDirectedIdentityIdentifierProvider"/> type.
+ /// </summary>
+ [ContractClassFor(typeof(IDirectedIdentityIdentifierProvider))]
+ internal abstract class IDirectedIdentityIdentifierProviderContract : IDirectedIdentityIdentifierProvider {
+ #region IDirectedIdentityIdentifierProvider Members
+
+ /// <summary>
+ /// Gets the Identifier to use for the Claimed Identifier and Local Identifier of
+ /// an outgoing positive assertion.
+ /// </summary>
+ /// <param name="localIdentifier">The OP local identifier for the authenticating user.</param>
+ /// <param name="relyingPartyRealm">The realm of the relying party receiving the assertion.</param>
+ /// <returns>
+ /// A valid, discoverable OpenID Identifier that should be used as the value for the
+ /// openid.claimed_id and openid.local_id parameters. Must not be null.
+ /// </returns>
+ Uri IDirectedIdentityIdentifierProvider.GetIdentifier(Identifier localIdentifier, Realm relyingPartyRealm) {
+ Contract.Requires<ArgumentNullException>(localIdentifier != null);
+ Contract.Requires<ArgumentNullException>(relyingPartyRealm != null);
+ Contract.Requires<ArgumentException>(((IDirectedIdentityIdentifierProvider)this).IsUserLocalIdentifier(localIdentifier), OpenIdStrings.ArgumentIsPpidIdentifier);
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Determines whether a given identifier is the primary (non-PPID) local identifier for some user.
+ /// </summary>
+ /// <param name="identifier">The identifier in question.</param>
+ /// <returns>
+ /// <c>true</c> if the given identifier is the valid, unique identifier for some uesr (and NOT a PPID); otherwise, <c>false</c>.
+ /// </returns>
+ bool IDirectedIdentityIdentifierProvider.IsUserLocalIdentifier(Identifier identifier) {
+ Contract.Requires<ArgumentNullException>(identifier != null);
+
+ throw new NotImplementedException();
+ }
+
+ #endregion
+ }
+}