summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs12
-rw-r--r--src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs43
2 files changed, 49 insertions, 6 deletions
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs
index 6ced1a6..bd706f5 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/OpenID/OpenIDClient.cs
@@ -20,18 +20,20 @@ namespace DotNetOpenAuth.AspNet.Clients {
#region Constants and Fields
/// <summary>
- /// The _openid relaying party.
+ /// The openid relying party.
/// </summary>
- private static readonly OpenIdRelyingParty RelyingParty =
- new OpenIdRelyingParty(new StandardRelyingPartyApplicationStore());
+ /// <remarks>
+ /// Pass null as applicationStore to specify dumb mode
+ /// </remarks>
+ private static readonly OpenIdRelyingParty RelyingParty = new OpenIdRelyingParty(applicationStore: null);
/// <summary>
- /// The _provider identifier.
+ /// The provider identifier.
/// </summary>
private readonly Identifier providerIdentifier;
/// <summary>
- /// The _provider name.
+ /// The provider name.
/// </summary>
private readonly string providerName;
diff --git a/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs b/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
index 463f056..06ca161 100644
--- a/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
+++ b/src/DotNetOpenAuth.AspNet/OpenAuthSecurityManager.cs
@@ -8,6 +8,7 @@ namespace DotNetOpenAuth.AspNet {
using System;
using System.Diagnostics.CodeAnalysis;
using System.Web;
+ using DotNetOpenAuth.AspNet.Clients;
using DotNetOpenAuth.Messaging;
/// <summary>
@@ -168,6 +169,46 @@ namespace DotNetOpenAuth.AspNet {
return result;
}
+ /// <summary>
+ /// Checks if user is successfully authenticated when user is redirected back to this user.
+ /// </summary>
+ /// <param name="returnUrl">The return Url which must match exactly the Url passed into RequestAuthentication() earlier.</param>
+ /// <returns>
+ /// The result of the authentication.
+ /// </returns>
+ public AuthenticationResult VerifyAuthentication(string returnUrl) {
+ Requires.NotNullOrEmpty(returnUrl, "returnUrl");
+
+ // Only OAuth2 requires the return url value for the verify authenticaiton step
+ OAuth2Client oauth2Client = this.authenticationProvider as OAuth2Client;
+ if (oauth2Client != null) {
+ // convert returnUrl to an absolute path
+ Uri uri;
+ if (!string.IsNullOrEmpty(returnUrl)) {
+ uri = UriHelper.ConvertToAbsoluteUri(returnUrl, this.requestContext);
+ }
+ else {
+ uri = this.requestContext.Request.GetPublicFacingUrl();
+ }
+
+ AuthenticationResult result = oauth2Client.VerifyAuthentication(this.requestContext, uri);
+ if (!result.IsSuccessful) {
+ // if the result is a Failed result, creates a new Failed response which has providerName info.
+ result = new AuthenticationResult(
+ isSuccessful: false,
+ provider: this.authenticationProvider.ProviderName,
+ providerUserId: null,
+ userName: null,
+ extraData: null);
+ }
+
+ return result;
+ }
+ else {
+ return this.VerifyAuthentication();
+ }
+ }
+
#endregion
}
-}
+} \ No newline at end of file