diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-15 22:17:20 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-15 22:17:20 -0800 |
commit | e12782c1a6727390b2107ff2e39d4ac6173d86fc (patch) | |
tree | 3be0ccda0a9425927263f5b6b9616ef8ba11ac08 /samples/ProviderPortal/decide.aspx.cs | |
parent | 078b1f350eb40ceee7423c25b1d833dd1f242da4 (diff) | |
parent | a545f7be2693596fa14540c359e43150a6a7cf88 (diff) | |
download | DotNetOpenAuth-origin/mono.zip DotNetOpenAuth-origin/mono.tar.gz DotNetOpenAuth-origin/mono.tar.bz2 |
Merge branch 'v2.5' into monoorigin/mono
Conflicts:
src/DotNetOpenId/Properties/AssemblyInfo.cs
src/DotNetOpenId/RelyingParty/AuthenticationResponse.cs
Diffstat (limited to 'samples/ProviderPortal/decide.aspx.cs')
-rw-r--r-- | samples/ProviderPortal/decide.aspx.cs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/samples/ProviderPortal/decide.aspx.cs b/samples/ProviderPortal/decide.aspx.cs index 882c320..2c563a6 100644 --- a/samples/ProviderPortal/decide.aspx.cs +++ b/samples/ProviderPortal/decide.aspx.cs @@ -4,6 +4,7 @@ using System.Web.Security; using System.Web.UI;
using DotNetOpenId.Extensions.SimpleRegistration;
using DotNetOpenId.Provider;
+using DotNetOpenId.Extensions.ProviderAuthenticationPolicy;
/// <summary>
/// Page for giving the user the option to continue or cancel out of authentication with a consumer.
@@ -23,16 +24,16 @@ public partial class decide : Page { realmLabel.Text = ProviderEndpoint.PendingAuthenticationRequest.Realm.ToString();
// check that the logged in user is the same as the user requesting authentication to the consumer. If not, then log them out.
- if (User.Identity.Name == Util.ExtractUserName(ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier)) {
+ if (String.Equals(User.Identity.Name, Util.ExtractUserName(ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier), StringComparison.OrdinalIgnoreCase)) {
// if simple registration fields were used, then prompt the user for them
var requestedFields = ProviderEndpoint.PendingAuthenticationRequest.GetExtension<ClaimsRequest>();
if (requestedFields != null) {
this.profileFields.Visible = true;
this.profileFields.SetRequiredFieldsFromRequest(requestedFields);
if (!IsPostBack) {
- this.profileFields.OpenIdProfileFields = new ClaimsResponse() {
- Email = Membership.GetUser().Email,
- };
+ var sregResponse = requestedFields.CreateResponse();
+ sregResponse.Email = Membership.GetUser().Email;
+ this.profileFields.SetOpenIdProfileFields(sregResponse);
}
}
} else {
@@ -42,8 +43,21 @@ public partial class decide : Page { }
protected void Yes_Click(Object sender, EventArgs e) {
+ var sregRequest = ProviderEndpoint.PendingAuthenticationRequest.GetExtension<ClaimsRequest>();
+ ClaimsResponse sregResponse = null;
+ if (sregRequest != null) {
+ sregResponse = profileFields.GetOpenIdProfileFields(sregRequest);
+ ProviderEndpoint.PendingAuthenticationRequest.AddResponseExtension(sregResponse);
+ }
+ var papeRequest = ProviderEndpoint.PendingAuthenticationRequest.GetExtension<PolicyRequest>();
+ PolicyResponse papeResponse = null;
+ if (papeRequest != null) {
+ papeResponse = new PolicyResponse();
+ papeResponse.NistAssuranceLevel = NistAssuranceLevel.InsufficientForLevel1;
+ ProviderEndpoint.PendingAuthenticationRequest.AddResponseExtension(papeResponse);
+ }
+
ProviderEndpoint.PendingAuthenticationRequest.IsAuthenticated = true;
- ProviderEndpoint.PendingAuthenticationRequest.AddResponseExtension(profileFields.OpenIdProfileFields);
Debug.Assert(ProviderEndpoint.PendingAuthenticationRequest.IsResponseReady);
ProviderEndpoint.PendingAuthenticationRequest.Response.Send();
ProviderEndpoint.PendingAuthenticationRequest = null;
|