summaryrefslogtreecommitdiffstats
path: root/samples/DotNetOpenAuth.ApplicationBlock/Provider/AuthenticationRequestExtensions.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-26 18:12:56 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-26 18:12:56 -0700
commited8e510edf71df2cda6dd18e263540626b3537ae (patch)
tree4948589adb3b3c97b2d66c795477db51d3f82774 /samples/DotNetOpenAuth.ApplicationBlock/Provider/AuthenticationRequestExtensions.cs
parent5569ca589ff4d7b6571fb9753d42410ca80655c1 (diff)
downloadDotNetOpenAuth-ed8e510edf71df2cda6dd18e263540626b3537ae.zip
DotNetOpenAuth-ed8e510edf71df2cda6dd18e263540626b3537ae.tar.gz
DotNetOpenAuth-ed8e510edf71df2cda6dd18e263540626b3537ae.tar.bz2
Moved PPID OP Provider code out of the library and into the ApplicationBlock.
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock/Provider/AuthenticationRequestExtensions.cs')
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/Provider/AuthenticationRequestExtensions.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/Provider/AuthenticationRequestExtensions.cs b/samples/DotNetOpenAuth.ApplicationBlock/Provider/AuthenticationRequestExtensions.cs
new file mode 100644
index 0000000..496b14b
--- /dev/null
+++ b/samples/DotNetOpenAuth.ApplicationBlock/Provider/AuthenticationRequestExtensions.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using DotNetOpenAuth.OpenId.Provider;
+using DotNetOpenAuth.OpenId;
+
+namespace DotNetOpenAuth.ApplicationBlock.Provider {
+ public static class AuthenticationRequestExtensions {
+ /// <summary>
+ /// Removes all personally identifiable information from the positive assertion.
+ /// </summary>
+ /// <remarks>
+ /// The openid.claimed_id and openid.identity values are hashed.
+ /// </remarks>
+ public static void ScrubPersonallyIdentifiableInformation(this IAuthenticationRequest request, Identifier localIdentifier, AnonymousIdentifierProviderBase anonymousIdentifierProvider, bool pairwiseUnique) {
+ if (request == null) {
+ throw new ArgumentNullException("request");
+ }
+ if (!request.IsDirectedIdentity) {
+ throw new InvalidOperationException("This operation is supported only under identifier select (directed identity) scenarios.");
+ }
+ if (anonymousIdentifierProvider == null) {
+ throw new ArgumentNullException("anonymousIdentifierProvider");
+ }
+ if (localIdentifier == null) {
+ throw new ArgumentNullException("localIdentifier");
+ }
+
+ // When generating the anonymous identifiers, the openid.identity and openid.claimed_id
+ // will always end up with matching values.
+ var anonymousIdentifier = anonymousIdentifierProvider.GetAnonymousIdentifier(localIdentifier, pairwiseUnique ? request.Realm : null);
+ request.ClaimedIdentifier = anonymousIdentifier;
+ request.LocalIdentifier = anonymousIdentifier;
+ }
+ }
+}