summaryrefslogtreecommitdiffstats
path: root/samples/OpenIdProviderWebForms/decide.aspx.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-07-15 00:38:39 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-07-15 00:38:39 -0700
commit85915f62c304f60d530439014e63abb0d6a728d8 (patch)
treeaeb09ea125441169d6ae9bf068faf412c64e080e /samples/OpenIdProviderWebForms/decide.aspx.cs
parent653b4dd198e686cbbc470e3af6aa6bab78a29b0d (diff)
downloadDotNetOpenAuth-85915f62c304f60d530439014e63abb0d6a728d8.zip
DotNetOpenAuth-85915f62c304f60d530439014e63abb0d6a728d8.tar.gz
DotNetOpenAuth-85915f62c304f60d530439014e63abb0d6a728d8.tar.bz2
Added OpenID+OAuth combined OP sample.
Diffstat (limited to 'samples/OpenIdProviderWebForms/decide.aspx.cs')
-rw-r--r--samples/OpenIdProviderWebForms/decide.aspx.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/samples/OpenIdProviderWebForms/decide.aspx.cs b/samples/OpenIdProviderWebForms/decide.aspx.cs
index 3a14cf7..6146bd2 100644
--- a/samples/OpenIdProviderWebForms/decide.aspx.cs
+++ b/samples/OpenIdProviderWebForms/decide.aspx.cs
@@ -6,6 +6,7 @@ namespace OpenIdProviderWebForms {
using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Provider;
+ using OpenIdProviderWebForms.Code;
/// <summary>
/// Page for giving the user the option to continue or cancel out of authentication with a consumer.
@@ -21,6 +22,11 @@ namespace OpenIdProviderWebForms {
this.realmLabel.Text = ProviderEndpoint.PendingRequest.Realm.ToString();
+ var oauthRequest = OAuthHybrid.ServiceProvider.ReadAuthorizationRequest(ProviderEndpoint.PendingRequest);
+ if (oauthRequest != null) {
+ this.OAuthPanel.Visible = true;
+ }
+
if (ProviderEndpoint.PendingAuthenticationRequest != null) {
if (ProviderEndpoint.PendingAuthenticationRequest.IsDirectedIdentity) {
ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier = Code.Util.BuildIdentityUrl();
@@ -51,6 +57,24 @@ namespace OpenIdProviderWebForms {
}
protected void Yes_Click(object sender, EventArgs e) {
+ if (!Page.IsValid) {
+ return;
+ }
+
+ if (this.OAuthPanel.Visible) {
+ string consumerKey = null;
+ string grantedScope = null;
+ if (this.oauthPermission.Checked) {
+ // This SIMPLE sample merely uses the realm as the consumerKey,
+ // but in a real app this will probably involve a database lookup to translate
+ // the realm to a known consumerKey.
+ consumerKey = ProviderEndpoint.PendingRequest.Realm;
+ grantedScope = string.Empty; // we don't scope individual access rights on this sample
+ }
+
+ OAuthHybrid.ServiceProvider.AttachAuthorizationResponse(ProviderEndpoint.PendingRequest, consumerKey, grantedScope);
+ }
+
var sregRequest = ProviderEndpoint.PendingRequest.GetExtension<ClaimsRequest>();
ClaimsResponse sregResponse = null;
if (sregRequest != null) {