summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj53
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs12
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/InMemoryTokenManager.cs147
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs145
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/YubikeyRelyingParty.cs207
-rw-r--r--samples/InfoCardRelyingParty/Site.Master2
-rw-r--r--samples/InfoCardRelyingParty/favicon.icobin0 -> 1150 bytes
-rw-r--r--samples/InfoCardRelyingParty/images/DotNetOpenAuth.pngbin0 -> 25212 bytes
-rw-r--r--samples/InfoCardRelyingParty/images/dotnetopenid_tiny.gifbin3548 -> 0 bytes
-rw-r--r--samples/OAuthConsumer/App_Code/InMemoryTokenManager.cs54
-rw-r--r--samples/OAuthConsumer/App_Code/Logging.cs20
-rw-r--r--samples/OAuthConsumer/App_Code/TracePageAppender.cs11
-rw-r--r--samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.disco4
-rw-r--r--samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/configuration.svcinfo10
-rw-r--r--samples/OAuthConsumer/Bin/DotNetOpenAuth.dll.refresh_bin58 -> 0 bytes
-rw-r--r--samples/OAuthConsumer/Bin/log4net.dll.refreshbin44 -> 0 bytes
-rw-r--r--samples/OAuthConsumer/Code/Logging.cs22
-rw-r--r--samples/OAuthConsumer/Code/TracePageAppender.cs13
-rw-r--r--samples/OAuthConsumer/Default.aspx1
-rw-r--r--samples/OAuthConsumer/Global.asax32
-rw-r--r--samples/OAuthConsumer/Global.asax.cs35
-rw-r--r--samples/OAuthConsumer/GoogleAddressBook.aspx4
-rw-r--r--samples/OAuthConsumer/GoogleAddressBook.aspx.cs118
-rw-r--r--samples/OAuthConsumer/GoogleAddressBook.aspx.designer.cs42
-rw-r--r--samples/OAuthConsumer/OAuthConsumer.csproj189
-rw-r--r--samples/OAuthConsumer/Properties/AssemblyInfo.cs35
-rw-r--r--samples/OAuthConsumer/SampleWcf.aspx3
-rw-r--r--samples/OAuthConsumer/SampleWcf.aspx.cs193
-rw-r--r--samples/OAuthConsumer/SampleWcf.aspx.designer.cs96
-rw-r--r--samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.disco4
-rw-r--r--samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.wsdl (renamed from samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.wsdl)12
-rw-r--r--samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.xsd (renamed from samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi1.xsd)2
-rw-r--r--samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi1.xsd (renamed from samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.xsd)0
-rw-r--r--samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi2.xsd (renamed from samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi2.xsd)0
-rw-r--r--samples/OAuthConsumer/Service References/SampleServiceProvider/Reference.cs67
-rw-r--r--samples/OAuthConsumer/Service References/SampleServiceProvider/Reference.svcmap (renamed from samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/Reference.svcmap)15
-rw-r--r--samples/OAuthConsumer/Service References/SampleServiceProvider/configuration.svcinfo10
-rw-r--r--samples/OAuthConsumer/Service References/SampleServiceProvider/configuration91.svcinfo (renamed from samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/configuration91.svcinfo)148
-rw-r--r--samples/OAuthConsumer/SignInWithTwitter.aspx38
-rw-r--r--samples/OAuthConsumer/SignInWithTwitter.aspx.cs39
-rw-r--r--samples/OAuthConsumer/SignInWithTwitter.aspx.designer.cs87
-rw-r--r--samples/OAuthConsumer/TracePage.aspx2
-rw-r--r--samples/OAuthConsumer/TracePage.aspx.cs36
-rw-r--r--samples/OAuthConsumer/TracePage.aspx.designer.cs42
-rw-r--r--samples/OAuthConsumer/Twitter.aspx3
-rw-r--r--samples/OAuthConsumer/Twitter.aspx.cs154
-rw-r--r--samples/OAuthConsumer/Twitter.aspx.designer.cs78
-rw-r--r--samples/OAuthConsumer/Web.config8
-rw-r--r--samples/OAuthConsumer/favicon.icobin0 -> 1150 bytes
-rw-r--r--samples/OAuthConsumer/images/Sign-in-with-Twitter-darker.pngbin0 -> 2370 bytes
-rw-r--r--samples/OAuthConsumerWpf/App.config2
-rw-r--r--samples/OAuthConsumerWpf/MainWindow.xaml.cs2
-rw-r--r--samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj51
-rw-r--r--samples/OAuthConsumerWpf/Properties/Resources.Designer.cs4
-rw-r--r--samples/OAuthConsumerWpf/Properties/Settings.Designer.cs4
-rw-r--r--samples/OAuthConsumerWpf/Service References/WcfSampleService/Reference.cs8
-rw-r--r--samples/OAuthConsumerWpf/favicon.icobin0 -> 1150 bytes
-rw-r--r--samples/OAuthServiceProvider/App_Code/Constants.cs30
-rw-r--r--samples/OAuthServiceProvider/App_Code/CustomOAuthTypeProvider.cs32
-rw-r--r--samples/OAuthServiceProvider/App_Code/DataApi.cs31
-rw-r--r--samples/OAuthServiceProvider/App_Code/DataClasses.designer.cs1067
-rw-r--r--samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs157
-rw-r--r--samples/OAuthServiceProvider/App_Code/Global.cs122
-rw-r--r--samples/OAuthServiceProvider/App_Code/IDataApi.cs18
-rw-r--r--samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs63
-rw-r--r--samples/OAuthServiceProvider/App_Code/OAuthConsumer.cs41
-rw-r--r--samples/OAuthServiceProvider/App_Code/OAuthPrincipalAuthorizationPolicy.cs45
-rw-r--r--samples/OAuthServiceProvider/App_Code/OAuthToken.cs64
-rw-r--r--samples/OAuthServiceProvider/App_Code/RequestScopedTokenMessage.cs22
-rw-r--r--samples/OAuthServiceProvider/App_Code/TokenAuthorizationState.cs24
-rw-r--r--samples/OAuthServiceProvider/App_Code/TracePageAppender.cs11
-rw-r--r--samples/OAuthServiceProvider/App_Code/Utilities.cs26
-rw-r--r--samples/OAuthServiceProvider/Bin/DotNetOpenAuth.dll.refresh_bin58 -> 0 bytes
-rw-r--r--samples/OAuthServiceProvider/Bin/log4net.dll.refreshbin44 -> 0 bytes
-rw-r--r--samples/OAuthServiceProvider/Code/Constants.cs32
-rw-r--r--samples/OAuthServiceProvider/Code/CustomOAuthTypeProvider.cs34
-rw-r--r--samples/OAuthServiceProvider/Code/DataClasses.dbml (renamed from samples/OAuthServiceProvider/App_Code/DataClasses.dbml)12
-rw-r--r--samples/OAuthServiceProvider/Code/DataClasses.dbml.layout (renamed from samples/OAuthServiceProvider/App_Code/DataClasses.dbml.layout)10
-rw-r--r--samples/OAuthServiceProvider/Code/DataClasses.designer.cs1190
-rw-r--r--samples/OAuthServiceProvider/Code/DatabaseNonceStore.cs55
-rw-r--r--samples/OAuthServiceProvider/Code/DatabaseTokenManager.cs159
-rw-r--r--samples/OAuthServiceProvider/Code/Global.cs126
-rw-r--r--samples/OAuthServiceProvider/Code/IDataApi.cs20
-rw-r--r--samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs65
-rw-r--r--samples/OAuthServiceProvider/Code/OAuthConsumer.cs43
-rw-r--r--samples/OAuthServiceProvider/Code/OAuthPrincipalAuthorizationPolicy.cs47
-rw-r--r--samples/OAuthServiceProvider/Code/OAuthToken.cs66
-rw-r--r--samples/OAuthServiceProvider/Code/RequestScopedTokenMessage.cs25
-rw-r--r--samples/OAuthServiceProvider/Code/TokenAuthorizationState.cs26
-rw-r--r--samples/OAuthServiceProvider/Code/TracePageAppender.cs13
-rw-r--r--samples/OAuthServiceProvider/Code/Utilities.cs28
-rw-r--r--samples/OAuthServiceProvider/DataApi.cs34
-rw-r--r--samples/OAuthServiceProvider/DataApi.svc2
-rw-r--r--samples/OAuthServiceProvider/Default.aspx42
-rw-r--r--samples/OAuthServiceProvider/Default.aspx.cs49
-rw-r--r--samples/OAuthServiceProvider/Default.aspx.designer.cs33
-rw-r--r--samples/OAuthServiceProvider/Global.asax2
-rw-r--r--samples/OAuthServiceProvider/Members/Authorize.aspx3
-rw-r--r--samples/OAuthServiceProvider/Members/Authorize.aspx.cs129
-rw-r--r--samples/OAuthServiceProvider/Members/Authorize.aspx.designer.cs105
-rw-r--r--samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx7
-rw-r--r--samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx.cs28
-rw-r--r--samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx.designer.cs15
-rw-r--r--samples/OAuthServiceProvider/OAuth.ashx1
-rw-r--r--samples/OAuthServiceProvider/OAuthServiceProvider.csproj179
-rw-r--r--samples/OAuthServiceProvider/Properties/AssemblyInfo.cs35
-rw-r--r--samples/OAuthServiceProvider/TracePage.aspx2
-rw-r--r--samples/OAuthServiceProvider/TracePage.aspx.cs37
-rw-r--r--samples/OAuthServiceProvider/TracePage.aspx.designer.cs42
-rw-r--r--samples/OAuthServiceProvider/Web.config10
-rw-r--r--samples/OAuthServiceProvider/favicon.icobin0 -> 1150 bytes
-rw-r--r--samples/OpenIdOfflineProvider/MainWindow.xaml11
-rw-r--r--samples/OpenIdOfflineProvider/MainWindow.xaml.cs20
-rw-r--r--samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj68
-rw-r--r--samples/OpenIdOfflineProvider/Properties/Resources.Designer.cs4
-rw-r--r--samples/OpenIdOfflineProvider/Properties/Settings.Designer.cs4
-rw-r--r--samples/OpenIdOfflineProvider/openid.icobin17006 -> 1150 bytes
-rw-r--r--samples/OpenIdProviderMvc/OpenIdProviderMvc.csproj47
-rw-r--r--samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.debug.js875
-rw-r--r--samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.js59
-rw-r--r--samples/OpenIdProviderMvc/Views/Web.config17
-rw-r--r--samples/OpenIdProviderMvc/Web.config15
-rw-r--r--samples/OpenIdProviderMvc/favicon.icobin0 -> 1150 bytes
-rw-r--r--samples/OpenIdProviderWebForms/Code/CustomStoreDataSet.Designer.cs107
-rw-r--r--samples/OpenIdProviderWebForms/OpenIdProviderWebForms.csproj40
-rw-r--r--samples/OpenIdProviderWebForms/Site.Master2
-rw-r--r--samples/OpenIdProviderWebForms/Web.config11
-rw-r--r--samples/OpenIdProviderWebForms/decide.aspx.cs7
-rw-r--r--samples/OpenIdProviderWebForms/favicon.icobin318 -> 1150 bytes
-rw-r--r--samples/OpenIdProviderWebForms/images/DotNetOpenAuth.pngbin0 -> 25212 bytes
-rw-r--r--samples/OpenIdProviderWebForms/images/dotnetopenid_tiny.gifbin3548 -> 0 bytes
-rw-r--r--samples/OpenIdProviderWebForms/login.aspx10
-rw-r--r--samples/OpenIdProviderWebForms/login.aspx.cs28
-rw-r--r--samples/OpenIdProviderWebForms/login.aspx.designer.cs39
-rw-r--r--samples/OpenIdRelyingPartyClassicAsp/MembersOnly.asp2
-rw-r--r--samples/OpenIdRelyingPartyClassicAsp/default.asp2
-rw-r--r--samples/OpenIdRelyingPartyClassicAsp/favicon.icobin0 -> 1150 bytes
-rw-r--r--samples/OpenIdRelyingPartyClassicAsp/images/DotNetOpenAuth.pngbin0 -> 25212 bytes
-rw-r--r--samples/OpenIdRelyingPartyClassicAsp/images/dotnetopenid_tiny.gifbin3548 -> 0 bytes
-rw-r--r--samples/OpenIdRelyingPartyClassicAsp/images/openid_login.gifbin237 -> 0 bytes
-rw-r--r--samples/OpenIdRelyingPartyClassicAsp/images/openid_login.pngbin0 -> 457 bytes
-rw-r--r--samples/OpenIdRelyingPartyClassicAsp/login.asp2
-rw-r--r--samples/OpenIdRelyingPartyClassicAsp/styles.css2
-rw-r--r--samples/OpenIdRelyingPartyMvc/Content/images/openid.gifbin740 -> 0 bytes
-rw-r--r--samples/OpenIdRelyingPartyMvc/Content/images/openid.pngbin0 -> 2340 bytes
-rw-r--r--samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs4
-rw-r--r--samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj53
-rw-r--r--samples/OpenIdRelyingPartyMvc/Views/Home/Index.aspx1
-rw-r--r--samples/OpenIdRelyingPartyMvc/Views/User/LoginPopup.aspx207
-rw-r--r--samples/OpenIdRelyingPartyMvc/Views/Web.config15
-rw-r--r--samples/OpenIdRelyingPartyMvc/Web.config15
-rw-r--r--samples/OpenIdRelyingPartyMvc/favicon.icobin0 -> 1150 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebForms/Code/CustomStoreDataSet1.Designer.cs107
-rw-r--r--samples/OpenIdRelyingPartyWebForms/Code/InMemoryTokenManager.cs73
-rw-r--r--samples/OpenIdRelyingPartyWebForms/OpenIdRelyingPartyWebForms.csproj54
-rw-r--r--samples/OpenIdRelyingPartyWebForms/Site.Master4
-rw-r--r--samples/OpenIdRelyingPartyWebForms/Web.config4
-rw-r--r--samples/OpenIdRelyingPartyWebForms/ajaxlogin.aspx.designer.cs3
-rw-r--r--samples/OpenIdRelyingPartyWebForms/favicon.icobin0 -> 1150 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebForms/images/DotNetOpenAuth.pngbin0 -> 25212 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebForms/images/dotnetopenid_tiny.gifbin3548 -> 0 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebForms/images/openid_login.gifbin237 -> 0 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebForms/images/openid_login.pngbin0 -> 457 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebForms/login.aspx1
-rw-r--r--samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx16
-rw-r--r--samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx.cs51
-rw-r--r--samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx.designer.cs34
-rw-r--r--samples/OpenIdRelyingPartyWebForms/m/Login.aspx17
-rw-r--r--samples/OpenIdRelyingPartyWebForms/m/Login.aspx.cs13
-rw-r--r--samples/OpenIdRelyingPartyWebForms/xrds.aspx2
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Code/State.vb46
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Code/TracePageAppender.vb10
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Default.aspx18
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.designer.vb26
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.vb8
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Global.asax1
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Global.asax.vb66
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Login.aspx28
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.designer.vb53
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.vb52
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx15
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.designer.vb71
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.vb76
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Default.aspx34
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/ProfileFieldsDisplay.ascx91
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Web.config18
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.Designer.vb13
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.myapp10
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/My Project/AssemblyInfo.vb34
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/My Project/MyExtensions/MyWebExtension.vb73
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.Designer.vb63
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.resx117
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.Designer.vb73
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.settings7
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/OpenIdRelyingPartyWebFormsVB.vbproj230
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/PrivacyPolicy.aspx7
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Site.Master39
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx16
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.designer.vb53
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.vb13
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/Web.config116
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/favicon.icobin0 -> 1150 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/images/DotNetOpenAuth.pngbin0 -> 25212 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/images/attention.pngbin0 -> 714 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/images/openid_login.pngbin0 -> 457 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/images/yahoo.pngbin0 -> 7607 bytes
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/styles.css10
-rw-r--r--samples/OpenIdRelyingPartyWebFormsVB/xrds.aspx29
-rw-r--r--samples/OpenIdWebRingSsoProvider/App_Data/Users.xml23
-rw-r--r--samples/OpenIdWebRingSsoProvider/Code/ReadOnlyXmlMembershipProvider.cs276
-rw-r--r--samples/OpenIdWebRingSsoProvider/Code/Util.cs115
-rw-r--r--samples/OpenIdWebRingSsoProvider/Default.aspx25
-rw-r--r--samples/OpenIdWebRingSsoProvider/Default.aspx.cs22
-rw-r--r--samples/OpenIdWebRingSsoProvider/Default.aspx.designer.cs34
-rw-r--r--samples/OpenIdWebRingSsoProvider/Login.aspx49
-rw-r--r--samples/OpenIdWebRingSsoProvider/Login.aspx.cs45
-rw-r--r--samples/OpenIdWebRingSsoProvider/Login.aspx.designer.cs (renamed from samples/OpenIdRelyingPartyWebForms/m/Login.aspx.designer.cs)15
-rw-r--r--samples/OpenIdWebRingSsoProvider/OpenIdWebRingSsoProvider.csproj139
-rw-r--r--samples/OpenIdWebRingSsoProvider/Properties/AssemblyInfo.cs35
-rw-r--r--samples/OpenIdWebRingSsoProvider/Server.aspx17
-rw-r--r--samples/OpenIdWebRingSsoProvider/Server.aspx.cs19
-rw-r--r--samples/OpenIdWebRingSsoProvider/Server.aspx.designer.cs33
-rw-r--r--samples/OpenIdWebRingSsoProvider/Web.config183
-rw-r--r--samples/OpenIdWebRingSsoProvider/op_xrds.aspx19
-rw-r--r--samples/OpenIdWebRingSsoProvider/user.aspx22
-rw-r--r--samples/OpenIdWebRingSsoProvider/user.aspx.cs23
-rw-r--r--samples/OpenIdWebRingSsoProvider/user.aspx.designer.cs52
-rw-r--r--samples/OpenIdWebRingSsoProvider/user_xrds.aspx24
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx19
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx.cs13
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx.designer.cs25
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Admin/Web.config9
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/AuthTicketRoles.cs57
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Default.aspx29
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Default.aspx.cs18
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Default.aspx.designer.cs34
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Login.aspx26
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Login.aspx.cs96
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Login.aspx.designer.cs70
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/OpenIdWebRingSsoRelyingParty.csproj128
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Properties/AssemblyInfo.cs35
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/Web.config195
-rw-r--r--samples/OpenIdWebRingSsoRelyingParty/xrds.aspx20
-rw-r--r--samples/Samples.proj106
-rw-r--r--samples/Samples.sln56
-rw-r--r--samples/tools.proj52
246 files changed, 9528 insertions, 2915 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
index 976a325..6739bf9 100644
--- a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
+++ b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -12,15 +12,36 @@
<AssemblyName>DotNetOpenAuth.ApplicationBlock</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <TargetFrameworkProfile />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -29,6 +50,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CodeAnalysis|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -39,12 +61,18 @@
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup>
+ <DefineConstants>$(DefineConstants);SAMPLESONLY</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
+ <Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
+ <Reference Include="System.Web" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
@@ -59,9 +87,13 @@
<Compile Include="CustomExtensions\AcmeRequest.cs" />
<Compile Include="CustomExtensions\AcmeResponse.cs" />
<Compile Include="GoogleConsumer.cs" />
+ <Compile Include="InMemoryTokenManager.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TwitterConsumer.cs" />
<Compile Include="Util.cs" />
+ <Compile Include="YubikeyRelyingParty.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\DotNetOpenAuth\DotNetOpenAuth.csproj">
@@ -69,6 +101,23 @@
<Name>DotNetOpenAuth</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs b/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs
index 4d3ce13..2add642 100644
--- a/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs
+++ b/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs
@@ -8,6 +8,7 @@ namespace DotNetOpenAuth.ApplicationBlock {
using System;
using System.Collections.Generic;
using System.Diagnostics;
+ using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
@@ -208,13 +209,20 @@ namespace DotNetOpenAuth.ApplicationBlock {
/// </summary>
/// <param name="consumer">The Google consumer previously constructed using <see cref="CreateWebConsumer"/> or <see cref="CreateDesktopConsumer"/>.</param>
/// <param name="accessToken">The access token previously retrieved.</param>
+ /// <param name="maxResults">The maximum number of entries to return. If you want to receive all of the contacts, rather than only the default maximum, you can specify a very large number here.</param>
+ /// <param name="startIndex">The 1-based index of the first result to be retrieved (for paging).</param>
/// <returns>An XML document returned by Google.</returns>
- public static XDocument GetContacts(ConsumerBase consumer, string accessToken) {
+ public static XDocument GetContacts(ConsumerBase consumer, string accessToken, int maxResults = 25, int startIndex = 1) {
if (consumer == null) {
throw new ArgumentNullException("consumer");
}
- var response = consumer.PrepareAuthorizedRequestAndSend(GetContactsEndpoint, accessToken);
+ var extraData = new Dictionary<string, string>() {
+ { "start-index", startIndex.ToString(CultureInfo.InvariantCulture) },
+ { "max-results", maxResults.ToString(CultureInfo.InvariantCulture) },
+ };
+ var request = consumer.PrepareAuthorizedRequest(GetContactsEndpoint, accessToken, extraData);
+ var response = consumer.Channel.WebRequestHandler.GetResponse(request);
string body = response.GetResponseReader().ReadToEnd();
XDocument result = XDocument.Parse(body);
return result;
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/InMemoryTokenManager.cs b/samples/DotNetOpenAuth.ApplicationBlock/InMemoryTokenManager.cs
new file mode 100644
index 0000000..b9cc2b8
--- /dev/null
+++ b/samples/DotNetOpenAuth.ApplicationBlock/InMemoryTokenManager.cs
@@ -0,0 +1,147 @@
+//-----------------------------------------------------------------------
+// <copyright file="InMemoryTokenManager.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.ApplicationBlock {
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+ using DotNetOpenAuth.OAuth.Messages;
+ using DotNetOpenAuth.OpenId.Extensions.OAuth;
+
+#if SAMPLESONLY
+ /// <summary>
+ /// A token manager that only retains tokens in memory.
+ /// Meant for SHORT TERM USE TOKENS ONLY.
+ /// </summary>
+ /// <remarks>
+ /// A likely application of this class is for "Sign In With Twitter",
+ /// where the user only signs in without providing any authorization to access
+ /// Twitter APIs except to authenticate, since that access token is only useful once.
+ /// </remarks>
+ internal class InMemoryTokenManager : IConsumerTokenManager, IOpenIdOAuthTokenManager {
+ private Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="InMemoryTokenManager"/> class.
+ /// </summary>
+ /// <param name="consumerKey">The consumer key.</param>
+ /// <param name="consumerSecret">The consumer secret.</param>
+ public InMemoryTokenManager(string consumerKey, string consumerSecret) {
+ if (String.IsNullOrEmpty(consumerKey)) {
+ throw new ArgumentNullException("consumerKey");
+ }
+
+ this.ConsumerKey = consumerKey;
+ this.ConsumerSecret = consumerSecret;
+ }
+
+ /// <summary>
+ /// Gets the consumer key.
+ /// </summary>
+ /// <value>The consumer key.</value>
+ public string ConsumerKey { get; private set; }
+
+ /// <summary>
+ /// Gets the consumer secret.
+ /// </summary>
+ /// <value>The consumer secret.</value>
+ public string ConsumerSecret { get; private set; }
+
+ #region ITokenManager Members
+
+ /// <summary>
+ /// Gets the Token Secret given a request or access token.
+ /// </summary>
+ /// <param name="token">The request or access token.</param>
+ /// <returns>
+ /// The secret associated with the given token.
+ /// </returns>
+ /// <exception cref="ArgumentException">Thrown if the secret cannot be found for the given token.</exception>
+ public string GetTokenSecret(string token) {
+ return this.tokensAndSecrets[token];
+ }
+
+ /// <summary>
+ /// Stores a newly generated unauthorized request token, secret, and optional
+ /// application-specific parameters for later recall.
+ /// </summary>
+ /// <param name="request">The request message that resulted in the generation of a new unauthorized request token.</param>
+ /// <param name="response">The response message that includes the unauthorized request token.</param>
+ /// <exception cref="ArgumentException">Thrown if the consumer key is not registered, or a required parameter was not found in the parameters collection.</exception>
+ /// <remarks>
+ /// Request tokens stored by this method SHOULD NOT associate any user account with this token.
+ /// It usually opens up security holes in your application to do so. Instead, you associate a user
+ /// account with access tokens (not request tokens) in the <see cref="ExpireRequestTokenAndStoreNewAccessToken"/>
+ /// method.
+ /// </remarks>
+ public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
+ this.tokensAndSecrets[response.Token] = response.TokenSecret;
+ }
+
+ /// <summary>
+ /// Deletes a request token and its associated secret and stores a new access token and secret.
+ /// </summary>
+ /// <param name="consumerKey">The Consumer that is exchanging its request token for an access token.</param>
+ /// <param name="requestToken">The Consumer's request token that should be deleted/expired.</param>
+ /// <param name="accessToken">The new access token that is being issued to the Consumer.</param>
+ /// <param name="accessTokenSecret">The secret associated with the newly issued access token.</param>
+ /// <remarks>
+ /// <para>
+ /// Any scope of granted privileges associated with the request token from the
+ /// original call to <see cref="StoreNewRequestToken"/> should be carried over
+ /// to the new Access Token.
+ /// </para>
+ /// <para>
+ /// To associate a user account with the new access token,
+ /// <see cref="System.Web.HttpContext.User">HttpContext.Current.User</see> may be
+ /// useful in an ASP.NET web application within the implementation of this method.
+ /// Alternatively you may store the access token here without associating with a user account,
+ /// and wait until <see cref="WebConsumer.ProcessUserAuthorization()"/> or
+ /// <see cref="DesktopConsumer.ProcessUserAuthorization(string, string)"/> return the access
+ /// token to associate the access token with a user account at that point.
+ /// </para>
+ /// </remarks>
+ public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
+ this.tokensAndSecrets.Remove(requestToken);
+ this.tokensAndSecrets[accessToken] = accessTokenSecret;
+ }
+
+ /// <summary>
+ /// Classifies a token as a request token or an access token.
+ /// </summary>
+ /// <param name="token">The token to classify.</param>
+ /// <returns>Request or Access token, or invalid if the token is not recognized.</returns>
+ public TokenType GetTokenType(string token) {
+ throw new NotImplementedException();
+ }
+
+ #endregion
+
+ #region IOpenIdOAuthTokenManager Members
+
+ /// <summary>
+ /// Stores a new request token obtained over an OpenID request.
+ /// </summary>
+ /// <param name="consumerKey">The consumer key.</param>
+ /// <param name="authorization">The authorization message carrying the request token and authorized access scope.</param>
+ /// <remarks>
+ /// <para>The token secret is the empty string.</para>
+ /// <para>Tokens stored by this method should be short-lived to mitigate
+ /// possible security threats. Their lifetime should be sufficient for the
+ /// relying party to receive the positive authentication assertion and immediately
+ /// send a follow-up request for the access token.</para>
+ /// </remarks>
+ public void StoreOpenIdAuthorizedRequestToken(string consumerKey, AuthorizationApprovedResponse authorization) {
+ this.tokensAndSecrets[authorization.RequestToken] = String.Empty;
+ }
+
+ #endregion
+ }
+#else
+#error The InMemoryTokenManager class is only for samples as it forgets all tokens whenever the application restarts! You should implement IConsumerTokenManager in your own app that stores tokens in a persistent store (like a SQL database).
+#endif
+} \ No newline at end of file
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs b/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs
index ecb7d6c..0ebb1db 100644
--- a/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs
+++ b/samples/DotNetOpenAuth.ApplicationBlock/TwitterConsumer.cs
@@ -7,10 +7,14 @@
namespace DotNetOpenAuth.ApplicationBlock {
using System;
using System.Collections.Generic;
+ using System.Configuration;
+ using System.Globalization;
using System.IO;
using System.Net;
+ using System.Web;
using System.Xml;
using System.Xml.Linq;
+ using System.Xml.XPath;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
@@ -20,7 +24,8 @@ namespace DotNetOpenAuth.ApplicationBlock {
/// </summary>
public static class TwitterConsumer {
/// <summary>
- /// The description of Twitter's OAuth protocol URIs.
+ /// The description of Twitter's OAuth protocol URIs for use with actually reading/writing
+ /// a user's private Twitter data.
/// </summary>
public static readonly ServiceProviderDescription ServiceDescription = new ServiceProviderDescription {
RequestTokenEndpoint = new MessageReceivingEndpoint("http://twitter.com/oauth/request_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
@@ -30,6 +35,16 @@ namespace DotNetOpenAuth.ApplicationBlock {
};
/// <summary>
+ /// The description of Twitter's OAuth protocol URIs for use with their "Sign in with Twitter" feature.
+ /// </summary>
+ public static readonly ServiceProviderDescription SignInWithTwitterServiceDescription = new ServiceProviderDescription {
+ RequestTokenEndpoint = new MessageReceivingEndpoint("http://twitter.com/oauth/request_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
+ UserAuthorizationEndpoint = new MessageReceivingEndpoint("http://twitter.com/oauth/authenticate", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
+ AccessTokenEndpoint = new MessageReceivingEndpoint("http://twitter.com/oauth/access_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest),
+ TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
+ };
+
+ /// <summary>
/// The URI to get a user's favorites.
/// </summary>
private static readonly MessageReceivingEndpoint GetFavoritesEndpoint = new MessageReceivingEndpoint("http://twitter.com/favorites.xml", HttpDeliveryMethods.GetRequest);
@@ -43,6 +58,18 @@ namespace DotNetOpenAuth.ApplicationBlock {
private static readonly MessageReceivingEndpoint UpdateProfileImageEndpoint = new MessageReceivingEndpoint("http://twitter.com/account/update_profile_image.xml", HttpDeliveryMethods.PostRequest | HttpDeliveryMethods.AuthorizationHeaderRequest);
+ private static readonly MessageReceivingEndpoint VerifyCredentialsEndpoint = new MessageReceivingEndpoint("http://api.twitter.com/1/account/verify_credentials.xml", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest);
+
+ /// <summary>
+ /// The consumer used for the Sign in to Twitter feature.
+ /// </summary>
+ private static WebConsumer signInConsumer;
+
+ /// <summary>
+ /// The lock acquired to initialize the <see cref="signInConsumer"/> field.
+ /// </summary>
+ private static object signInConsumerInitLock = new object();
+
/// <summary>
/// Initializes static members of the <see cref="TwitterConsumer"/> class.
/// </summary>
@@ -51,6 +78,53 @@ namespace DotNetOpenAuth.ApplicationBlock {
ServicePointManager.FindServicePoint(GetFavoritesEndpoint.Location).Expect100Continue = false;
}
+ /// <summary>
+ /// Gets a value indicating whether the Twitter consumer key and secret are set in the web.config file.
+ /// </summary>
+ public static bool IsTwitterConsumerConfigured {
+ get {
+ return !string.IsNullOrEmpty(ConfigurationManager.AppSettings["twitterConsumerKey"]) &&
+ !string.IsNullOrEmpty(ConfigurationManager.AppSettings["twitterConsumerSecret"]);
+ }
+ }
+
+ /// <summary>
+ /// Gets the consumer to use for the Sign in to Twitter feature.
+ /// </summary>
+ /// <value>The twitter sign in.</value>
+ private static WebConsumer TwitterSignIn {
+ get {
+ if (signInConsumer == null) {
+ lock (signInConsumerInitLock) {
+ if (signInConsumer == null) {
+ signInConsumer = new WebConsumer(SignInWithTwitterServiceDescription, ShortTermUserSessionTokenManager);
+ }
+ }
+ }
+
+ return signInConsumer;
+ }
+ }
+
+ private static InMemoryTokenManager ShortTermUserSessionTokenManager {
+ get {
+ var store = HttpContext.Current.Session;
+ var tokenManager = (InMemoryTokenManager)store["TwitterShortTermUserSessionTokenManager"];
+ if (tokenManager == null) {
+ string consumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"];
+ string consumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"];
+ if (IsTwitterConsumerConfigured) {
+ tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
+ store["TwitterShortTermUserSessionTokenManager"] = tokenManager;
+ } else {
+ throw new InvalidOperationException("No Twitter OAuth consumer key and secret could be found in web.config AppSettings.");
+ }
+ }
+
+ return tokenManager;
+ }
+ }
+
public static XDocument GetUpdates(ConsumerBase twitter, string accessToken) {
IncomingWebResponse response = twitter.PrepareAuthorizedRequestAndSend(GetFriendTimelineStatusEndpoint, accessToken);
return XDocument.Load(XmlReader.Create(response.GetResponseReader()));
@@ -62,13 +136,13 @@ namespace DotNetOpenAuth.ApplicationBlock {
}
public static XDocument UpdateProfileBackgroundImage(ConsumerBase twitter, string accessToken, string image, bool tile) {
- HttpWebRequest request = twitter.PrepareAuthorizedRequest(UpdateProfileBackgroundImageEndpoint, accessToken);
- request.ServicePoint.Expect100Continue = false;
var parts = new[] {
MultipartPostPart.CreateFormFilePart("image", image, "image/" + Path.GetExtension(image).Substring(1).ToLowerInvariant()),
MultipartPostPart.CreateFormPart("tile", tile.ToString().ToLowerInvariant()),
};
- IncomingWebResponse response = request.PostMultipart(twitter.Channel.WebRequestHandler, parts);
+ HttpWebRequest request = twitter.PrepareAuthorizedRequest(UpdateProfileBackgroundImageEndpoint, accessToken, parts);
+ request.ServicePoint.Expect100Continue = false;
+ IncomingWebResponse response = twitter.Channel.WebRequestHandler.GetResponse(request);
string responseString = response.GetResponseReader().ReadToEnd();
return XDocument.Parse(responseString);
}
@@ -79,13 +153,72 @@ namespace DotNetOpenAuth.ApplicationBlock {
}
public static XDocument UpdateProfileImage(ConsumerBase twitter, string accessToken, Stream image, string contentType) {
- HttpWebRequest request = twitter.PrepareAuthorizedRequest(UpdateProfileImageEndpoint, accessToken);
var parts = new[] {
MultipartPostPart.CreateFormFilePart("image", "twitterPhoto", contentType, image),
};
- IncomingWebResponse response = request.PostMultipart(twitter.Channel.WebRequestHandler, parts);
+ HttpWebRequest request = twitter.PrepareAuthorizedRequest(UpdateProfileImageEndpoint, accessToken, parts);
+ IncomingWebResponse response = twitter.Channel.WebRequestHandler.GetResponse(request);
string responseString = response.GetResponseReader().ReadToEnd();
return XDocument.Parse(responseString);
}
+
+ public static XDocument VerifyCredentials(ConsumerBase twitter, string accessToken) {
+ IncomingWebResponse response = twitter.PrepareAuthorizedRequestAndSend(VerifyCredentialsEndpoint, accessToken);
+ return XDocument.Load(XmlReader.Create(response.GetResponseReader()));
+ }
+
+ public static string GetUsername(ConsumerBase twitter, string accessToken) {
+ XDocument xml = VerifyCredentials(twitter, accessToken);
+ XPathNavigator nav = xml.CreateNavigator();
+ return nav.SelectSingleNode("/user/screen_name").Value;
+ }
+
+ /// <summary>
+ /// Prepares a redirect that will send the user to Twitter to sign in.
+ /// </summary>
+ /// <param name="forceNewLogin">if set to <c>true</c> the user will be required to re-enter their Twitter credentials even if already logged in to Twitter.</param>
+ /// <returns>The redirect message.</returns>
+ /// <remarks>
+ /// Call <see cref="OutgoingWebResponse.Send"/> or
+ /// <c>return StartSignInWithTwitter().<see cref="MessagingUtilities.AsActionResult">AsActionResult()</see></c>
+ /// to actually perform the redirect.
+ /// </remarks>
+ public static OutgoingWebResponse StartSignInWithTwitter(bool forceNewLogin) {
+ var redirectParameters = new Dictionary<string, string>();
+ if (forceNewLogin) {
+ redirectParameters["force_login"] = "true";
+ }
+ Uri callback = MessagingUtilities.GetRequestUrlFromContext().StripQueryArgumentsWithPrefix("oauth_");
+ var request = TwitterSignIn.PrepareRequestUserAuthorization(callback, null, redirectParameters);
+ return TwitterSignIn.Channel.PrepareResponse(request);
+ }
+
+ /// <summary>
+ /// Checks the incoming web request to see if it carries a Twitter authentication response,
+ /// and provides the user's Twitter screen name and unique id if available.
+ /// </summary>
+ /// <param name="screenName">The user's Twitter screen name.</param>
+ /// <param name="userId">The user's Twitter unique user ID.</param>
+ /// <returns>
+ /// A value indicating whether Twitter authentication was successful;
+ /// otherwise <c>false</c> to indicate that no Twitter response was present.
+ /// </returns>
+ public static bool TryFinishSignInWithTwitter(out string screenName, out int userId) {
+ screenName = null;
+ userId = 0;
+ var response = TwitterSignIn.ProcessUserAuthorization();
+ if (response == null) {
+ return false;
+ }
+
+ screenName = response.ExtraData["screen_name"];
+ userId = int.Parse(response.ExtraData["user_id"]);
+
+ // If we were going to make this LOOK like OpenID even though it isn't,
+ // this seems like a reasonable, secure claimed id to allow the user to assume.
+ OpenId.Identifier fake_claimed_id = string.Format(CultureInfo.InvariantCulture, "http://twitter.com/{0}#{1}", screenName, userId);
+
+ return true;
+ }
}
}
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/YubikeyRelyingParty.cs b/samples/DotNetOpenAuth.ApplicationBlock/YubikeyRelyingParty.cs
new file mode 100644
index 0000000..6be749e
--- /dev/null
+++ b/samples/DotNetOpenAuth.ApplicationBlock/YubikeyRelyingParty.cs
@@ -0,0 +1,207 @@
+//-----------------------------------------------------------------------
+// <copyright file="YubikeyRelyingParty.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.ApplicationBlock {
+ using System;
+ using System.Collections.Specialized;
+ using System.Globalization;
+ using System.IO;
+ using System.Net;
+ using System.Text;
+ using System.Text.RegularExpressions;
+
+ /// <summary>
+ /// The set of possible results from verifying a Yubikey token.
+ /// </summary>
+ public enum YubikeyResult {
+ /// <summary>
+ /// The OTP is valid.
+ /// </summary>
+ Ok,
+
+ /// <summary>
+ /// The OTP is invalid format.
+ /// </summary>
+ BadOtp,
+
+ /// <summary>
+ /// The OTP has already been seen by the service.
+ /// </summary>
+ ReplayedOtp,
+
+ /// <summary>
+ /// The HMAC signature verification failed.
+ /// </summary>
+ /// <remarks>
+ /// This indicates a bug in the relying party code.
+ /// </remarks>
+ BadSignature,
+
+ /// <summary>
+ /// The request lacks a parameter.
+ /// </summary>
+ /// <remarks>
+ /// This indicates a bug in the relying party code.
+ /// </remarks>
+ MissingParameter,
+
+ /// <summary>
+ /// The request id does not exist.
+ /// </summary>
+ NoSuchClient,
+
+ /// <summary>
+ /// The request id is not allowed to verify OTPs.
+ /// </summary>
+ OperationNotAllowed,
+
+ /// <summary>
+ /// Unexpected error in our server. Please contact Yubico if you see this error.
+ /// </summary>
+ BackendError,
+ }
+
+ /// <summary>
+ /// Provides verification of a Yubikey one-time password (OTP) as a means of authenticating
+ /// a user at your web site or application.
+ /// </summary>
+ /// <remarks>
+ /// Please visit http://yubico.com/ for more information about this authentication method.
+ /// </remarks>
+ public class YubikeyRelyingParty {
+ /// <summary>
+ /// The default Yubico authorization server to use for validation and replay protection.
+ /// </summary>
+ private const string DefaultYubicoAuthorizationServer = "https://api.yubico.com/wsapi/verify";
+
+ /// <summary>
+ /// The format of the lines in the Yubico server response.
+ /// </summary>
+ private static readonly Regex ResultLineMatcher = new Regex(@"^(?<key>[^=]+)=(?<value>.*)$");
+
+ /// <summary>
+ /// The Yubico authorization server to use for validation and replay protection.
+ /// </summary>
+ private readonly string yubicoAuthorizationServer;
+
+ /// <summary>
+ /// The authorization ID assigned to your individual site by Yubico.
+ /// </summary>
+ private readonly int yubicoAuthorizationId;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="YubikeyRelyingParty"/> class
+ /// that uses the default Yubico server for validation and replay protection.
+ /// </summary>
+ /// <param name="authorizationId">The authorization ID assigned to your individual site by Yubico.
+ /// Get one from https://upgrade.yubico.com/getapikey/</param>
+ public YubikeyRelyingParty(int authorizationId)
+ : this(authorizationId, DefaultYubicoAuthorizationServer) {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="YubikeyRelyingParty"/> class.
+ /// </summary>
+ /// <param name="authorizationId">The authorization ID assigned to your individual site by Yubico.
+ /// Contact tech@yubico.com if you haven't got an authId for your site.</param>
+ /// <param name="yubicoAuthorizationServer">The Yubico authorization server to use for validation and replay protection.</param>
+ public YubikeyRelyingParty(int authorizationId, string yubicoAuthorizationServer) {
+ if (authorizationId < 0) {
+ throw new ArgumentOutOfRangeException("authorizationId");
+ }
+
+ if (!Uri.IsWellFormedUriString(yubicoAuthorizationServer, UriKind.Absolute)) {
+ throw new ArgumentException("Invalid authorization server URI", "yubicoAuthorizationServer");
+ }
+
+ if (!yubicoAuthorizationServer.StartsWith(Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)) {
+ throw new ArgumentException("HTTPS is required for the Yubico server. HMAC response verification not supported.", "yubicoAuthorizationServer");
+ }
+
+ this.yubicoAuthorizationId = authorizationId;
+ this.yubicoAuthorizationServer = yubicoAuthorizationServer;
+ }
+
+ /// <summary>
+ /// Extracts the username out of a Yubikey token.
+ /// </summary>
+ /// <param name="yubikeyToken">The yubikey token.</param>
+ /// <returns>A 12 character string that is unique for this particular Yubikey device.</returns>
+ public static string ExtractUsername(string yubikeyToken) {
+ EnsureWellFormedToken(yubikeyToken);
+ return yubikeyToken.Substring(0, 12);
+ }
+
+ /// <summary>
+ /// Determines whether the specified yubikey token is valid and has not yet been used.
+ /// </summary>
+ /// <param name="yubikeyToken">The yubikey token.</param>
+ /// <returns>
+ /// <c>true</c> if the specified yubikey token is valid; otherwise, <c>false</c>.
+ /// </returns>
+ /// <exception cref="WebException">Thrown when the validity of the token could not be confirmed due to network issues.</exception>
+ public YubikeyResult IsValid(string yubikeyToken) {
+ EnsureWellFormedToken(yubikeyToken);
+
+ StringBuilder authorizationUri = new StringBuilder(this.yubicoAuthorizationServer);
+ authorizationUri.Append("?id=");
+ authorizationUri.Append(Uri.EscapeDataString(this.yubicoAuthorizationId.ToString(CultureInfo.InvariantCulture)));
+ authorizationUri.Append("&otp=");
+ authorizationUri.Append(Uri.EscapeDataString(yubikeyToken));
+
+ var request = WebRequest.Create(authorizationUri.ToString());
+ using (var response = request.GetResponse()) {
+ using (var responseReader = new StreamReader(response.GetResponseStream())) {
+ string line;
+ var result = new NameValueCollection();
+ while ((line = responseReader.ReadLine()) != null) {
+ Match m = ResultLineMatcher.Match(line);
+ if (m.Success) {
+ result[m.Groups["key"].Value] = m.Groups["value"].Value;
+ }
+ }
+
+ return ParseResult(result["status"]);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Parses the Yubico server result.
+ /// </summary>
+ /// <param name="status">The status field from the response.</param>
+ /// <returns>The enum value representing the result.</returns>
+ private static YubikeyResult ParseResult(string status) {
+ switch (status) {
+ case "OK": return YubikeyResult.Ok;
+ case "BAD_OTP": return YubikeyResult.BadOtp;
+ case "REPLAYED_OTP": return YubikeyResult.ReplayedOtp;
+ case "BAD_SIGNATURE": return YubikeyResult.BadSignature;
+ case "MISSING_PARAMETER": return YubikeyResult.MissingParameter;
+ case "NO_SUCH_CLIENT": return YubikeyResult.NoSuchClient;
+ case "OPERATION_NOT_ALLOWED": return YubikeyResult.OperationNotAllowed;
+ case "BACKEND_ERROR": return YubikeyResult.BackendError;
+ default: throw new ArgumentOutOfRangeException("status", status, "Unexpected status value.");
+ }
+ }
+
+ /// <summary>
+ /// Ensures the OTP is well formed.
+ /// </summary>
+ /// <param name="yubikeyToken">The yubikey token.</param>
+ private static void EnsureWellFormedToken(string yubikeyToken) {
+ if (yubikeyToken == null) {
+ throw new ArgumentNullException("yubikeyToken");
+ }
+
+ yubikeyToken = yubikeyToken.Trim();
+
+ if (yubikeyToken.Length <= 12) {
+ throw new ArgumentException("Yubikey token has unexpected length.");
+ }
+ }
+ }
+}
diff --git a/samples/InfoCardRelyingParty/Site.Master b/samples/InfoCardRelyingParty/Site.Master
index 508f62c..bd3f896 100644
--- a/samples/InfoCardRelyingParty/Site.Master
+++ b/samples/InfoCardRelyingParty/Site.Master
@@ -20,7 +20,7 @@
</span>
<div>
<a href="http://dotnetopenauth.net">
- <img runat="server" src="~/images/dotnetopenid_tiny.gif" title="Jump to the project web site."
+ <img runat="server" src="~/images/DotNetOpenAuth.png" title="Jump to the project web site."
alt="DotNetOpenAuth" border='0' /></a>
</div>
<div>
diff --git a/samples/InfoCardRelyingParty/favicon.ico b/samples/InfoCardRelyingParty/favicon.ico
new file mode 100644
index 0000000..e227dbe
--- /dev/null
+++ b/samples/InfoCardRelyingParty/favicon.ico
Binary files differ
diff --git a/samples/InfoCardRelyingParty/images/DotNetOpenAuth.png b/samples/InfoCardRelyingParty/images/DotNetOpenAuth.png
new file mode 100644
index 0000000..442b986
--- /dev/null
+++ b/samples/InfoCardRelyingParty/images/DotNetOpenAuth.png
Binary files differ
diff --git a/samples/InfoCardRelyingParty/images/dotnetopenid_tiny.gif b/samples/InfoCardRelyingParty/images/dotnetopenid_tiny.gif
deleted file mode 100644
index c4ed4f5..0000000
--- a/samples/InfoCardRelyingParty/images/dotnetopenid_tiny.gif
+++ /dev/null
Binary files differ
diff --git a/samples/OAuthConsumer/App_Code/InMemoryTokenManager.cs b/samples/OAuthConsumer/App_Code/InMemoryTokenManager.cs
deleted file mode 100644
index 120f00a..0000000
--- a/samples/OAuthConsumer/App_Code/InMemoryTokenManager.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="InMemoryTokenManager.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using DotNetOpenAuth.OAuth.ChannelElements;
-using DotNetOpenAuth.OAuth.Messages;
-
-public class InMemoryTokenManager : IConsumerTokenManager {
- private Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
-
- public InMemoryTokenManager(string consumerKey, string consumerSecret) {
- if (String.IsNullOrEmpty(consumerKey)) {
- throw new ArgumentNullException("consumerKey");
- }
-
- this.ConsumerKey = consumerKey;
- this.ConsumerSecret = consumerSecret;
- }
-
- public string ConsumerKey { get; private set; }
-
- public string ConsumerSecret { get; private set; }
-
- #region ITokenManager Members
-
- public string GetTokenSecret(string token) {
- return this.tokensAndSecrets[token];
- }
-
- public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
- this.tokensAndSecrets[response.Token] = response.TokenSecret;
- }
-
- public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
- this.tokensAndSecrets.Remove(requestToken);
- this.tokensAndSecrets[accessToken] = accessTokenSecret;
- }
-
- /// <summary>
- /// Classifies a token as a request token or an access token.
- /// </summary>
- /// <param name="token">The token to classify.</param>
- /// <returns>Request or Access token, or invalid if the token is not recognized.</returns>
- public TokenType GetTokenType(string token) {
- throw new NotImplementedException();
- }
-
- #endregion
-}
diff --git a/samples/OAuthConsumer/App_Code/Logging.cs b/samples/OAuthConsumer/App_Code/Logging.cs
deleted file mode 100644
index e97ff37..0000000
--- a/samples/OAuthConsumer/App_Code/Logging.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Web;
-
-/// <summary>
-/// Logging tools for this sample.
-/// </summary>
-public static class Logging {
- /// <summary>
- /// An application memory cache of recent log messages.
- /// </summary>
- public static StringBuilder LogMessages = new StringBuilder();
-
- /// <summary>
- /// The logger for this sample to use.
- /// </summary>
- public static log4net.ILog Logger = log4net.LogManager.GetLogger("DotNetOpenAuth.ConsumerSample");
-}
diff --git a/samples/OAuthConsumer/App_Code/TracePageAppender.cs b/samples/OAuthConsumer/App_Code/TracePageAppender.cs
deleted file mode 100644
index 93ec9e3..0000000
--- a/samples/OAuthConsumer/App_Code/TracePageAppender.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Web;
-
-public class TracePageAppender : log4net.Appender.AppenderSkeleton {
- protected override void Append(log4net.Core.LoggingEvent loggingEvent) {
- StringWriter sw = new StringWriter(Logging.LogMessages);
- Layout.Format(sw, loggingEvent);
- }
-}
diff --git a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.disco b/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.disco
deleted file mode 100644
index a3cecd3..0000000
--- a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.disco
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
- <contractRef ref="http://localhost:65169/OAuthServiceProvider/DataApi.svc?wsdl" docRef="http://localhost:65169/OAuthServiceProvider/DataApi.svc" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
-</discovery> \ No newline at end of file
diff --git a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/configuration.svcinfo b/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/configuration.svcinfo
deleted file mode 100644
index d014dc9..0000000
--- a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/configuration.svcinfo
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
- <behaviors />
- <bindings>
- <binding digest="System.ServiceModel.Configuration.WSHttpBindingElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data hostNameComparisonMode=&quot;StrongWildcard&quot; messageEncoding=&quot;Text&quot; name=&quot;WSHttpBinding_IDataApi1&quot; textEncoding=&quot;utf-8&quot; transactionFlow=&quot;false&quot;&gt;&lt;readerQuotas maxArrayLength=&quot;16384&quot; maxBytesPerRead=&quot;4096&quot; maxDepth=&quot;32&quot; maxNameTableCharCount=&quot;16384&quot; maxStringContentLength=&quot;8192&quot; /&gt;&lt;reliableSession enabled=&quot;false&quot; inactivityTimeout=&quot;00:10:00&quot; ordered=&quot;true&quot; /&gt;&lt;security mode=&quot;Message&quot;&gt;&lt;message algorithmSuite=&quot;Default&quot; clientCredentialType=&quot;Windows&quot; establishSecurityContext=&quot;true&quot; negotiateServiceCredential=&quot;true&quot; /&gt;&lt;transport clientCredentialType=&quot;Windows&quot; proxyCredentialType=&quot;None&quot; realm=&quot;&quot; /&gt;&lt;/security&gt;&lt;/Data&gt;" bindingType="wsHttpBinding" name="WSHttpBinding_IDataApi1" />
- </bindings>
- <endpoints>
- <endpoint normalizedDigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;http://localhost:65169/OAuthServiceProvider/DataApi.svc&quot; binding=&quot;wsHttpBinding&quot; bindingConfiguration=&quot;WSHttpBinding_IDataApi1&quot; contract=&quot;SampleServiceProvider.IDataApi&quot; name=&quot;WSHttpBinding_IDataApi1&quot;&gt;&lt;identity&gt;&lt;dns value=&quot;localhost&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;http://localhost:65169/OAuthServiceProvider/DataApi.svc&quot; binding=&quot;wsHttpBinding&quot; bindingConfiguration=&quot;WSHttpBinding_IDataApi1&quot; contract=&quot;SampleServiceProvider.IDataApi&quot; name=&quot;WSHttpBinding_IDataApi1&quot;&gt;&lt;identity&gt;&lt;dns value=&quot;localhost&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" contractName="SampleServiceProvider.IDataApi" name="WSHttpBinding_IDataApi1" />
- </endpoints>
-</configurationSnapshot> \ No newline at end of file
diff --git a/samples/OAuthConsumer/Bin/DotNetOpenAuth.dll.refresh_ b/samples/OAuthConsumer/Bin/DotNetOpenAuth.dll.refresh_
deleted file mode 100644
index 946bd4b..0000000
--- a/samples/OAuthConsumer/Bin/DotNetOpenAuth.dll.refresh_
+++ /dev/null
Binary files differ
diff --git a/samples/OAuthConsumer/Bin/log4net.dll.refresh b/samples/OAuthConsumer/Bin/log4net.dll.refresh
deleted file mode 100644
index ede40da..0000000
--- a/samples/OAuthConsumer/Bin/log4net.dll.refresh
+++ /dev/null
Binary files differ
diff --git a/samples/OAuthConsumer/Code/Logging.cs b/samples/OAuthConsumer/Code/Logging.cs
new file mode 100644
index 0000000..510ea85
--- /dev/null
+++ b/samples/OAuthConsumer/Code/Logging.cs
@@ -0,0 +1,22 @@
+namespace OAuthConsumer {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Web;
+
+ /// <summary>
+ /// Logging tools for this sample.
+ /// </summary>
+ public static class Logging {
+ /// <summary>
+ /// An application memory cache of recent log messages.
+ /// </summary>
+ public static StringBuilder LogMessages = new StringBuilder();
+
+ /// <summary>
+ /// The logger for this sample to use.
+ /// </summary>
+ public static log4net.ILog Logger = log4net.LogManager.GetLogger("DotNetOpenAuth.OAuthConsumer");
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthConsumer/Code/TracePageAppender.cs b/samples/OAuthConsumer/Code/TracePageAppender.cs
new file mode 100644
index 0000000..5d3ba36
--- /dev/null
+++ b/samples/OAuthConsumer/Code/TracePageAppender.cs
@@ -0,0 +1,13 @@
+namespace OAuthConsumer {
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Web;
+
+ public class TracePageAppender : log4net.Appender.AppenderSkeleton {
+ protected override void Append(log4net.Core.LoggingEvent loggingEvent) {
+ StringWriter sw = new StringWriter(Logging.LogMessages);
+ Layout.Format(sw, loggingEvent);
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthConsumer/Default.aspx b/samples/OAuthConsumer/Default.aspx
index aa4ef79..c952877 100644
--- a/samples/OAuthConsumer/Default.aspx
+++ b/samples/OAuthConsumer/Default.aspx
@@ -8,6 +8,7 @@
<ul>
<li><a href="GoogleAddressBook.aspx">Download your Gmail address book</a></li>
<li><a href="Twitter.aspx">Get your Twitter updates</a></li>
+ <li><a href="SignInWithTwitter.aspx">Sign In With Twitter</a></li>
<li><a href="SampleWcf.aspx">Interop with Service Provider sample using WCF w/ OAuth</a></li>
</ul>
</asp:Content>
diff --git a/samples/OAuthConsumer/Global.asax b/samples/OAuthConsumer/Global.asax
index fa4ca9b..06ffcd8 100644
--- a/samples/OAuthConsumer/Global.asax
+++ b/samples/OAuthConsumer/Global.asax
@@ -1,31 +1 @@
-<%@ Application Language="C#" %>
-
-<script RunAt="server">
- void Application_Start(object sender, EventArgs e) {
- log4net.Config.XmlConfigurator.Configure();
- Logging.Logger.Info("Sample starting...");
- }
-
- void Application_End(object sender, EventArgs e) {
- Logging.Logger.Info("Sample shutting down...");
- // this would be automatic, but in partial trust scenarios it is not.
- log4net.LogManager.Shutdown();
- }
-
- void Application_Error(object sender, EventArgs e) {
- Logging.Logger.ErrorFormat("An unhandled exception was raised. Details follow: {0}", HttpContext.Current.Server.GetLastError());
- }
-
- void Session_Start(object sender, EventArgs e) {
- // Code that runs when a new session is started
-
- }
-
- void Session_End(object sender, EventArgs e) {
- // Code that runs when a session ends.
- // Note: The Session_End event is raised only when the sessionstate mode
- // is set to InProc in the Web.config file. If session mode is set to StateServer
- // or SQLServer, the event is not raised.
-
- }
-</script>
+<%@ Application Language="C#" Inherits="OAuthConsumer.Global" CodeBehind="Global.asax.cs" %>
diff --git a/samples/OAuthConsumer/Global.asax.cs b/samples/OAuthConsumer/Global.asax.cs
new file mode 100644
index 0000000..10f297e
--- /dev/null
+++ b/samples/OAuthConsumer/Global.asax.cs
@@ -0,0 +1,35 @@
+namespace OAuthConsumer {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+
+ public partial class Global : HttpApplication {
+ protected void Application_Start(object sender, EventArgs e) {
+ log4net.Config.XmlConfigurator.Configure();
+ Logging.Logger.Info("Sample starting...");
+ }
+
+ protected void Application_End(object sender, EventArgs e) {
+ Logging.Logger.Info("Sample shutting down...");
+
+ // this would be automatic, but in partial trust scenarios it is not.
+ log4net.LogManager.Shutdown();
+ }
+
+ protected void Application_Error(object sender, EventArgs e) {
+ Logging.Logger.ErrorFormat("An unhandled exception was raised. Details follow: {0}", HttpContext.Current.Server.GetLastError());
+ }
+
+ protected void Session_Start(object sender, EventArgs e) {
+ // Code that runs when a new session is started
+ }
+
+ protected void Session_End(object sender, EventArgs e) {
+ // Code that runs when a session ends.
+ // Note: The Session_End event is raised only when the sessionstate mode
+ // is set to InProc in the Web.config file. If session mode is set to StateServer
+ // or SQLServer, the event is not raised.
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthConsumer/GoogleAddressBook.aspx b/samples/OAuthConsumer/GoogleAddressBook.aspx
index 56179b7..19fb505 100644
--- a/samples/OAuthConsumer/GoogleAddressBook.aspx
+++ b/samples/OAuthConsumer/GoogleAddressBook.aspx
@@ -1,5 +1,5 @@
<%@ Page Title="Gmail address book demo" Language="C#" MasterPageFile="~/MasterPage.master"
- AutoEventWireup="true" CodeFile="GoogleAddressBook.aspx.cs" Inherits="GoogleAddressBook" %>
+ AutoEventWireup="true" Inherits="OAuthConsumer.GoogleAddressBook" Codebehind="GoogleAddressBook.aspx.cs" %>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
@@ -16,7 +16,7 @@
<asp:View runat="server">
<h2>Updates</h2>
<p>Ok, Google has authorized us to download your contacts. Click &#39;Get address book&#39;
- to download the first 25 contacts to this sample. Notice how we never asked you
+ to download the first 5 contacts to this sample. Notice how we never asked you
for your Google username or password. </p>
<asp:Button ID="getAddressBookButton" runat="server" OnClick="getAddressBookButton_Click"
Text="Get address book" />
diff --git a/samples/OAuthConsumer/GoogleAddressBook.aspx.cs b/samples/OAuthConsumer/GoogleAddressBook.aspx.cs
index 463d7e3..1ca3abe 100644
--- a/samples/OAuthConsumer/GoogleAddressBook.aspx.cs
+++ b/samples/OAuthConsumer/GoogleAddressBook.aspx.cs
@@ -1,73 +1,75 @@
-using System;
-using System.Configuration;
-using System.Linq;
-using System.Text;
-using System.Web;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Xml.Linq;
-using DotNetOpenAuth.ApplicationBlock;
-using DotNetOpenAuth.OAuth;
+namespace OAuthConsumer {
+ using System;
+ using System.Configuration;
+ using System.Linq;
+ using System.Text;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using System.Xml.Linq;
+ using DotNetOpenAuth.ApplicationBlock;
+ using DotNetOpenAuth.OAuth;
-/// <summary>
-/// A page to demonstrate downloading a Gmail address book using OAuth.
-/// </summary>
-public partial class GoogleAddressBook : System.Web.UI.Page {
- private string AccessToken {
- get { return (string)Session["GoogleAccessToken"]; }
- set { Session["GoogleAccessToken"] = value; }
- }
+ /// <summary>
+ /// A page to demonstrate downloading a Gmail address book using OAuth.
+ /// </summary>
+ public partial class GoogleAddressBook : System.Web.UI.Page {
+ private string AccessToken {
+ get { return (string)Session["GoogleAccessToken"]; }
+ set { Session["GoogleAccessToken"] = value; }
+ }
- private InMemoryTokenManager TokenManager {
- get {
- var tokenManager = (InMemoryTokenManager)Application["GoogleTokenManager"];
- if (tokenManager == null) {
- string consumerKey = ConfigurationManager.AppSettings["googleConsumerKey"];
- string consumerSecret = ConfigurationManager.AppSettings["googleConsumerSecret"];
- if (!string.IsNullOrEmpty(consumerKey)) {
- tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
- Application["GoogleTokenManager"] = tokenManager;
+ private InMemoryTokenManager TokenManager {
+ get {
+ var tokenManager = (InMemoryTokenManager)Application["GoogleTokenManager"];
+ if (tokenManager == null) {
+ string consumerKey = ConfigurationManager.AppSettings["googleConsumerKey"];
+ string consumerSecret = ConfigurationManager.AppSettings["googleConsumerSecret"];
+ if (!string.IsNullOrEmpty(consumerKey)) {
+ tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
+ Application["GoogleTokenManager"] = tokenManager;
+ }
}
- }
- return tokenManager;
+ return tokenManager;
+ }
}
- }
- protected void Page_Load(object sender, EventArgs e) {
- if (this.TokenManager != null) {
- MultiView1.ActiveViewIndex = 1;
+ protected void Page_Load(object sender, EventArgs e) {
+ if (this.TokenManager != null) {
+ this.MultiView1.ActiveViewIndex = 1;
- if (!IsPostBack) {
- var google = new WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);
+ if (!IsPostBack) {
+ var google = new WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);
- // Is Google calling back with authorization?
- var accessTokenResponse = google.ProcessUserAuthorization();
- if (accessTokenResponse != null) {
- this.AccessToken = accessTokenResponse.AccessToken;
- } else if (this.AccessToken == null) {
- // If we don't yet have access, immediately request it.
- GoogleConsumer.RequestAuthorization(google, GoogleConsumer.Applications.Contacts);
+ // Is Google calling back with authorization?
+ var accessTokenResponse = google.ProcessUserAuthorization();
+ if (accessTokenResponse != null) {
+ this.AccessToken = accessTokenResponse.AccessToken;
+ } else if (this.AccessToken == null) {
+ // If we don't yet have access, immediately request it.
+ GoogleConsumer.RequestAuthorization(google, GoogleConsumer.Applications.Contacts);
+ }
}
}
}
- }
- protected void getAddressBookButton_Click(object sender, EventArgs e) {
- var google = new WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);
+ protected void getAddressBookButton_Click(object sender, EventArgs e) {
+ var google = new WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);
- XDocument contactsDocument = GoogleConsumer.GetContacts(google, this.AccessToken);
- var contacts = from entry in contactsDocument.Root.Elements(XName.Get("entry", "http://www.w3.org/2005/Atom"))
- select new { Name = entry.Element(XName.Get("title", "http://www.w3.org/2005/Atom")).Value, Email = entry.Element(XName.Get("email", "http://schemas.google.com/g/2005")).Attribute("address").Value };
- StringBuilder tableBuilder = new StringBuilder();
- tableBuilder.Append("<table><tr><td>Name</td><td>Email</td></tr>");
- foreach (var contact in contacts) {
- tableBuilder.AppendFormat(
- "<tr><td>{0}</td><td>{1}</td></tr>",
- HttpUtility.HtmlEncode(contact.Name),
- HttpUtility.HtmlEncode(contact.Email));
+ XDocument contactsDocument = GoogleConsumer.GetContacts(google, this.AccessToken, 5);
+ var contacts = from entry in contactsDocument.Root.Elements(XName.Get("entry", "http://www.w3.org/2005/Atom"))
+ select new { Name = entry.Element(XName.Get("title", "http://www.w3.org/2005/Atom")).Value, Email = entry.Element(XName.Get("email", "http://schemas.google.com/g/2005")).Attribute("address").Value };
+ StringBuilder tableBuilder = new StringBuilder();
+ tableBuilder.Append("<table><tr><td>Name</td><td>Email</td></tr>");
+ foreach (var contact in contacts) {
+ tableBuilder.AppendFormat(
+ "<tr><td>{0}</td><td>{1}</td></tr>",
+ HttpUtility.HtmlEncode(contact.Name),
+ HttpUtility.HtmlEncode(contact.Email));
+ }
+ tableBuilder.Append("</table>");
+ this.resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
}
- tableBuilder.Append("</table>");
- resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
}
-}
+} \ No newline at end of file
diff --git a/samples/OAuthConsumer/GoogleAddressBook.aspx.designer.cs b/samples/OAuthConsumer/GoogleAddressBook.aspx.designer.cs
new file mode 100644
index 0000000..64558d5
--- /dev/null
+++ b/samples/OAuthConsumer/GoogleAddressBook.aspx.designer.cs
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthConsumer {
+
+
+ public partial class GoogleAddressBook {
+
+ /// <summary>
+ /// MultiView1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.MultiView MultiView1;
+
+ /// <summary>
+ /// getAddressBookButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button getAddressBookButton;
+
+ /// <summary>
+ /// resultsPlaceholder control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.PlaceHolder resultsPlaceholder;
+ }
+}
diff --git a/samples/OAuthConsumer/OAuthConsumer.csproj b/samples/OAuthConsumer/OAuthConsumer.csproj
new file mode 100644
index 0000000..8092ba2
--- /dev/null
+++ b/samples/OAuthConsumer/OAuthConsumer.csproj
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>
+ </ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9529606E-AF76-4387-BFB7-3D10A5B399AA}</ProjectGuid>
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>OAuthConsumer</RootNamespace>
+ <AssemblyName>OAuthConsumer</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>TRACE;DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup>
+ <DefineConstants>$(DefineConstants);SAMPLESONLY</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net">
+ <HintPath>..\..\lib\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.ServiceModel" />
+ <Reference Include="System.Web.Extensions" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.EnterpriseServices" />
+ <Reference Include="System.Web.DynamicData" />
+ <Reference Include="System.Web.Entity" />
+ <Reference Include="System.Xml.Linq" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Default.aspx" />
+ <Content Include="favicon.ico" />
+ <Content Include="Global.asax" />
+ <Content Include="GoogleAddressBook.aspx" />
+ <Content Include="images\Sign-in-with-Twitter-darker.png" />
+ <Content Include="SampleWcf.aspx" />
+ <None Include="Service References\SampleServiceProvider\DataApi.disco" />
+ <None Include="Service References\SampleServiceProvider\configuration91.svcinfo" />
+ <None Include="Service References\SampleServiceProvider\configuration.svcinfo" />
+ <None Include="Service References\SampleServiceProvider\Reference.svcmap">
+ <Generator>WCF Proxy Generator</Generator>
+ <LastGenOutput>Reference.cs</LastGenOutput>
+ </None>
+ <Content Include="SignInWithTwitter.aspx" />
+ <Content Include="TracePage.aspx" />
+ <Content Include="Twitter.aspx" />
+ <Content Include="Web.config" />
+ <None Include="Service References\SampleServiceProvider\DataApi1.xsd">
+ <SubType>Designer</SubType>
+ </None>
+ <None Include="Service References\SampleServiceProvider\DataApi2.xsd">
+ <SubType>Designer</SubType>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\DotNetOpenAuth.ApplicationBlock\InMemoryTokenManager.cs">
+ <Link>Code\InMemoryTokenManager.cs</Link>
+ </Compile>
+ <Compile Include="Global.asax.cs">
+ <DependentUpon>Global.asax</DependentUpon>
+ </Compile>
+ <Compile Include="GoogleAddressBook.aspx.designer.cs">
+ <DependentUpon>GoogleAddressBook.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="SampleWcf.aspx.cs">
+ <DependentUpon>SampleWcf.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="SampleWcf.aspx.designer.cs">
+ <DependentUpon>SampleWcf.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Service References\SampleServiceProvider\Reference.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Reference.svcmap</DependentUpon>
+ </Compile>
+ <Compile Include="SignInWithTwitter.aspx.cs">
+ <DependentUpon>SignInWithTwitter.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="SignInWithTwitter.aspx.designer.cs">
+ <DependentUpon>SignInWithTwitter.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="TracePage.aspx.cs">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="TracePage.aspx.designer.cs">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Twitter.aspx.cs">
+ <DependentUpon>Twitter.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Code\Logging.cs" />
+ <Compile Include="Code\TracePageAppender.cs" />
+ <Compile Include="GoogleAddressBook.aspx.cs">
+ <DependentUpon>GoogleAddressBook.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Twitter.aspx.designer.cs">
+ <DependentUpon>Twitter.aspx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="App_Data\" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="MasterPage.master" />
+ <None Include="Service References\SampleServiceProvider\DataApi.wsdl" />
+ <None Include="Service References\SampleServiceProvider\DataApi.xsd">
+ <SubType>Designer</SubType>
+ </None>
+ <None Include="Settings.StyleCop" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\DotNetOpenAuth\DotNetOpenAuth.csproj">
+ <Project>{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}</Project>
+ <Name>DotNetOpenAuth</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\DotNetOpenAuth.ApplicationBlock\DotNetOpenAuth.ApplicationBlock.csproj">
+ <Project>{AA78D112-D889-414B-A7D4-467B34C7B663}</Project>
+ <Name>DotNetOpenAuth.ApplicationBlock</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <WCFMetadata Include="Service References\" />
+ </ItemGroup>
+ <ItemGroup>
+ <WCFMetadataStorage Include="Service References\SampleServiceProvider\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+ <WebProjectProperties>
+ <UseIIS>False</UseIIS>
+ <AutoAssignPort>False</AutoAssignPort>
+ <DevelopmentServerPort>59721</DevelopmentServerPort>
+ <DevelopmentServerVPath>/</DevelopmentServerVPath>
+ <IISUrl>
+ </IISUrl>
+ <NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
+ <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+ </WebProjectProperties>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/samples/OAuthConsumer/Properties/AssemblyInfo.cs b/samples/OAuthConsumer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..35efa1c
--- /dev/null
+++ b/samples/OAuthConsumer/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OAuthConsumer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OAuthConsumer")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("12549916-9ec2-4cf6-9fe3-82ea1f6ea665")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/samples/OAuthConsumer/SampleWcf.aspx b/samples/OAuthConsumer/SampleWcf.aspx
index b3eda25..fb318ce 100644
--- a/samples/OAuthConsumer/SampleWcf.aspx
+++ b/samples/OAuthConsumer/SampleWcf.aspx
@@ -1,5 +1,4 @@
-<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
- CodeFile="SampleWcf.aspx.cs" Inherits="SampleWcf" %>
+<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="OAuthConsumer.SampleWcf" Codebehind="SampleWcf.aspx.cs" %>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
<fieldset title="Authorization">
diff --git a/samples/OAuthConsumer/SampleWcf.aspx.cs b/samples/OAuthConsumer/SampleWcf.aspx.cs
index 7572dd8..489e294 100644
--- a/samples/OAuthConsumer/SampleWcf.aspx.cs
+++ b/samples/OAuthConsumer/SampleWcf.aspx.cs
@@ -1,116 +1,119 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Net;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-using System.ServiceModel.Security;
-using System.Web.UI.WebControls;
-using DotNetOpenAuth;
-using DotNetOpenAuth.Messaging;
-using DotNetOpenAuth.OAuth;
-using DotNetOpenAuth.OAuth.ChannelElements;
-using SampleServiceProvider;
+namespace OAuthConsumer {
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Linq;
+ using System.Net;
+ using System.ServiceModel;
+ using System.ServiceModel.Channels;
+ using System.ServiceModel.Security;
+ using System.Web.UI.WebControls;
+ using DotNetOpenAuth;
+ using DotNetOpenAuth.ApplicationBlock;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OAuth;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+ using OAuthConsumer.SampleServiceProvider;
-/// <summary>
-/// Sample consumer of our Service Provider sample's WCF service.
-/// </summary>
-public partial class SampleWcf : System.Web.UI.Page {
- protected void Page_Load(object sender, EventArgs e) {
- if (!IsPostBack) {
- if (Session["WcfTokenManager"] != null) {
- WebConsumer consumer = this.CreateConsumer();
- var accessTokenMessage = consumer.ProcessUserAuthorization();
- if (accessTokenMessage != null) {
- Session["WcfAccessToken"] = accessTokenMessage.AccessToken;
- authorizationLabel.Text = "Authorized! Access token: " + accessTokenMessage.AccessToken;
+ /// <summary>
+ /// Sample consumer of our Service Provider sample's WCF service.
+ /// </summary>
+ public partial class SampleWcf : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ if (!IsPostBack) {
+ if (Session["WcfTokenManager"] != null) {
+ WebConsumer consumer = this.CreateConsumer();
+ var accessTokenMessage = consumer.ProcessUserAuthorization();
+ if (accessTokenMessage != null) {
+ Session["WcfAccessToken"] = accessTokenMessage.AccessToken;
+ this.authorizationLabel.Text = "Authorized! Access token: " + accessTokenMessage.AccessToken;
+ }
}
}
}
- }
- protected void getAuthorizationButton_Click(object sender, EventArgs e) {
- WebConsumer consumer = this.CreateConsumer();
- UriBuilder callback = new UriBuilder(Request.Url);
- callback.Query = null;
- string[] scopes = (from item in scopeList.Items.OfType<ListItem>()
- where item.Selected
- select item.Value).ToArray();
- string scope = string.Join("|", scopes);
- var requestParams = new Dictionary<string, string> {
+ protected void getAuthorizationButton_Click(object sender, EventArgs e) {
+ WebConsumer consumer = this.CreateConsumer();
+ UriBuilder callback = new UriBuilder(Request.Url);
+ callback.Query = null;
+ string[] scopes = (from item in this.scopeList.Items.OfType<ListItem>()
+ where item.Selected
+ select item.Value).ToArray();
+ string scope = string.Join("|", scopes);
+ var requestParams = new Dictionary<string, string> {
{ "scope", scope },
};
- var response = consumer.PrepareRequestUserAuthorization(callback.Uri, requestParams, null);
- consumer.Channel.Send(response);
- }
-
- protected void getNameButton_Click(object sender, EventArgs e) {
- try {
- nameLabel.Text = CallService(client => client.GetName());
- } catch (SecurityAccessDeniedException) {
- nameLabel.Text = "Access denied!";
+ var response = consumer.PrepareRequestUserAuthorization(callback.Uri, requestParams, null);
+ consumer.Channel.Send(response);
}
- }
- protected void getAgeButton_Click(object sender, EventArgs e) {
- try {
- int? age = CallService(client => client.GetAge());
- ageLabel.Text = age.HasValue ? age.Value.ToString(CultureInfo.CurrentCulture) : "not available";
- } catch (SecurityAccessDeniedException) {
- ageLabel.Text = "Access denied!";
+ protected void getNameButton_Click(object sender, EventArgs e) {
+ try {
+ this.nameLabel.Text = CallService(client => client.GetName());
+ } catch (SecurityAccessDeniedException) {
+ this.nameLabel.Text = "Access denied!";
+ }
}
- }
- protected void getFavoriteSites_Click(object sender, EventArgs e) {
- try {
- string[] favoriteSites = CallService(client => client.GetFavoriteSites());
- favoriteSitesLabel.Text = string.Join(", ", favoriteSites);
- } catch (SecurityAccessDeniedException) {
- favoriteSitesLabel.Text = "Access denied!";
+ protected void getAgeButton_Click(object sender, EventArgs e) {
+ try {
+ int? age = CallService(client => client.GetAge());
+ this.ageLabel.Text = age.HasValue ? age.Value.ToString(CultureInfo.CurrentCulture) : "not available";
+ } catch (SecurityAccessDeniedException) {
+ this.ageLabel.Text = "Access denied!";
+ }
}
- }
- private T CallService<T>(Func<DataApiClient, T> predicate) {
- DataApiClient client = new DataApiClient();
- var serviceEndpoint = new MessageReceivingEndpoint(client.Endpoint.Address.Uri, HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest);
- var accessToken = Session["WcfAccessToken"] as string;
- if (accessToken == null) {
- throw new InvalidOperationException("No access token!");
+ protected void getFavoriteSites_Click(object sender, EventArgs e) {
+ try {
+ string[] favoriteSites = CallService(client => client.GetFavoriteSites());
+ this.favoriteSitesLabel.Text = string.Join(", ", favoriteSites);
+ } catch (SecurityAccessDeniedException) {
+ this.favoriteSitesLabel.Text = "Access denied!";
+ }
}
- WebConsumer consumer = this.CreateConsumer();
- WebRequest httpRequest = consumer.PrepareAuthorizedRequest(serviceEndpoint, accessToken);
- HttpRequestMessageProperty httpDetails = new HttpRequestMessageProperty();
- httpDetails.Headers[HttpRequestHeader.Authorization] = httpRequest.Headers[HttpRequestHeader.Authorization];
- using (OperationContextScope scope = new OperationContextScope(client.InnerChannel)) {
- OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpDetails;
- return predicate(client);
- }
- }
+ private T CallService<T>(Func<DataApiClient, T> predicate) {
+ DataApiClient client = new DataApiClient();
+ var serviceEndpoint = new MessageReceivingEndpoint(client.Endpoint.Address.Uri, HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest);
+ var accessToken = Session["WcfAccessToken"] as string;
+ if (accessToken == null) {
+ throw new InvalidOperationException("No access token!");
+ }
+ WebConsumer consumer = this.CreateConsumer();
+ WebRequest httpRequest = consumer.PrepareAuthorizedRequest(serviceEndpoint, accessToken);
- private WebConsumer CreateConsumer() {
- string consumerKey = "sampleconsumer";
- string consumerSecret = "samplesecret";
- var tokenManager = Session["WcfTokenManager"] as InMemoryTokenManager;
- if (tokenManager == null) {
- tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
- Session["WcfTokenManager"] = tokenManager;
+ HttpRequestMessageProperty httpDetails = new HttpRequestMessageProperty();
+ httpDetails.Headers[HttpRequestHeader.Authorization] = httpRequest.Headers[HttpRequestHeader.Authorization];
+ using (OperationContextScope scope = new OperationContextScope(client.InnerChannel)) {
+ OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpDetails;
+ return predicate(client);
+ }
}
- MessageReceivingEndpoint oauthEndpoint = new MessageReceivingEndpoint(
- new Uri("http://localhost:65169/OAuthServiceProvider/OAuth.ashx"),
- HttpDeliveryMethods.PostRequest);
- WebConsumer consumer = new WebConsumer(
- new ServiceProviderDescription {
- RequestTokenEndpoint = oauthEndpoint,
- UserAuthorizationEndpoint = oauthEndpoint,
- AccessTokenEndpoint = oauthEndpoint,
- TamperProtectionElements = new DotNetOpenAuth.Messaging.ITamperProtectionChannelBindingElement[] {
+
+ private WebConsumer CreateConsumer() {
+ string consumerKey = "sampleconsumer";
+ string consumerSecret = "samplesecret";
+ var tokenManager = Session["WcfTokenManager"] as InMemoryTokenManager;
+ if (tokenManager == null) {
+ tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
+ Session["WcfTokenManager"] = tokenManager;
+ }
+ MessageReceivingEndpoint oauthEndpoint = new MessageReceivingEndpoint(
+ new Uri("http://localhost:65169/OAuth.ashx"),
+ HttpDeliveryMethods.PostRequest);
+ WebConsumer consumer = new WebConsumer(
+ new ServiceProviderDescription {
+ RequestTokenEndpoint = oauthEndpoint,
+ UserAuthorizationEndpoint = oauthEndpoint,
+ AccessTokenEndpoint = oauthEndpoint,
+ TamperProtectionElements = new DotNetOpenAuth.Messaging.ITamperProtectionChannelBindingElement[] {
new HmacSha1SigningBindingElement(),
},
- },
- tokenManager);
+ },
+ tokenManager);
- return consumer;
+ return consumer;
+ }
}
-}
+} \ No newline at end of file
diff --git a/samples/OAuthConsumer/SampleWcf.aspx.designer.cs b/samples/OAuthConsumer/SampleWcf.aspx.designer.cs
new file mode 100644
index 0000000..c041338
--- /dev/null
+++ b/samples/OAuthConsumer/SampleWcf.aspx.designer.cs
@@ -0,0 +1,96 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthConsumer {
+
+
+ public partial class SampleWcf {
+
+ /// <summary>
+ /// scopeList control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.CheckBoxList scopeList;
+
+ /// <summary>
+ /// getAuthorizationButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button getAuthorizationButton;
+
+ /// <summary>
+ /// authorizationLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label authorizationLabel;
+
+ /// <summary>
+ /// getNameButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button getNameButton;
+
+ /// <summary>
+ /// nameLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label nameLabel;
+
+ /// <summary>
+ /// getAgeButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button getAgeButton;
+
+ /// <summary>
+ /// ageLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label ageLabel;
+
+ /// <summary>
+ /// getFavoriteSites control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button getFavoriteSites;
+
+ /// <summary>
+ /// favoriteSitesLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label favoriteSitesLabel;
+ }
+}
diff --git a/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.disco b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.disco
new file mode 100644
index 0000000..f8d5e5b
--- /dev/null
+++ b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.disco
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
+ <contractRef ref="http://localhost:65169/DataApi.svc?wsdl" docRef="http://localhost:65169/DataApi.svc" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
+</discovery> \ No newline at end of file
diff --git a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.wsdl b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.wsdl
index 46a07e1..702762a 100644
--- a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.wsdl
+++ b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.wsdl
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:tns="http://tempuri.org/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="DataApi" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+<wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DataApi" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsp:Policy wsu:Id="WSHttpBinding_IDataApi_policy">
<wsp:ExactlyOne>
<wsp:All>
@@ -222,9 +222,9 @@
</wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
- <xsd:import schemaLocation="http://localhost:65169/OAuthServiceProvider/DataApi.svc?xsd=xsd0" namespace="http://tempuri.org/" />
- <xsd:import schemaLocation="http://localhost:65169/OAuthServiceProvider/DataApi.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
- <xsd:import schemaLocation="http://localhost:65169/OAuthServiceProvider/DataApi.svc?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
+ <xsd:import schemaLocation="http://localhost:65169/DataApi.svc?xsd=xsd0" namespace="http://tempuri.org/" />
+ <xsd:import schemaLocation="http://localhost:65169/DataApi.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
+ <xsd:import schemaLocation="http://localhost:65169/DataApi.svc?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="IDataApi_GetAge_InputMessage">
@@ -298,9 +298,9 @@
</wsdl:binding>
<wsdl:service name="DataApi">
<wsdl:port name="WSHttpBinding_IDataApi" binding="tns:WSHttpBinding_IDataApi">
- <soap12:address location="http://localhost:65169/OAuthServiceProvider/DataApi.svc" />
+ <soap12:address location="http://localhost:65169/DataApi.svc" />
<wsa10:EndpointReference>
- <wsa10:Address>http://localhost:65169/OAuthServiceProvider/DataApi.svc</wsa10:Address>
+ <wsa10:Address>http://localhost:65169/DataApi.svc</wsa10:Address>
<Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
<Dns>localhost</Dns>
</Identity>
diff --git a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi1.xsd b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.xsd
index bcb9ef8..3109534 100644
--- a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi1.xsd
+++ b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi.xsd
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:import schemaLocation="http://localhost:65169/OAuthServiceProvider/DataApi.svc?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
+ <xs:import schemaLocation="http://localhost:65169/DataApi.svc?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<xs:element name="GetAge">
<xs:complexType>
<xs:sequence />
diff --git a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.xsd b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi1.xsd
index d58e7f3..d58e7f3 100644
--- a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi.xsd
+++ b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi1.xsd
diff --git a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi2.xsd b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi2.xsd
index 04a74a4..04a74a4 100644
--- a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/DataApi2.xsd
+++ b/samples/OAuthConsumer/Service References/SampleServiceProvider/DataApi2.xsd
diff --git a/samples/OAuthConsumer/Service References/SampleServiceProvider/Reference.cs b/samples/OAuthConsumer/Service References/SampleServiceProvider/Reference.cs
new file mode 100644
index 0000000..a1d1eae
--- /dev/null
+++ b/samples/OAuthConsumer/Service References/SampleServiceProvider/Reference.cs
@@ -0,0 +1,67 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.1
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthConsumer.SampleServiceProvider {
+
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+ [System.ServiceModel.ServiceContractAttribute(ConfigurationName="SampleServiceProvider.IDataApi")]
+ public interface IDataApi {
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDataApi/GetAge", ReplyAction="http://tempuri.org/IDataApi/GetAgeResponse")]
+ System.Nullable<int> GetAge();
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDataApi/GetName", ReplyAction="http://tempuri.org/IDataApi/GetNameResponse")]
+ string GetName();
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDataApi/GetFavoriteSites", ReplyAction="http://tempuri.org/IDataApi/GetFavoriteSitesResponse")]
+ string[] GetFavoriteSites();
+ }
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+ public interface IDataApiChannel : OAuthConsumer.SampleServiceProvider.IDataApi, System.ServiceModel.IClientChannel {
+ }
+
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+ public partial class DataApiClient : System.ServiceModel.ClientBase<OAuthConsumer.SampleServiceProvider.IDataApi>, OAuthConsumer.SampleServiceProvider.IDataApi {
+
+ public DataApiClient() {
+ }
+
+ public DataApiClient(string endpointConfigurationName) :
+ base(endpointConfigurationName) {
+ }
+
+ public DataApiClient(string endpointConfigurationName, string remoteAddress) :
+ base(endpointConfigurationName, remoteAddress) {
+ }
+
+ public DataApiClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
+ base(endpointConfigurationName, remoteAddress) {
+ }
+
+ public DataApiClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
+ base(binding, remoteAddress) {
+ }
+
+ public System.Nullable<int> GetAge() {
+ return base.Channel.GetAge();
+ }
+
+ public string GetName() {
+ return base.Channel.GetName();
+ }
+
+ public string[] GetFavoriteSites() {
+ return base.Channel.GetFavoriteSites();
+ }
+ }
+}
diff --git a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/Reference.svcmap b/samples/OAuthConsumer/Service References/SampleServiceProvider/Reference.svcmap
index c3f76fc..4463f99 100644
--- a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/Reference.svcmap
+++ b/samples/OAuthConsumer/Service References/SampleServiceProvider/Reference.svcmap
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="a9540115-d434-4d5b-b398-ed16a994aba2" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
+<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="41652b7a-0e9d-40be-8e75-8ccd843850c4" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
<ClientOptions>
<GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
<EnableDataBinding>true</EnableDataBinding>
@@ -11,20 +11,21 @@
<CollectionMappings />
<GenerateSerializableTypes>true</GenerateSerializableTypes>
<Serializer>Auto</Serializer>
+ <UseSerializerForFaults>true</UseSerializerForFaults>
<ReferenceAllAssemblies>true</ReferenceAllAssemblies>
<ReferencedAssemblies />
<ReferencedDataContractTypes />
<ServiceContractMappings />
</ClientOptions>
<MetadataSources>
- <MetadataSource Address="http://localhost:65169/OAuthServiceProvider/DataApi.svc" Protocol="http" SourceId="1" />
+ <MetadataSource Address="http://localhost:65169/DataApi.svc" Protocol="http" SourceId="1" />
</MetadataSources>
<Metadata>
- <MetadataFile FileName="DataApi.wsdl" MetadataType="Wsdl" ID="182a10fe-d606-4fc0-b64c-3e682dcae89d" SourceId="1" SourceUrl="http://localhost:65169/OAuthServiceProvider/DataApi.svc?wsdl" />
- <MetadataFile FileName="DataApi2.xsd" MetadataType="Schema" ID="232b71c0-94e9-43eb-9b23-fe9a229dce94" SourceId="1" SourceUrl="http://localhost:65169/OAuthServiceProvider/DataApi.svc?xsd=xsd2" />
- <MetadataFile FileName="DataApi1.xsd" MetadataType="Schema" ID="80d06927-f2e7-4d1d-8c7a-f3dc74f4d3d6" SourceId="1" SourceUrl="http://localhost:65169/OAuthServiceProvider/DataApi.svc?xsd=xsd0" />
- <MetadataFile FileName="DataApi.disco" MetadataType="Disco" ID="25047770-8993-4bf3-acee-64b5f3598f2c" SourceId="1" SourceUrl="http://localhost:65169/OAuthServiceProvider/DataApi.svc?disco" />
- <MetadataFile FileName="DataApi.xsd" MetadataType="Schema" ID="fdc9f289-8c10-4fc6-abeb-052bc1116679" SourceId="1" SourceUrl="http://localhost:65169/OAuthServiceProvider/DataApi.svc?xsd=xsd1" />
+ <MetadataFile FileName="DataApi.xsd" MetadataType="Schema" ID="82a34da8-d721-4c35-aaf9-fc5d08771cd2" SourceId="1" SourceUrl="http://localhost:65169/DataApi.svc?xsd=xsd0" />
+ <MetadataFile FileName="DataApi.wsdl" MetadataType="Wsdl" ID="96350220-1df2-429e-8cb5-4fc33703bcc7" SourceId="1" SourceUrl="http://localhost:65169/DataApi.svc?wsdl" />
+ <MetadataFile FileName="DataApi.disco" MetadataType="Disco" ID="c4f66dee-ac01-4476-afb0-34f7350c06ad" SourceId="1" SourceUrl="http://localhost:65169/DataApi.svc?disco" />
+ <MetadataFile FileName="DataApi1.xsd" MetadataType="Schema" ID="7aaf262f-6342-421b-8f44-0e624be7a5fb" SourceId="1" SourceUrl="http://localhost:65169/DataApi.svc?xsd=xsd1" />
+ <MetadataFile FileName="DataApi2.xsd" MetadataType="Schema" ID="67c1ea8d-12c4-4a0c-aa33-7226018cf16e" SourceId="1" SourceUrl="http://localhost:65169/DataApi.svc?xsd=xsd2" />
</Metadata>
<Extensions>
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />
diff --git a/samples/OAuthConsumer/Service References/SampleServiceProvider/configuration.svcinfo b/samples/OAuthConsumer/Service References/SampleServiceProvider/configuration.svcinfo
new file mode 100644
index 0000000..24b13a5
--- /dev/null
+++ b/samples/OAuthConsumer/Service References/SampleServiceProvider/configuration.svcinfo
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
+ <behaviors />
+ <bindings>
+ <binding digest="System.ServiceModel.Configuration.WSHttpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data hostNameComparisonMode=&quot;StrongWildcard&quot; messageEncoding=&quot;Text&quot; name=&quot;WSHttpBinding_IDataApi1&quot; textEncoding=&quot;utf-8&quot; transactionFlow=&quot;false&quot;&gt;&lt;readerQuotas maxArrayLength=&quot;16384&quot; maxBytesPerRead=&quot;4096&quot; maxDepth=&quot;32&quot; maxNameTableCharCount=&quot;16384&quot; maxStringContentLength=&quot;8192&quot; /&gt;&lt;reliableSession enabled=&quot;false&quot; inactivityTimeout=&quot;00:10:00&quot; ordered=&quot;true&quot; /&gt;&lt;security mode=&quot;Message&quot;&gt;&lt;message algorithmSuite=&quot;Default&quot; clientCredentialType=&quot;Windows&quot; negotiateServiceCredential=&quot;true&quot; /&gt;&lt;transport clientCredentialType=&quot;Windows&quot; proxyCredentialType=&quot;None&quot; realm=&quot;&quot; /&gt;&lt;/security&gt;&lt;/Data&gt;" bindingType="wsHttpBinding" name="WSHttpBinding_IDataApi1" />
+ </bindings>
+ <endpoints>
+ <endpoint normalizedDigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;http://localhost:65169/DataApi.svc&quot; binding=&quot;wsHttpBinding&quot; bindingConfiguration=&quot;WSHttpBinding_IDataApi1&quot; contract=&quot;SampleServiceProvider.IDataApi&quot; name=&quot;WSHttpBinding_IDataApi1&quot;&gt;&lt;identity&gt;&lt;dns value=&quot;localhost&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;http://localhost:65169/DataApi.svc&quot; binding=&quot;wsHttpBinding&quot; bindingConfiguration=&quot;WSHttpBinding_IDataApi1&quot; contract=&quot;SampleServiceProvider.IDataApi&quot; name=&quot;WSHttpBinding_IDataApi1&quot;&gt;&lt;identity&gt;&lt;dns value=&quot;localhost&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" contractName="SampleServiceProvider.IDataApi" name="WSHttpBinding_IDataApi1" />
+ </endpoints>
+</configurationSnapshot> \ No newline at end of file
diff --git a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/configuration91.svcinfo b/samples/OAuthConsumer/Service References/SampleServiceProvider/configuration91.svcinfo
index 0dba466..822d218 100644
--- a/samples/OAuthConsumer/App_WebReferences/SampleServiceProvider/configuration91.svcinfo
+++ b/samples/OAuthConsumer/Service References/SampleServiceProvider/configuration91.svcinfo
@@ -1,209 +1,215 @@
<?xml version="1.0" encoding="utf-8"?>
-<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="ieaabeY3T59437Mou0eeT4Hleso=">
+<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="GUEgzgg89GpE4CgPbgPkvKCNLCE=">
<bindingConfigurations>
<bindingConfiguration bindingType="wsHttpBinding" name="WSHttpBinding_IDataApi1">
<properties>
- <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>WSHttpBinding_IDataApi1</serializedValue>
</property>
- <property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>00:01:00</serializedValue>
</property>
- <property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>00:01:00</serializedValue>
</property>
- <property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>00:10:00</serializedValue>
</property>
- <property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>00:01:00</serializedValue>
</property>
- <property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>False</serializedValue>
</property>
- <property path="/transactionFlow" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/transactionFlow" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>False</serializedValue>
</property>
- <property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>StrongWildcard</serializedValue>
</property>
- <property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>524288</serializedValue>
</property>
- <property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>65536</serializedValue>
</property>
- <property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Text</serializedValue>
</property>
- <property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
- <property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement</serializedValue>
</property>
- <property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>32</serializedValue>
</property>
- <property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>8192</serializedValue>
</property>
- <property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>16384</serializedValue>
</property>
- <property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>4096</serializedValue>
</property>
- <property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>16384</serializedValue>
</property>
- <property path="/reliableSession" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.StandardBindingOptionalReliableSessionElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/reliableSession" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.StandardBindingOptionalReliableSessionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.StandardBindingOptionalReliableSessionElement</serializedValue>
</property>
- <property path="/reliableSession/ordered" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/reliableSession/ordered" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>True</serializedValue>
</property>
- <property path="/reliableSession/inactivityTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/reliableSession/inactivityTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>00:10:00</serializedValue>
</property>
- <property path="/reliableSession/enabled" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/reliableSession/enabled" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>False</serializedValue>
</property>
- <property path="/textEncoding" isComplexType="false" isExplicitlyDefined="true" clrType="System.Text.Encoding, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/textEncoding" isComplexType="false" isExplicitlyDefined="true" clrType="System.Text.Encoding, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.Text.UTF8Encoding</serializedValue>
</property>
- <property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>True</serializedValue>
</property>
- <property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>False</serializedValue>
</property>
- <property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.WSHttpSecurityElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.WSHttpSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.WSHttpSecurityElement</serializedValue>
</property>
- <property path="/security/mode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.SecurityMode, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/mode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.SecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Message</serializedValue>
</property>
- <property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.WSHttpTransportSecurityElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.WSHttpTransportSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.WSHttpTransportSecurityElement</serializedValue>
</property>
- <property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Windows</serializedValue>
</property>
- <property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>None</serializedValue>
</property>
- <property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <serializedValue />
- </property>
- <property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement</serializedValue>
</property>
- <property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Never</serializedValue>
</property>
- <property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>TransportSelected</serializedValue>
</property>
- <property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>(Collection)</serializedValue>
</property>
- <property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.NonDualMessageSecurityOverHttpElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.NonDualMessageSecurityOverHttpElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.NonDualMessageSecurityOverHttpElement</serializedValue>
</property>
- <property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.MessageCredentialType, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.MessageCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Windows</serializedValue>
</property>
- <property path="/security/message/negotiateServiceCredential" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/message/negotiateServiceCredential" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>True</serializedValue>
</property>
- <property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <serializedValue>Basic256</serializedValue>
+ <property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>Default</serializedValue>
</property>
- <property path="/security/message/establishSecurityContext" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/security/message/establishSecurityContext" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>True</serializedValue>
</property>
</properties>
</bindingConfiguration>
</bindingConfigurations>
<endpoints>
- <endpoint name="WSHttpBinding_IDataApi1" contract="SampleServiceProvider.IDataApi" bindingType="wsHttpBinding" address="http://localhost:65169/OAuthServiceProvider/DataApi.svc" bindingConfiguration="WSHttpBinding_IDataApi1">
+ <endpoint name="WSHttpBinding_IDataApi1" contract="SampleServiceProvider.IDataApi" bindingType="wsHttpBinding" address="http://localhost:65169/DataApi.svc" bindingConfiguration="WSHttpBinding_IDataApi1">
<properties>
- <property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <serializedValue>http://localhost:65169/OAuthServiceProvider/DataApi.svc</serializedValue>
+ <property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue>http://localhost:65169/DataApi.svc</serializedValue>
</property>
- <property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
- <property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>wsHttpBinding</serializedValue>
</property>
- <property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>WSHttpBinding_IDataApi1</serializedValue>
</property>
- <property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>SampleServiceProvider.IDataApi</serializedValue>
</property>
- <property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.AddressHeaderCollectionElement</serializedValue>
</property>
- <property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>&lt;Header /&gt;</serializedValue>
</property>
- <property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.IdentityElement</serializedValue>
</property>
- <property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.UserPrincipalNameElement</serializedValue>
</property>
- <property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
- <property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue>
</property>
- <property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
- <property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue>
</property>
- <property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>localhost</serializedValue>
</property>
- <property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue>
</property>
- <property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
- <property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.CertificateElement</serializedValue>
</property>
- <property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
- <property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>System.ServiceModel.Configuration.CertificateReferenceElement</serializedValue>
</property>
- <property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>My</serializedValue>
</property>
- <property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>LocalMachine</serializedValue>
</property>
- <property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>FindBySubjectDistinguishedName</serializedValue>
</property>
- <property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue />
</property>
- <property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>False</serializedValue>
</property>
- <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>WSHttpBinding_IDataApi1</serializedValue>
</property>
+ <property path="/kind" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
+ <property path="/endpointConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <serializedValue />
+ </property>
</properties>
</endpoint>
</endpoints>
diff --git a/samples/OAuthConsumer/SignInWithTwitter.aspx b/samples/OAuthConsumer/SignInWithTwitter.aspx
new file mode 100644
index 0000000..86d29a4
--- /dev/null
+++ b/samples/OAuthConsumer/SignInWithTwitter.aspx
@@ -0,0 +1,38 @@
+<%@ Page Language="C#" AutoEventWireup="true"
+ Inherits="OAuthConsumer.SignInWithTwitter" Codebehind="SignInWithTwitter.aspx.cs" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title>Sign-in with Twitter</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+ <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
+ <asp:View ID="View1" runat="server">
+ <h2>
+ Twitter setup</h2>
+ <p>
+ A Twitter client app must be endorsed by a Twitter user.
+ </p>
+ <ol>
+ <li><a target="_blank" href="https://twitter.com/oauth_clients">Visit Twitter and create
+ a client app</a>. </li>
+ <li>Modify your web.config file to include your consumer key and consumer secret.</li>
+ </ol>
+ </asp:View>
+ <asp:View ID="View2" runat="server">
+ <asp:ImageButton ImageUrl="~/images/Sign-in-with-Twitter-darker.png" runat="server"
+ AlternateText="Sign In With Twitter" ID="signInButton" OnClick="signInButton_Click" />
+ <asp:CheckBox Text="force re-login" runat="server" ID="forceLoginCheckbox" />
+ <br />
+ <asp:Panel runat="server" ID="loggedInPanel" Visible="false">
+ Now logged in as
+ <asp:Label Text="[name]" runat="server" ID="loggedInName" />
+ </asp:Panel>
+ </asp:View>
+ </asp:MultiView>
+ </form>
+</body>
+</html>
diff --git a/samples/OAuthConsumer/SignInWithTwitter.aspx.cs b/samples/OAuthConsumer/SignInWithTwitter.aspx.cs
new file mode 100644
index 0000000..e104f3a
--- /dev/null
+++ b/samples/OAuthConsumer/SignInWithTwitter.aspx.cs
@@ -0,0 +1,39 @@
+namespace OAuthConsumer {
+ using System;
+ using System.Collections.Generic;
+ using System.Configuration;
+ using System.Linq;
+ using System.Web;
+ using System.Web.Security;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using System.Xml.Linq;
+ using System.Xml.XPath;
+ using DotNetOpenAuth.ApplicationBlock;
+ using DotNetOpenAuth.OAuth;
+
+ public partial class SignInWithTwitter : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ if (TwitterConsumer.IsTwitterConsumerConfigured) {
+ this.MultiView1.ActiveViewIndex = 1;
+
+ if (!IsPostBack) {
+ string screenName;
+ int userId;
+ if (TwitterConsumer.TryFinishSignInWithTwitter(out screenName, out userId)) {
+ this.loggedInPanel.Visible = true;
+ this.loggedInName.Text = screenName;
+
+ // In a real app, the Twitter username would likely be used
+ // to log the user into the application.
+ ////FormsAuthentication.RedirectFromLoginPage(screenName, false);
+ }
+ }
+ }
+ }
+
+ protected void signInButton_Click(object sender, ImageClickEventArgs e) {
+ TwitterConsumer.StartSignInWithTwitter(this.forceLoginCheckbox.Checked).Send();
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthConsumer/SignInWithTwitter.aspx.designer.cs b/samples/OAuthConsumer/SignInWithTwitter.aspx.designer.cs
new file mode 100644
index 0000000..962a1af
--- /dev/null
+++ b/samples/OAuthConsumer/SignInWithTwitter.aspx.designer.cs
@@ -0,0 +1,87 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthConsumer {
+
+
+ public partial class SignInWithTwitter {
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ /// <summary>
+ /// MultiView1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.MultiView MultiView1;
+
+ /// <summary>
+ /// View1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.View View1;
+
+ /// <summary>
+ /// View2 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.View View2;
+
+ /// <summary>
+ /// signInButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.ImageButton signInButton;
+
+ /// <summary>
+ /// forceLoginCheckbox control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.CheckBox forceLoginCheckbox;
+
+ /// <summary>
+ /// loggedInPanel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Panel loggedInPanel;
+
+ /// <summary>
+ /// loggedInName control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label loggedInName;
+ }
+}
diff --git a/samples/OAuthConsumer/TracePage.aspx b/samples/OAuthConsumer/TracePage.aspx
index 4d6ecc5..d3539fb 100644
--- a/samples/OAuthConsumer/TracePage.aspx
+++ b/samples/OAuthConsumer/TracePage.aspx
@@ -1,4 +1,4 @@
-<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TracePage.aspx.cs" Inherits="TracePage" %>
+<%@ Page Language="C#" AutoEventWireup="true" Inherits="OAuthConsumer.TracePage" Codebehind="TracePage.aspx.cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
diff --git a/samples/OAuthConsumer/TracePage.aspx.cs b/samples/OAuthConsumer/TracePage.aspx.cs
index 7075ce3..b9ca260 100644
--- a/samples/OAuthConsumer/TracePage.aspx.cs
+++ b/samples/OAuthConsumer/TracePage.aspx.cs
@@ -1,21 +1,23 @@
-using System;
-using System.Collections.Generic;
-using System.Web;
-using System.Web.UI;
-using System.Web.UI.WebControls;
+namespace OAuthConsumer {
+ using System;
+ using System.Collections.Generic;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
-/// <summary>
-/// A page to display recent log messages.
-/// </summary>
-public partial class TracePage : System.Web.UI.Page {
- protected void Page_Load(object sender, EventArgs e) {
- this.placeHolder1.Controls.Add(new Label { Text = HttpUtility.HtmlEncode(Logging.LogMessages.ToString()) });
- }
+ /// <summary>
+ /// A page to display recent log messages.
+ /// </summary>
+ public partial class TracePage : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ this.placeHolder1.Controls.Add(new Label { Text = HttpUtility.HtmlEncode(Logging.LogMessages.ToString()) });
+ }
- protected void clearLogButton_Click(object sender, EventArgs e) {
- Logging.LogMessages.Length = 0;
+ protected void clearLogButton_Click(object sender, EventArgs e) {
+ Logging.LogMessages.Length = 0;
- // clear the page immediately, and allow for F5 without a Postback warning.
- Response.Redirect(Request.Url.AbsoluteUri);
+ // clear the page immediately, and allow for F5 without a Postback warning.
+ Response.Redirect(Request.Url.AbsoluteUri);
+ }
}
-}
+} \ No newline at end of file
diff --git a/samples/OAuthConsumer/TracePage.aspx.designer.cs b/samples/OAuthConsumer/TracePage.aspx.designer.cs
new file mode 100644
index 0000000..73184b5
--- /dev/null
+++ b/samples/OAuthConsumer/TracePage.aspx.designer.cs
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthConsumer {
+
+
+ public partial class TracePage {
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ /// <summary>
+ /// clearLogButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button clearLogButton;
+
+ /// <summary>
+ /// placeHolder1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.PlaceHolder placeHolder1;
+ }
+}
diff --git a/samples/OAuthConsumer/Twitter.aspx b/samples/OAuthConsumer/Twitter.aspx
index 30ce2a0..a24c7bd 100644
--- a/samples/OAuthConsumer/Twitter.aspx
+++ b/samples/OAuthConsumer/Twitter.aspx
@@ -1,5 +1,4 @@
-<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
- CodeFile="Twitter.aspx.cs" Inherits="Twitter" %>
+<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="OAuthConsumer.Twitter" Codebehind="Twitter.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
diff --git a/samples/OAuthConsumer/Twitter.aspx.cs b/samples/OAuthConsumer/Twitter.aspx.cs
index f309396..8288ed0 100644
--- a/samples/OAuthConsumer/Twitter.aspx.cs
+++ b/samples/OAuthConsumer/Twitter.aspx.cs
@@ -1,94 +1,96 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Linq;
-using System.Text;
-using System.Web;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Xml.Linq;
-using System.Xml.XPath;
-using DotNetOpenAuth.ApplicationBlock;
-using DotNetOpenAuth.OAuth;
+namespace OAuthConsumer {
+ using System;
+ using System.Collections.Generic;
+ using System.Configuration;
+ using System.Linq;
+ using System.Text;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using System.Xml.Linq;
+ using System.Xml.XPath;
+ using DotNetOpenAuth.ApplicationBlock;
+ using DotNetOpenAuth.OAuth;
-public partial class Twitter : System.Web.UI.Page {
- private string AccessToken {
- get { return (string)Session["TwitterAccessToken"]; }
- set { Session["TwitterAccessToken"] = value; }
- }
+ public partial class Twitter : System.Web.UI.Page {
+ private string AccessToken {
+ get { return (string)Session["TwitterAccessToken"]; }
+ set { Session["TwitterAccessToken"] = value; }
+ }
- private InMemoryTokenManager TokenManager {
- get {
- var tokenManager = (InMemoryTokenManager)Application["TwitterTokenManager"];
- if (tokenManager == null) {
- string consumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"];
- string consumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"];
- if (!string.IsNullOrEmpty(consumerKey)) {
- tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
- Application["TwitterTokenManager"] = tokenManager;
+ private InMemoryTokenManager TokenManager {
+ get {
+ var tokenManager = (InMemoryTokenManager)Application["TwitterTokenManager"];
+ if (tokenManager == null) {
+ string consumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"];
+ string consumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"];
+ if (!string.IsNullOrEmpty(consumerKey)) {
+ tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
+ Application["TwitterTokenManager"] = tokenManager;
+ }
}
- }
- return tokenManager;
+ return tokenManager;
+ }
}
- }
- protected void Page_Load(object sender, EventArgs e) {
- if (this.TokenManager != null) {
- MultiView1.ActiveViewIndex = 1;
+ protected void Page_Load(object sender, EventArgs e) {
+ if (this.TokenManager != null) {
+ this.MultiView1.ActiveViewIndex = 1;
- if (!IsPostBack) {
- var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
+ if (!IsPostBack) {
+ var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
- // Is Twitter calling back with authorization?
- var accessTokenResponse = twitter.ProcessUserAuthorization();
- if (accessTokenResponse != null) {
- this.AccessToken = accessTokenResponse.AccessToken;
- } else if (this.AccessToken == null) {
- // If we don't yet have access, immediately request it.
- twitter.Channel.Send(twitter.PrepareRequestUserAuthorization());
+ // Is Twitter calling back with authorization?
+ var accessTokenResponse = twitter.ProcessUserAuthorization();
+ if (accessTokenResponse != null) {
+ this.AccessToken = accessTokenResponse.AccessToken;
+ } else if (this.AccessToken == null) {
+ // If we don't yet have access, immediately request it.
+ twitter.Channel.Send(twitter.PrepareRequestUserAuthorization());
+ }
}
}
}
- }
- protected void downloadUpdates_Click(object sender, EventArgs e) {
- var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
- XPathDocument updates = new XPathDocument(TwitterConsumer.GetUpdates(twitter, this.AccessToken).CreateReader());
- XPathNavigator nav = updates.CreateNavigator();
- var parsedUpdates = from status in nav.Select("/statuses/status").OfType<XPathNavigator>()
- where !status.SelectSingleNode("user/protected").ValueAsBoolean
- select new {
- User = status.SelectSingleNode("user/name").InnerXml,
- Status = status.SelectSingleNode("text").InnerXml,
- };
+ protected void downloadUpdates_Click(object sender, EventArgs e) {
+ var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
+ XPathDocument updates = new XPathDocument(TwitterConsumer.GetUpdates(twitter, this.AccessToken).CreateReader());
+ XPathNavigator nav = updates.CreateNavigator();
+ var parsedUpdates = from status in nav.Select("/statuses/status").OfType<XPathNavigator>()
+ where !status.SelectSingleNode("user/protected").ValueAsBoolean
+ select new {
+ User = status.SelectSingleNode("user/name").InnerXml,
+ Status = status.SelectSingleNode("text").InnerXml,
+ };
- StringBuilder tableBuilder = new StringBuilder();
- tableBuilder.Append("<table><tr><td>Name</td><td>Update</td></tr>");
+ StringBuilder tableBuilder = new StringBuilder();
+ tableBuilder.Append("<table><tr><td>Name</td><td>Update</td></tr>");
- foreach (var update in parsedUpdates) {
- tableBuilder.AppendFormat(
- "<tr><td>{0}</td><td>{1}</td></tr>",
- HttpUtility.HtmlEncode(update.User),
- HttpUtility.HtmlEncode(update.Status));
+ foreach (var update in parsedUpdates) {
+ tableBuilder.AppendFormat(
+ "<tr><td>{0}</td><td>{1}</td></tr>",
+ HttpUtility.HtmlEncode(update.User),
+ HttpUtility.HtmlEncode(update.Status));
+ }
+ tableBuilder.Append("</table>");
+ this.resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
}
- tableBuilder.Append("</table>");
- resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
- }
- protected void uploadProfilePhotoButton_Click(object sender, EventArgs e) {
- if (profilePhoto.PostedFile.ContentType == null) {
- photoUploadedLabel.Visible = true;
- photoUploadedLabel.Text = "Select a file first.";
- return;
- }
+ protected void uploadProfilePhotoButton_Click(object sender, EventArgs e) {
+ if (this.profilePhoto.PostedFile.ContentType == null) {
+ this.photoUploadedLabel.Visible = true;
+ this.photoUploadedLabel.Text = "Select a file first.";
+ return;
+ }
- var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
- XDocument imageResult = TwitterConsumer.UpdateProfileImage(
- twitter,
- this.AccessToken,
- profilePhoto.PostedFile.InputStream,
- profilePhoto.PostedFile.ContentType);
- photoUploadedLabel.Visible = true;
+ var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
+ XDocument imageResult = TwitterConsumer.UpdateProfileImage(
+ twitter,
+ this.AccessToken,
+ this.profilePhoto.PostedFile.InputStream,
+ this.profilePhoto.PostedFile.ContentType);
+ this.photoUploadedLabel.Visible = true;
+ }
}
-}
+} \ No newline at end of file
diff --git a/samples/OAuthConsumer/Twitter.aspx.designer.cs b/samples/OAuthConsumer/Twitter.aspx.designer.cs
new file mode 100644
index 0000000..7c37271
--- /dev/null
+++ b/samples/OAuthConsumer/Twitter.aspx.designer.cs
@@ -0,0 +1,78 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthConsumer {
+
+
+ public partial class Twitter {
+
+ /// <summary>
+ /// MultiView1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.MultiView MultiView1;
+
+ /// <summary>
+ /// View1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.View View1;
+
+ /// <summary>
+ /// profilePhoto control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.FileUpload profilePhoto;
+
+ /// <summary>
+ /// uploadProfilePhotoButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button uploadProfilePhotoButton;
+
+ /// <summary>
+ /// photoUploadedLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label photoUploadedLabel;
+
+ /// <summary>
+ /// downloadUpdates control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button downloadUpdates;
+
+ /// <summary>
+ /// resultsPlaceholder control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.PlaceHolder resultsPlaceholder;
+ }
+}
diff --git a/samples/OAuthConsumer/Web.config b/samples/OAuthConsumer/Web.config
index 496da95..7753874 100644
--- a/samples/OAuthConsumer/Web.config
+++ b/samples/OAuthConsumer/Web.config
@@ -48,8 +48,8 @@
<add key="twitterConsumerKey" value="" />
<add key="twitterConsumerSecret" value="" />
<!-- Google sign-up: https://www.google.com/accounts/ManageDomains -->
- <add key="googleConsumerKey" value=""/>
- <add key="googleConsumerSecret" value=""/>
+ <add key="googleConsumerKey" value="anonymous"/>
+ <add key="googleConsumerSecret" value="anonymous"/>
</appSettings>
<connectionStrings/>
@@ -149,7 +149,7 @@
</assemblyBinding>
</runtime>
<log4net>
- <appender name="TracePageAppender" type="TracePageAppender, __code">
+ <appender name="TracePageAppender" type="OAuthConsumer.TracePageAppender, OAuthConsumer">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline" />
</layout>
@@ -187,7 +187,7 @@
</wsHttpBinding>
</bindings>
<client>
- <endpoint address="http://localhost:65169/OAuthServiceProvider/DataApi.svc"
+ <endpoint address="http://localhost:65169/DataApi.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDataApi"
contract="SampleServiceProvider.IDataApi" name="WSHttpBinding_IDataApi">
<identity>
diff --git a/samples/OAuthConsumer/favicon.ico b/samples/OAuthConsumer/favicon.ico
new file mode 100644
index 0000000..e227dbe
--- /dev/null
+++ b/samples/OAuthConsumer/favicon.ico
Binary files differ
diff --git a/samples/OAuthConsumer/images/Sign-in-with-Twitter-darker.png b/samples/OAuthConsumer/images/Sign-in-with-Twitter-darker.png
new file mode 100644
index 0000000..746b6b9
--- /dev/null
+++ b/samples/OAuthConsumer/images/Sign-in-with-Twitter-darker.png
Binary files differ
diff --git a/samples/OAuthConsumerWpf/App.config b/samples/OAuthConsumerWpf/App.config
index d4d434a..dab6eed 100644
--- a/samples/OAuthConsumerWpf/App.config
+++ b/samples/OAuthConsumerWpf/App.config
@@ -89,7 +89,7 @@
</wsHttpBinding>
</bindings>
<client>
- <endpoint address="http://localhost:65169/OAuthServiceProvider/DataApi.svc"
+ <endpoint address="http://localhost:65169/DataApi.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDataApi"
contract="WcfSampleService.IDataApi" name="WSHttpBinding_IDataApi">
<identity>
diff --git a/samples/OAuthConsumerWpf/MainWindow.xaml.cs b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
index c917288..5bf157b 100644
--- a/samples/OAuthConsumerWpf/MainWindow.xaml.cs
+++ b/samples/OAuthConsumerWpf/MainWindow.xaml.cs
@@ -66,7 +66,7 @@
this.wcfTokenManager.ConsumerKey = "sampleconsumer";
this.wcfTokenManager.ConsumerSecret = "samplesecret";
MessageReceivingEndpoint oauthEndpoint = new MessageReceivingEndpoint(
- new Uri("http://localhost:65169/OAuthServiceProvider/OAuth.ashx"),
+ new Uri("http://localhost:65169/OAuth.ashx"),
HttpDeliveryMethods.PostRequest);
this.wcf = new DesktopConsumer(
new ServiceProviderDescription {
diff --git a/samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj b/samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj
index c91f0b4..cdb95aa 100644
--- a/samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj
+++ b/samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -14,6 +14,26 @@
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -23,6 +43,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -31,6 +52,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CodeAnalysis|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -41,6 +63,7 @@
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
@@ -83,19 +106,28 @@
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Authorize.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
@@ -175,6 +207,23 @@
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
</ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/samples/OAuthConsumerWpf/Properties/Resources.Designer.cs b/samples/OAuthConsumerWpf/Properties/Resources.Designer.cs
index 7ab595b..4daf53b 100644
--- a/samples/OAuthConsumerWpf/Properties/Resources.Designer.cs
+++ b/samples/OAuthConsumerWpf/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4912
+// Runtime Version:4.0.30104.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -19,7 +19,7 @@ namespace DotNetOpenAuth.Samples.OAuthConsumerWpf.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/samples/OAuthConsumerWpf/Properties/Settings.Designer.cs b/samples/OAuthConsumerWpf/Properties/Settings.Designer.cs
index 57010d6..f1f42ca 100644
--- a/samples/OAuthConsumerWpf/Properties/Settings.Designer.cs
+++ b/samples/OAuthConsumerWpf/Properties/Settings.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4912
+// Runtime Version:4.0.30104.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -12,7 +12,7 @@ namespace DotNetOpenAuth.Samples.OAuthConsumerWpf.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/samples/OAuthConsumerWpf/Service References/WcfSampleService/Reference.cs b/samples/OAuthConsumerWpf/Service References/WcfSampleService/Reference.cs
index 216c8b3..33bf064 100644
--- a/samples/OAuthConsumerWpf/Service References/WcfSampleService/Reference.cs
+++ b/samples/OAuthConsumerWpf/Service References/WcfSampleService/Reference.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4918
+// Runtime Version:4.0.30104.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -11,7 +11,7 @@
namespace DotNetOpenAuth.Samples.OAuthConsumerWpf.WcfSampleService {
- [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="WcfSampleService.IDataApi")]
public interface IDataApi {
@@ -25,12 +25,12 @@ namespace DotNetOpenAuth.Samples.OAuthConsumerWpf.WcfSampleService {
string[] GetFavoriteSites();
}
- [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IDataApiChannel : DotNetOpenAuth.Samples.OAuthConsumerWpf.WcfSampleService.IDataApi, System.ServiceModel.IClientChannel {
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
- [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class DataApiClient : System.ServiceModel.ClientBase<DotNetOpenAuth.Samples.OAuthConsumerWpf.WcfSampleService.IDataApi>, DotNetOpenAuth.Samples.OAuthConsumerWpf.WcfSampleService.IDataApi {
public DataApiClient() {
diff --git a/samples/OAuthConsumerWpf/favicon.ico b/samples/OAuthConsumerWpf/favicon.ico
new file mode 100644
index 0000000..e227dbe
--- /dev/null
+++ b/samples/OAuthConsumerWpf/favicon.ico
Binary files differ
diff --git a/samples/OAuthServiceProvider/App_Code/Constants.cs b/samples/OAuthServiceProvider/App_Code/Constants.cs
deleted file mode 100644
index 7780e96..0000000
--- a/samples/OAuthServiceProvider/App_Code/Constants.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using DotNetOpenAuth.Messaging;
-using DotNetOpenAuth.OAuth;
-using DotNetOpenAuth.OAuth.ChannelElements;
-
-/// <summary>
-/// Service Provider definitions.
-/// </summary>
-public static class Constants {
- public static Uri WebRootUrl { get; set; }
-
- public static ServiceProviderDescription SelfDescription {
- get {
- ServiceProviderDescription description = new ServiceProviderDescription {
- AccessTokenEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethods.PostRequest),
- RequestTokenEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethods.PostRequest),
- UserAuthorizationEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethods.PostRequest),
- TamperProtectionElements = new ITamperProtectionChannelBindingElement[] {
- new HmacSha1SigningBindingElement(),
- },
- };
-
- return description;
- }
- }
-
- public static ServiceProvider CreateServiceProvider() {
- return new ServiceProvider(SelfDescription, Global.TokenManager);
- }
-}
diff --git a/samples/OAuthServiceProvider/App_Code/CustomOAuthTypeProvider.cs b/samples/OAuthServiceProvider/App_Code/CustomOAuthTypeProvider.cs
deleted file mode 100644
index 0932dec..0000000
--- a/samples/OAuthServiceProvider/App_Code/CustomOAuthTypeProvider.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using DotNetOpenAuth.Messaging;
-using DotNetOpenAuth.OAuth.ChannelElements;
-using DotNetOpenAuth.OAuth.Messages;
-
-/// <summary>
-/// A custom class that will cause the OAuth library to use our custom message types
-/// where we have them.
-/// </summary>
-public class CustomOAuthMessageFactory : OAuthServiceProviderMessageFactory {
- /// <summary>
- /// Initializes a new instance of the <see cref="CustomOAuthMessageFactory"/> class.
- /// </summary>
- /// <param name="tokenManager">The token manager instance to use.</param>
- public CustomOAuthMessageFactory(IServiceProviderTokenManager tokenManager)
- : base(tokenManager) {
- }
-
- public override IDirectedProtocolMessage GetNewRequestMessage(MessageReceivingEndpoint recipient, IDictionary<string, string> fields) {
- var message = base.GetNewRequestMessage(recipient, fields);
-
- // inject our own type here to replace the standard one
- if (message is UnauthorizedTokenRequest) {
- message = new RequestScopedTokenMessage(recipient, message.Version);
- }
-
- return message;
- }
-}
diff --git a/samples/OAuthServiceProvider/App_Code/DataApi.cs b/samples/OAuthServiceProvider/App_Code/DataApi.cs
deleted file mode 100644
index d5adb10..0000000
--- a/samples/OAuthServiceProvider/App_Code/DataApi.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System.Linq;
-using System.ServiceModel;
-
-/// <summary>
-/// The WCF service API.
-/// </summary>
-/// <remarks>
-/// Note how there is no code here that is bound to OAuth or any other
-/// credential/authorization scheme. That's all part of the channel/binding elsewhere.
-/// And the reference to OperationContext.Current.ServiceSecurityContext.PrimaryIdentity
-/// is the user being impersonated by the WCF client.
-/// In the OAuth case, it is the user who authorized the OAuth access token that was used
-/// to gain access to the service.
-/// </remarks>
-public class DataApi : IDataApi {
- private User User {
- get { return OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.GetUser(); }
- }
-
- public int? GetAge() {
- return User.Age;
- }
-
- public string GetName() {
- return User.FullName;
- }
-
- public string[] GetFavoriteSites() {
- return User.FavoriteSites.Select(site => site.SiteUrl).ToArray();
- }
-}
diff --git a/samples/OAuthServiceProvider/App_Code/DataClasses.designer.cs b/samples/OAuthServiceProvider/App_Code/DataClasses.designer.cs
deleted file mode 100644
index b66e75f..0000000
--- a/samples/OAuthServiceProvider/App_Code/DataClasses.designer.cs
+++ /dev/null
@@ -1,1067 +0,0 @@
-#pragma warning disable 1591
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4918
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Data.Linq;
-using System.Data.Linq.Mapping;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-
-
-
-[System.Data.Linq.Mapping.DatabaseAttribute(Name="Database")]
-public partial class DataClassesDataContext : System.Data.Linq.DataContext
-{
-
- private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
-
- #region Extensibility Method Definitions
- partial void OnCreated();
- partial void InsertUser(User instance);
- partial void UpdateUser(User instance);
- partial void DeleteUser(User instance);
- partial void InsertFavoriteSite(FavoriteSite instance);
- partial void UpdateFavoriteSite(FavoriteSite instance);
- partial void DeleteFavoriteSite(FavoriteSite instance);
- partial void InsertOAuthConsumer(OAuthConsumer instance);
- partial void UpdateOAuthConsumer(OAuthConsumer instance);
- partial void DeleteOAuthConsumer(OAuthConsumer instance);
- partial void InsertOAuthToken(OAuthToken instance);
- partial void UpdateOAuthToken(OAuthToken instance);
- partial void DeleteOAuthToken(OAuthToken instance);
- #endregion
-
- public DataClassesDataContext() :
- base(global::System.Configuration.ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString, mappingSource)
- {
- OnCreated();
- }
-
- public DataClassesDataContext(string connection) :
- base(connection, mappingSource)
- {
- OnCreated();
- }
-
- public DataClassesDataContext(System.Data.IDbConnection connection) :
- base(connection, mappingSource)
- {
- OnCreated();
- }
-
- public DataClassesDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
- base(connection, mappingSource)
- {
- OnCreated();
- }
-
- public DataClassesDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
- base(connection, mappingSource)
- {
- OnCreated();
- }
-
- public System.Data.Linq.Table<User> Users
- {
- get
- {
- return this.GetTable<User>();
- }
- }
-
- public System.Data.Linq.Table<FavoriteSite> FavoriteSites
- {
- get
- {
- return this.GetTable<FavoriteSite>();
- }
- }
-
- public System.Data.Linq.Table<OAuthConsumer> OAuthConsumers
- {
- get
- {
- return this.GetTable<OAuthConsumer>();
- }
- }
-
- public System.Data.Linq.Table<OAuthToken> OAuthTokens
- {
- get
- {
- return this.GetTable<OAuthToken>();
- }
- }
-}
-
-[Table(Name="dbo.[User]")]
-public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
-{
-
- private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
-
- private int _UserId;
-
- private string _OpenIDClaimedIdentifier;
-
- private string _OpenIDFriendlyIdentifier;
-
- private string _FullName;
-
- private System.Nullable<int> _Age;
-
- private EntitySet<FavoriteSite> _FavoriteSites;
-
- private EntitySet<OAuthToken> _OAuthTokens;
-
- #region Extensibility Method Definitions
- partial void OnLoaded();
- partial void OnValidate(System.Data.Linq.ChangeAction action);
- partial void OnCreated();
- partial void OnUserIdChanging(int value);
- partial void OnUserIdChanged();
- partial void OnOpenIDClaimedIdentifierChanging(string value);
- partial void OnOpenIDClaimedIdentifierChanged();
- partial void OnOpenIDFriendlyIdentifierChanging(string value);
- partial void OnOpenIDFriendlyIdentifierChanged();
- partial void OnFullNameChanging(string value);
- partial void OnFullNameChanged();
- partial void OnAgeChanging(System.Nullable<int> value);
- partial void OnAgeChanged();
- #endregion
-
- public User()
- {
- this._FavoriteSites = new EntitySet<FavoriteSite>(new Action<FavoriteSite>(this.attach_FavoriteSites), new Action<FavoriteSite>(this.detach_FavoriteSites));
- this._OAuthTokens = new EntitySet<OAuthToken>(new Action<OAuthToken>(this.attach_OAuthTokens), new Action<OAuthToken>(this.detach_OAuthTokens));
- OnCreated();
- }
-
- [Column(Storage="_UserId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
- public int UserId
- {
- get
- {
- return this._UserId;
- }
- set
- {
- if ((this._UserId != value))
- {
- this.OnUserIdChanging(value);
- this.SendPropertyChanging();
- this._UserId = value;
- this.SendPropertyChanged("UserId");
- this.OnUserIdChanged();
- }
- }
- }
-
- [Column(Storage="_OpenIDClaimedIdentifier", DbType="NVarChar(150) NOT NULL", CanBeNull=false)]
- public string OpenIDClaimedIdentifier
- {
- get
- {
- return this._OpenIDClaimedIdentifier;
- }
- set
- {
- if ((this._OpenIDClaimedIdentifier != value))
- {
- this.OnOpenIDClaimedIdentifierChanging(value);
- this.SendPropertyChanging();
- this._OpenIDClaimedIdentifier = value;
- this.SendPropertyChanged("OpenIDClaimedIdentifier");
- this.OnOpenIDClaimedIdentifierChanged();
- }
- }
- }
-
- [Column(Storage="_OpenIDFriendlyIdentifier", DbType="NVarChar(150)")]
- public string OpenIDFriendlyIdentifier
- {
- get
- {
- return this._OpenIDFriendlyIdentifier;
- }
- set
- {
- if ((this._OpenIDFriendlyIdentifier != value))
- {
- this.OnOpenIDFriendlyIdentifierChanging(value);
- this.SendPropertyChanging();
- this._OpenIDFriendlyIdentifier = value;
- this.SendPropertyChanged("OpenIDFriendlyIdentifier");
- this.OnOpenIDFriendlyIdentifierChanged();
- }
- }
- }
-
- [Column(Storage="_FullName", DbType="NVarChar(150)", CanBeNull=false)]
- public string FullName
- {
- get
- {
- return this._FullName;
- }
- set
- {
- if ((this._FullName != value))
- {
- this.OnFullNameChanging(value);
- this.SendPropertyChanging();
- this._FullName = value;
- this.SendPropertyChanged("FullName");
- this.OnFullNameChanged();
- }
- }
- }
-
- [Column(Storage="_Age", DbType="int")]
- public System.Nullable<int> Age
- {
- get
- {
- return this._Age;
- }
- set
- {
- if ((this._Age != value))
- {
- this.OnAgeChanging(value);
- this.SendPropertyChanging();
- this._Age = value;
- this.SendPropertyChanged("Age");
- this.OnAgeChanged();
- }
- }
- }
-
- [Association(Name="User_FavoriteSite", Storage="_FavoriteSites", ThisKey="UserId", OtherKey="UserId")]
- public EntitySet<FavoriteSite> FavoriteSites
- {
- get
- {
- return this._FavoriteSites;
- }
- set
- {
- this._FavoriteSites.Assign(value);
- }
- }
-
- [Association(Name="User_OAuthToken", Storage="_OAuthTokens", ThisKey="UserId", OtherKey="UserId")]
- public EntitySet<OAuthToken> OAuthTokens
- {
- get
- {
- return this._OAuthTokens;
- }
- set
- {
- this._OAuthTokens.Assign(value);
- }
- }
-
- public event PropertyChangingEventHandler PropertyChanging;
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void SendPropertyChanging()
- {
- if ((this.PropertyChanging != null))
- {
- this.PropertyChanging(this, emptyChangingEventArgs);
- }
- }
-
- protected virtual void SendPropertyChanged(String propertyName)
- {
- if ((this.PropertyChanged != null))
- {
- this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-
- private void attach_FavoriteSites(FavoriteSite entity)
- {
- this.SendPropertyChanging();
- entity.User = this;
- }
-
- private void detach_FavoriteSites(FavoriteSite entity)
- {
- this.SendPropertyChanging();
- entity.User = null;
- }
-
- private void attach_OAuthTokens(OAuthToken entity)
- {
- this.SendPropertyChanging();
- entity.User = this;
- }
-
- private void detach_OAuthTokens(OAuthToken entity)
- {
- this.SendPropertyChanging();
- entity.User = null;
- }
-}
-
-[Table(Name="dbo.FavoriteSite")]
-public partial class FavoriteSite : INotifyPropertyChanging, INotifyPropertyChanged
-{
-
- private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
-
- private int _FavoriteSiteId;
-
- private int _UserId;
-
- private string _SiteUrl;
-
- private EntityRef<User> _User;
-
- #region Extensibility Method Definitions
- partial void OnLoaded();
- partial void OnValidate(System.Data.Linq.ChangeAction action);
- partial void OnCreated();
- partial void OnFavoriteSiteIdChanging(int value);
- partial void OnFavoriteSiteIdChanged();
- partial void OnUserIdChanging(int value);
- partial void OnUserIdChanged();
- partial void OnSiteUrlChanging(string value);
- partial void OnSiteUrlChanged();
- #endregion
-
- public FavoriteSite()
- {
- this._User = default(EntityRef<User>);
- OnCreated();
- }
-
- [Column(Storage="_FavoriteSiteId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
- public int FavoriteSiteId
- {
- get
- {
- return this._FavoriteSiteId;
- }
- set
- {
- if ((this._FavoriteSiteId != value))
- {
- this.OnFavoriteSiteIdChanging(value);
- this.SendPropertyChanging();
- this._FavoriteSiteId = value;
- this.SendPropertyChanged("FavoriteSiteId");
- this.OnFavoriteSiteIdChanged();
- }
- }
- }
-
- [Column(Storage="_UserId", DbType="Int NOT NULL")]
- public int UserId
- {
- get
- {
- return this._UserId;
- }
- set
- {
- if ((this._UserId != value))
- {
- if (this._User.HasLoadedOrAssignedValue)
- {
- throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
- }
- this.OnUserIdChanging(value);
- this.SendPropertyChanging();
- this._UserId = value;
- this.SendPropertyChanged("UserId");
- this.OnUserIdChanged();
- }
- }
- }
-
- [Column(Storage="_SiteUrl", DbType="NVarChar(255) NOT NULL", CanBeNull=false)]
- public string SiteUrl
- {
- get
- {
- return this._SiteUrl;
- }
- set
- {
- if ((this._SiteUrl != value))
- {
- this.OnSiteUrlChanging(value);
- this.SendPropertyChanging();
- this._SiteUrl = value;
- this.SendPropertyChanged("SiteUrl");
- this.OnSiteUrlChanged();
- }
- }
- }
-
- [Association(Name="User_FavoriteSite", Storage="_User", ThisKey="UserId", OtherKey="UserId", IsForeignKey=true, DeleteOnNull=true, DeleteRule="CASCADE")]
- public User User
- {
- get
- {
- return this._User.Entity;
- }
- set
- {
- User previousValue = this._User.Entity;
- if (((previousValue != value)
- || (this._User.HasLoadedOrAssignedValue == false)))
- {
- this.SendPropertyChanging();
- if ((previousValue != null))
- {
- this._User.Entity = null;
- previousValue.FavoriteSites.Remove(this);
- }
- this._User.Entity = value;
- if ((value != null))
- {
- value.FavoriteSites.Add(this);
- this._UserId = value.UserId;
- }
- else
- {
- this._UserId = default(int);
- }
- this.SendPropertyChanged("User");
- }
- }
- }
-
- public event PropertyChangingEventHandler PropertyChanging;
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void SendPropertyChanging()
- {
- if ((this.PropertyChanging != null))
- {
- this.PropertyChanging(this, emptyChangingEventArgs);
- }
- }
-
- protected virtual void SendPropertyChanged(String propertyName)
- {
- if ((this.PropertyChanged != null))
- {
- this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-}
-
-[Table(Name="dbo.OAuthConsumer")]
-public partial class OAuthConsumer : INotifyPropertyChanging, INotifyPropertyChanged
-{
-
- private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
-
- private int _ConsumerId;
-
- private string _ConsumerKey;
-
- private string _ConsumerSecret;
-
- private string _Callback;
-
- private DotNetOpenAuth.OAuth.VerificationCodeFormat _VerificationCodeFormat;
-
- private int _VerificationCodeLength;
-
- private EntitySet<OAuthToken> _OAuthTokens;
-
- #region Extensibility Method Definitions
- partial void OnLoaded();
- partial void OnValidate(System.Data.Linq.ChangeAction action);
- partial void OnCreated();
- partial void OnConsumerIdChanging(int value);
- partial void OnConsumerIdChanged();
- partial void OnConsumerKeyChanging(string value);
- partial void OnConsumerKeyChanged();
- partial void OnConsumerSecretChanging(string value);
- partial void OnConsumerSecretChanged();
- partial void OnCallbackChanging(string value);
- partial void OnCallbackChanged();
- partial void OnVerificationCodeFormatChanging(DotNetOpenAuth.OAuth.VerificationCodeFormat value);
- partial void OnVerificationCodeFormatChanged();
- partial void OnVerificationCodeLengthChanging(int value);
- partial void OnVerificationCodeLengthChanged();
- #endregion
-
- public OAuthConsumer()
- {
- this._OAuthTokens = new EntitySet<OAuthToken>(new Action<OAuthToken>(this.attach_OAuthTokens), new Action<OAuthToken>(this.detach_OAuthTokens));
- OnCreated();
- }
-
- [Column(Storage="_ConsumerId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
- public int ConsumerId
- {
- get
- {
- return this._ConsumerId;
- }
- set
- {
- if ((this._ConsumerId != value))
- {
- this.OnConsumerIdChanging(value);
- this.SendPropertyChanging();
- this._ConsumerId = value;
- this.SendPropertyChanged("ConsumerId");
- this.OnConsumerIdChanged();
- }
- }
- }
-
- [Column(Storage="_ConsumerKey", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
- public string ConsumerKey
- {
- get
- {
- return this._ConsumerKey;
- }
- set
- {
- if ((this._ConsumerKey != value))
- {
- this.OnConsumerKeyChanging(value);
- this.SendPropertyChanging();
- this._ConsumerKey = value;
- this.SendPropertyChanged("ConsumerKey");
- this.OnConsumerKeyChanged();
- }
- }
- }
-
- [Column(Storage="_ConsumerSecret", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
- public string ConsumerSecret
- {
- get
- {
- return this._ConsumerSecret;
- }
- set
- {
- if ((this._ConsumerSecret != value))
- {
- this.OnConsumerSecretChanging(value);
- this.SendPropertyChanging();
- this._ConsumerSecret = value;
- this.SendPropertyChanged("ConsumerSecret");
- this.OnConsumerSecretChanged();
- }
- }
- }
-
- [Column(Storage="_Callback")]
- public string Callback
- {
- get
- {
- return this._Callback;
- }
- set
- {
- if ((this._Callback != value))
- {
- this.OnCallbackChanging(value);
- this.SendPropertyChanging();
- this._Callback = value;
- this.SendPropertyChanged("Callback");
- this.OnCallbackChanged();
- }
- }
- }
-
- [Column(Storage="_VerificationCodeFormat")]
- public DotNetOpenAuth.OAuth.VerificationCodeFormat VerificationCodeFormat
- {
- get
- {
- return this._VerificationCodeFormat;
- }
- set
- {
- if ((this._VerificationCodeFormat != value))
- {
- this.OnVerificationCodeFormatChanging(value);
- this.SendPropertyChanging();
- this._VerificationCodeFormat = value;
- this.SendPropertyChanged("VerificationCodeFormat");
- this.OnVerificationCodeFormatChanged();
- }
- }
- }
-
- [Column(Storage="_VerificationCodeLength")]
- public int VerificationCodeLength
- {
- get
- {
- return this._VerificationCodeLength;
- }
- set
- {
- if ((this._VerificationCodeLength != value))
- {
- this.OnVerificationCodeLengthChanging(value);
- this.SendPropertyChanging();
- this._VerificationCodeLength = value;
- this.SendPropertyChanged("VerificationCodeLength");
- this.OnVerificationCodeLengthChanged();
- }
- }
- }
-
- [Association(Name="OAuthConsumer_OAuthToken", Storage="_OAuthTokens", ThisKey="ConsumerId", OtherKey="ConsumerId")]
- public EntitySet<OAuthToken> OAuthTokens
- {
- get
- {
- return this._OAuthTokens;
- }
- set
- {
- this._OAuthTokens.Assign(value);
- }
- }
-
- public event PropertyChangingEventHandler PropertyChanging;
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void SendPropertyChanging()
- {
- if ((this.PropertyChanging != null))
- {
- this.PropertyChanging(this, emptyChangingEventArgs);
- }
- }
-
- protected virtual void SendPropertyChanged(String propertyName)
- {
- if ((this.PropertyChanged != null))
- {
- this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-
- private void attach_OAuthTokens(OAuthToken entity)
- {
- this.SendPropertyChanging();
- entity.OAuthConsumer = this;
- }
-
- private void detach_OAuthTokens(OAuthToken entity)
- {
- this.SendPropertyChanging();
- entity.OAuthConsumer = null;
- }
-}
-
-[Table(Name="dbo.OAuthToken")]
-public partial class OAuthToken : INotifyPropertyChanging, INotifyPropertyChanged
-{
-
- private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
-
- private int _TokenId;
-
- private string _Token;
-
- private string _TokenSecret;
-
- private TokenAuthorizationState _State;
-
- private System.DateTime _IssueDate;
-
- private int _ConsumerId;
-
- private System.Nullable<int> _UserId;
-
- private string _Scope;
-
- private string _RequestTokenVerifier;
-
- private string _RequestTokenCallback;
-
- private string _ConsumerVersion;
-
- private EntityRef<OAuthConsumer> _OAuthConsumer;
-
- private EntityRef<User> _User;
-
- #region Extensibility Method Definitions
- partial void OnLoaded();
- partial void OnValidate(System.Data.Linq.ChangeAction action);
- partial void OnCreated();
- partial void OnTokenIdChanging(int value);
- partial void OnTokenIdChanged();
- partial void OnTokenChanging(string value);
- partial void OnTokenChanged();
- partial void OnTokenSecretChanging(string value);
- partial void OnTokenSecretChanged();
- partial void OnStateChanging(TokenAuthorizationState value);
- partial void OnStateChanged();
- partial void OnIssueDateChanging(System.DateTime value);
- partial void OnIssueDateChanged();
- partial void OnConsumerIdChanging(int value);
- partial void OnConsumerIdChanged();
- partial void OnUserIdChanging(System.Nullable<int> value);
- partial void OnUserIdChanged();
- partial void OnScopeChanging(string value);
- partial void OnScopeChanged();
- partial void OnRequestTokenVerifierChanging(string value);
- partial void OnRequestTokenVerifierChanged();
- partial void OnRequestTokenCallbackChanging(string value);
- partial void OnRequestTokenCallbackChanged();
- partial void OnConsumerVersionChanging(string value);
- partial void OnConsumerVersionChanged();
- #endregion
-
- public OAuthToken()
- {
- this._OAuthConsumer = default(EntityRef<OAuthConsumer>);
- this._User = default(EntityRef<User>);
- OnCreated();
- }
-
- [Column(Storage="_TokenId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
- public int TokenId
- {
- get
- {
- return this._TokenId;
- }
- set
- {
- if ((this._TokenId != value))
- {
- this.OnTokenIdChanging(value);
- this.SendPropertyChanging();
- this._TokenId = value;
- this.SendPropertyChanged("TokenId");
- this.OnTokenIdChanged();
- }
- }
- }
-
- [Column(Storage="_Token", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
- public string Token
- {
- get
- {
- return this._Token;
- }
- set
- {
- if ((this._Token != value))
- {
- this.OnTokenChanging(value);
- this.SendPropertyChanging();
- this._Token = value;
- this.SendPropertyChanged("Token");
- this.OnTokenChanged();
- }
- }
- }
-
- [Column(Storage="_TokenSecret", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
- public string TokenSecret
- {
- get
- {
- return this._TokenSecret;
- }
- set
- {
- if ((this._TokenSecret != value))
- {
- this.OnTokenSecretChanging(value);
- this.SendPropertyChanging();
- this._TokenSecret = value;
- this.SendPropertyChanged("TokenSecret");
- this.OnTokenSecretChanged();
- }
- }
- }
-
- [Column(Storage="_State", DbType="INT NOT NULL", CanBeNull=false)]
- public TokenAuthorizationState State
- {
- get
- {
- return this._State;
- }
- set
- {
- if ((this._State != value))
- {
- this.OnStateChanging(value);
- this.SendPropertyChanging();
- this._State = value;
- this.SendPropertyChanged("State");
- this.OnStateChanged();
- }
- }
- }
-
- [Column(Storage="_IssueDate", DbType="DateTime NOT NULL")]
- public System.DateTime IssueDate
- {
- get
- {
- return this._IssueDate;
- }
- set
- {
- if ((this._IssueDate != value))
- {
- this.OnIssueDateChanging(value);
- this.SendPropertyChanging();
- this._IssueDate = value;
- this.SendPropertyChanged("IssueDate");
- this.OnIssueDateChanged();
- }
- }
- }
-
- [Column(Storage="_ConsumerId", DbType="Int NOT NULL")]
- public int ConsumerId
- {
- get
- {
- return this._ConsumerId;
- }
- set
- {
- if ((this._ConsumerId != value))
- {
- if (this._OAuthConsumer.HasLoadedOrAssignedValue)
- {
- throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
- }
- this.OnConsumerIdChanging(value);
- this.SendPropertyChanging();
- this._ConsumerId = value;
- this.SendPropertyChanged("ConsumerId");
- this.OnConsumerIdChanged();
- }
- }
- }
-
- [Column(Storage="_UserId", DbType="Int")]
- public System.Nullable<int> UserId
- {
- get
- {
- return this._UserId;
- }
- set
- {
- if ((this._UserId != value))
- {
- if (this._User.HasLoadedOrAssignedValue)
- {
- throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
- }
- this.OnUserIdChanging(value);
- this.SendPropertyChanging();
- this._UserId = value;
- this.SendPropertyChanged("UserId");
- this.OnUserIdChanged();
- }
- }
- }
-
- [Column(Storage="_Scope", DbType="nvarchar(MAX)", CanBeNull=false)]
- public string Scope
- {
- get
- {
- return this._Scope;
- }
- set
- {
- if ((this._Scope != value))
- {
- this.OnScopeChanging(value);
- this.SendPropertyChanging();
- this._Scope = value;
- this.SendPropertyChanged("Scope");
- this.OnScopeChanged();
- }
- }
- }
-
- [Column(Storage="_RequestTokenVerifier")]
- public string RequestTokenVerifier
- {
- get
- {
- return this._RequestTokenVerifier;
- }
- set
- {
- if ((this._RequestTokenVerifier != value))
- {
- this.OnRequestTokenVerifierChanging(value);
- this.SendPropertyChanging();
- this._RequestTokenVerifier = value;
- this.SendPropertyChanged("RequestTokenVerifier");
- this.OnRequestTokenVerifierChanged();
- }
- }
- }
-
- [Column(Storage="_RequestTokenCallback")]
- public string RequestTokenCallback
- {
- get
- {
- return this._RequestTokenCallback;
- }
- set
- {
- if ((this._RequestTokenCallback != value))
- {
- this.OnRequestTokenCallbackChanging(value);
- this.SendPropertyChanging();
- this._RequestTokenCallback = value;
- this.SendPropertyChanged("RequestTokenCallback");
- this.OnRequestTokenCallbackChanged();
- }
- }
- }
-
- [Column(Storage="_ConsumerVersion")]
- public string ConsumerVersion
- {
- get
- {
- return this._ConsumerVersion;
- }
- set
- {
- if ((this._ConsumerVersion != value))
- {
- this.OnConsumerVersionChanging(value);
- this.SendPropertyChanging();
- this._ConsumerVersion = value;
- this.SendPropertyChanged("ConsumerVersion");
- this.OnConsumerVersionChanged();
- }
- }
- }
-
- [Association(Name="OAuthConsumer_OAuthToken", Storage="_OAuthConsumer", ThisKey="ConsumerId", OtherKey="ConsumerId", IsForeignKey=true, DeleteOnNull=true, DeleteRule="CASCADE")]
- public OAuthConsumer OAuthConsumer
- {
- get
- {
- return this._OAuthConsumer.Entity;
- }
- set
- {
- OAuthConsumer previousValue = this._OAuthConsumer.Entity;
- if (((previousValue != value)
- || (this._OAuthConsumer.HasLoadedOrAssignedValue == false)))
- {
- this.SendPropertyChanging();
- if ((previousValue != null))
- {
- this._OAuthConsumer.Entity = null;
- previousValue.OAuthTokens.Remove(this);
- }
- this._OAuthConsumer.Entity = value;
- if ((value != null))
- {
- value.OAuthTokens.Add(this);
- this._ConsumerId = value.ConsumerId;
- }
- else
- {
- this._ConsumerId = default(int);
- }
- this.SendPropertyChanged("OAuthConsumer");
- }
- }
- }
-
- [Association(Name="User_OAuthToken", Storage="_User", ThisKey="UserId", OtherKey="UserId", IsForeignKey=true, DeleteRule="CASCADE")]
- public User User
- {
- get
- {
- return this._User.Entity;
- }
- set
- {
- User previousValue = this._User.Entity;
- if (((previousValue != value)
- || (this._User.HasLoadedOrAssignedValue == false)))
- {
- this.SendPropertyChanging();
- if ((previousValue != null))
- {
- this._User.Entity = null;
- previousValue.OAuthTokens.Remove(this);
- }
- this._User.Entity = value;
- if ((value != null))
- {
- value.OAuthTokens.Add(this);
- this._UserId = value.UserId;
- }
- else
- {
- this._UserId = default(Nullable<int>);
- }
- this.SendPropertyChanged("User");
- }
- }
- }
-
- public event PropertyChangingEventHandler PropertyChanging;
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void SendPropertyChanging()
- {
- if ((this.PropertyChanging != null))
- {
- this.PropertyChanging(this, emptyChangingEventArgs);
- }
- }
-
- protected virtual void SendPropertyChanged(String propertyName)
- {
- if ((this.PropertyChanged != null))
- {
- this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-}
-#pragma warning restore 1591
diff --git a/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs b/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
deleted file mode 100644
index 8c93d2f..0000000
--- a/samples/OAuthServiceProvider/App_Code/DatabaseTokenManager.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="DatabaseTokenManager.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using DotNetOpenAuth.OAuth.ChannelElements;
-using DotNetOpenAuth.OAuth.Messages;
-
-public class DatabaseTokenManager : IServiceProviderTokenManager {
- #region IServiceProviderTokenManager
-
- public IConsumerDescription GetConsumer(string consumerKey) {
- var consumerRow = Global.DataContext.OAuthConsumers.SingleOrDefault(
- consumerCandidate => consumerCandidate.ConsumerKey == consumerKey);
- if (consumerRow == null) {
- throw new KeyNotFoundException();
- }
-
- return consumerRow;
- }
-
- public IServiceProviderRequestToken GetRequestToken(string token) {
- try {
- return Global.DataContext.OAuthTokens.First(t => t.Token == token && t.State != TokenAuthorizationState.AccessToken);
- } catch (InvalidOperationException ex) {
- throw new KeyNotFoundException("Unrecognized token", ex);
- }
- }
-
- public IServiceProviderAccessToken GetAccessToken(string token) {
- try {
- return Global.DataContext.OAuthTokens.First(t => t.Token == token && t.State == TokenAuthorizationState.AccessToken);
- } catch (InvalidOperationException ex) {
- throw new KeyNotFoundException("Unrecognized token", ex);
- }
- }
-
- public void UpdateToken(IServiceProviderRequestToken token) {
- // Nothing to do here, since we're using Linq To SQL.
- }
-
- #endregion
-
- #region ITokenManager Members
-
- public string GetTokenSecret(string token) {
- var tokenRow = Global.DataContext.OAuthTokens.SingleOrDefault(
- tokenCandidate => tokenCandidate.Token == token);
- if (tokenRow == null) {
- throw new ArgumentException();
- }
-
- return tokenRow.TokenSecret;
- }
-
- public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
- RequestScopedTokenMessage scopedRequest = (RequestScopedTokenMessage)request;
- var consumer = Global.DataContext.OAuthConsumers.Single(consumerRow => consumerRow.ConsumerKey == request.ConsumerKey);
- string scope = scopedRequest.Scope;
- OAuthToken newToken = new OAuthToken {
- OAuthConsumer = consumer,
- Token = response.Token,
- TokenSecret = response.TokenSecret,
- IssueDate = DateTime.UtcNow,
- Scope = scope,
- };
-
- Global.DataContext.OAuthTokens.InsertOnSubmit(newToken);
- Global.DataContext.SubmitChanges();
- }
-
- /// <summary>
- /// Checks whether a given request token has already been authorized
- /// by some user for use by the Consumer that requested it.
- /// </summary>
- /// <param name="requestToken">The Consumer's request token.</param>
- /// <returns>
- /// True if the request token has already been fully authorized by the user
- /// who owns the relevant protected resources. False if the token has not yet
- /// been authorized, has expired or does not exist.
- /// </returns>
- public bool IsRequestTokenAuthorized(string requestToken) {
- var tokenFound = Global.DataContext.OAuthTokens.SingleOrDefault(
- token => token.Token == requestToken &&
- token.State == TokenAuthorizationState.AuthorizedRequestToken);
- return tokenFound != null;
- }
-
- public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
- var data = Global.DataContext;
- var consumerRow = data.OAuthConsumers.Single(consumer => consumer.ConsumerKey == consumerKey);
- var tokenRow = data.OAuthTokens.Single(token => token.Token == requestToken && token.OAuthConsumer == consumerRow);
- Debug.Assert(tokenRow.State == TokenAuthorizationState.AuthorizedRequestToken, "The token should be authorized already!");
-
- // Update the existing row to be an access token.
- tokenRow.IssueDate = DateTime.UtcNow;
- tokenRow.State = TokenAuthorizationState.AccessToken;
- tokenRow.Token = accessToken;
- tokenRow.TokenSecret = accessTokenSecret;
- }
-
- /// <summary>
- /// Classifies a token as a request token or an access token.
- /// </summary>
- /// <param name="token">The token to classify.</param>
- /// <returns>Request or Access token, or invalid if the token is not recognized.</returns>
- public TokenType GetTokenType(string token) {
- var tokenRow = Global.DataContext.OAuthTokens.SingleOrDefault(tokenCandidate => tokenCandidate.Token == token);
- if (tokenRow == null) {
- return TokenType.InvalidToken;
- } else if (tokenRow.State == TokenAuthorizationState.AccessToken) {
- return TokenType.AccessToken;
- } else {
- return TokenType.RequestToken;
- }
- }
-
- #endregion
-
- public void AuthorizeRequestToken(string requestToken, User user) {
- if (requestToken == null) {
- throw new ArgumentNullException("requestToken");
- }
- if (user == null) {
- throw new ArgumentNullException("user");
- }
-
- var tokenRow = Global.DataContext.OAuthTokens.SingleOrDefault(
- tokenCandidate => tokenCandidate.Token == requestToken &&
- tokenCandidate.State == TokenAuthorizationState.UnauthorizedRequestToken);
- if (tokenRow == null) {
- throw new ArgumentException();
- }
-
- tokenRow.State = TokenAuthorizationState.AuthorizedRequestToken;
- tokenRow.User = user;
- }
-
- public OAuthConsumer GetConsumerForToken(string token) {
- if (String.IsNullOrEmpty(token)) {
- throw new ArgumentNullException("requestToken");
- }
-
- var tokenRow = Global.DataContext.OAuthTokens.SingleOrDefault(
- tokenCandidate => tokenCandidate.Token == token);
- if (tokenRow == null) {
- throw new ArgumentException();
- }
-
- return tokenRow.OAuthConsumer;
- }
-}
diff --git a/samples/OAuthServiceProvider/App_Code/Global.cs b/samples/OAuthServiceProvider/App_Code/Global.cs
deleted file mode 100644
index 10b3cba..0000000
--- a/samples/OAuthServiceProvider/App_Code/Global.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-using System;
-using System.Linq;
-using System.ServiceModel;
-using System.Text;
-using System.Web;
-using DotNetOpenAuth.OAuth.Messages;
-
-/// <summary>
-/// The web application global events and properties.
-/// </summary>
-public class Global : HttpApplication {
- /// <summary>
- /// An application memory cache of recent log messages.
- /// </summary>
- public static StringBuilder LogMessages = new StringBuilder();
-
- /// <summary>
- /// The logger for this sample to use.
- /// </summary>
- public static log4net.ILog Logger = log4net.LogManager.GetLogger("DotNetOpenAuth.ConsumerSample");
-
- /// <summary>
- /// Gets the transaction-protected database connection for the current request.
- /// </summary>
- public static DataClassesDataContext DataContext {
- get {
- DataClassesDataContext dataContext = dataContextSimple;
- if (dataContext == null) {
- dataContext = new DataClassesDataContext();
- dataContext.Connection.Open();
- dataContext.Transaction = dataContext.Connection.BeginTransaction();
- dataContextSimple = dataContext;
- }
-
- return dataContext;
- }
- }
-
- public static DatabaseTokenManager TokenManager { get; set; }
-
- public static User LoggedInUser {
- get { return Global.DataContext.Users.SingleOrDefault(user => user.OpenIDClaimedIdentifier == HttpContext.Current.User.Identity.Name); }
- }
-
- public static UserAuthorizationRequest PendingOAuthAuthorization {
- get { return HttpContext.Current.Session["authrequest"] as UserAuthorizationRequest; }
- set { HttpContext.Current.Session["authrequest"] = value; }
- }
-
- private static DataClassesDataContext dataContextSimple {
- get {
- if (HttpContext.Current != null) {
- return HttpContext.Current.Items["DataContext"] as DataClassesDataContext;
- } else if (OperationContext.Current != null) {
- object data;
- if (OperationContext.Current.IncomingMessageProperties.TryGetValue("DataContext", out data)) {
- return data as DataClassesDataContext;
- } else {
- return null;
- }
- } else {
- throw new InvalidOperationException();
- }
- }
-
- set {
- if (HttpContext.Current != null) {
- HttpContext.Current.Items["DataContext"] = value;
- } else if (OperationContext.Current != null) {
- OperationContext.Current.IncomingMessageProperties["DataContext"] = value;
- } else {
- throw new InvalidOperationException();
- }
- }
- }
-
- public static void AuthorizePendingRequestToken() {
- ITokenContainingMessage tokenMessage = PendingOAuthAuthorization;
- TokenManager.AuthorizeRequestToken(tokenMessage.Token, LoggedInUser);
- PendingOAuthAuthorization = null;
- }
-
- private static void CommitAndCloseDatabaseIfNecessary() {
- var dataContext = dataContextSimple;
- if (dataContext != null) {
- dataContext.SubmitChanges();
- dataContext.Transaction.Commit();
- dataContext.Connection.Close();
- }
- }
-
- private void Application_Start(object sender, EventArgs e) {
- log4net.Config.XmlConfigurator.Configure();
- Logger.Info("Sample starting...");
- string appPath = HttpContext.Current.Request.ApplicationPath;
- if (!appPath.EndsWith("/")) {
- appPath += "/";
- }
-
- // This will break in IIS Integrated Pipeline mode, since applications
- // start before the first incoming request context is available.
- // TODO: fix this.
- Constants.WebRootUrl = new Uri(HttpContext.Current.Request.Url, appPath);
- var tokenManager = new DatabaseTokenManager();
- Global.TokenManager = tokenManager;
- }
-
- private void Application_End(object sender, EventArgs e) {
- Logger.Info("Sample shutting down...");
-
- // this would be automatic, but in partial trust scenarios it is not.
- log4net.LogManager.Shutdown();
- }
-
- private void Application_Error(object sender, EventArgs e) {
- Logger.Error("An unhandled exception occurred in ASP.NET processing: " + Server.GetLastError(), Server.GetLastError());
- }
-
- private void Application_EndRequest(object sender, EventArgs e) {
- CommitAndCloseDatabaseIfNecessary();
- }
-}
diff --git a/samples/OAuthServiceProvider/App_Code/IDataApi.cs b/samples/OAuthServiceProvider/App_Code/IDataApi.cs
deleted file mode 100644
index 350df35..0000000
--- a/samples/OAuthServiceProvider/App_Code/IDataApi.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.Serialization;
-using System.ServiceModel;
-using System.Text;
-
-[ServiceContract]
-public interface IDataApi {
- [OperationContract]
- int? GetAge();
-
- [OperationContract]
- string GetName();
-
- [OperationContract]
- string[] GetFavoriteSites();
-}
diff --git a/samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs b/samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs
deleted file mode 100644
index ee90364..0000000
--- a/samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IdentityModel.Policy;
-using System.Linq;
-using System.Security.Principal;
-using System.ServiceModel;
-using System.ServiceModel.Channels;
-using System.ServiceModel.Security;
-using DotNetOpenAuth;
-using DotNetOpenAuth.OAuth;
-
-/// <summary>
-/// A WCF extension to authenticate incoming messages using OAuth.
-/// </summary>
-public class OAuthAuthorizationManager : ServiceAuthorizationManager {
- public OAuthAuthorizationManager() {
- }
-
- protected override bool CheckAccessCore(OperationContext operationContext) {
- if (!base.CheckAccessCore(operationContext)) {
- return false;
- }
-
- HttpRequestMessageProperty httpDetails = operationContext.RequestContext.RequestMessage.Properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
- Uri requestUri = operationContext.RequestContext.RequestMessage.Properties["OriginalHttpRequestUri"] as Uri;
- ServiceProvider sp = Constants.CreateServiceProvider();
- try {
- var auth = sp.ReadProtectedResourceAuthorization(httpDetails, requestUri);
- if (auth != null) {
- var accessToken = Global.DataContext.OAuthTokens.Single(token => token.Token == auth.AccessToken);
-
- var principal = sp.CreatePrincipal(auth);
- var policy = new OAuthPrincipalAuthorizationPolicy(principal);
- var policies = new List<IAuthorizationPolicy> {
- policy,
- };
-
- var securityContext = new ServiceSecurityContext(policies.AsReadOnly());
- if (operationContext.IncomingMessageProperties.Security != null) {
- operationContext.IncomingMessageProperties.Security.ServiceSecurityContext = securityContext;
- } else {
- operationContext.IncomingMessageProperties.Security = new SecurityMessageProperty {
- ServiceSecurityContext = securityContext,
- };
- }
-
- securityContext.AuthorizationContext.Properties["Identities"] = new List<IIdentity> {
- principal.Identity,
- };
-
- // Only allow this method call if the access token scope permits it.
- string[] scopes = accessToken.Scope.Split('|');
- if (scopes.Contains(operationContext.IncomingMessageHeaders.Action)) {
- return true;
- }
- }
- } catch (ProtocolException ex) {
- Global.Logger.Error("Error processing OAuth messages.", ex);
- }
-
- return false;
- }
-}
diff --git a/samples/OAuthServiceProvider/App_Code/OAuthConsumer.cs b/samples/OAuthServiceProvider/App_Code/OAuthConsumer.cs
deleted file mode 100644
index db8f469..0000000
--- a/samples/OAuthServiceProvider/App_Code/OAuthConsumer.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuthConsumer.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using DotNetOpenAuth.OAuth.ChannelElements;
-
-public partial class OAuthConsumer : IConsumerDescription {
- #region IConsumerDescription Members
-
- string IConsumerDescription.Key {
- get { return this.ConsumerKey; }
- }
-
- string IConsumerDescription.Secret {
- get { return this.ConsumerSecret; }
- }
-
- System.Security.Cryptography.X509Certificates.X509Certificate2 IConsumerDescription.Certificate {
- get { return null; }
- }
-
- Uri IConsumerDescription.Callback {
- get { return string.IsNullOrEmpty(this.Callback) ? null : new Uri(this.Callback); }
- }
-
- DotNetOpenAuth.OAuth.VerificationCodeFormat IConsumerDescription.VerificationCodeFormat {
- get { return this.VerificationCodeFormat; }
- }
-
- int IConsumerDescription.VerificationCodeLength {
- get { return this.VerificationCodeLength; }
- }
-
- #endregion
-}
diff --git a/samples/OAuthServiceProvider/App_Code/OAuthPrincipalAuthorizationPolicy.cs b/samples/OAuthServiceProvider/App_Code/OAuthPrincipalAuthorizationPolicy.cs
deleted file mode 100644
index 5bd6b05..0000000
--- a/samples/OAuthServiceProvider/App_Code/OAuthPrincipalAuthorizationPolicy.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IdentityModel.Claims;
-using System.IdentityModel.Policy;
-using System.Linq;
-using System.Web;
-using DotNetOpenAuth.OAuth.ChannelElements;
-
-public class OAuthPrincipalAuthorizationPolicy : IAuthorizationPolicy {
- private readonly Guid uniqueId = Guid.NewGuid();
- private readonly OAuthPrincipal principal;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OAuthPrincipalAuthorizationPolicy"/> class.
- /// </summary>
- /// <param name="principal">The principal.</param>
- public OAuthPrincipalAuthorizationPolicy(OAuthPrincipal principal) {
- this.principal = principal;
- }
-
- #region IAuthorizationComponent Members
-
- /// <summary>
- /// Gets a unique ID for this instance.
- /// </summary>
- public string Id {
- get { return this.uniqueId.ToString(); }
- }
-
- #endregion
-
- #region IAuthorizationPolicy Members
-
- public ClaimSet Issuer {
- get { return ClaimSet.System; }
- }
-
- public bool Evaluate(EvaluationContext evaluationContext, ref object state) {
- evaluationContext.AddClaimSet(this, new DefaultClaimSet(Claim.CreateNameClaim(this.principal.Identity.Name)));
- evaluationContext.Properties["Principal"] = this.principal;
- return true;
- }
-
- #endregion
-}
diff --git a/samples/OAuthServiceProvider/App_Code/OAuthToken.cs b/samples/OAuthServiceProvider/App_Code/OAuthToken.cs
deleted file mode 100644
index ea18b2b..0000000
--- a/samples/OAuthServiceProvider/App_Code/OAuthToken.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuthToken.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using DotNetOpenAuth.OAuth.ChannelElements;
-
-public partial class OAuthToken : IServiceProviderRequestToken, IServiceProviderAccessToken {
- #region IServiceProviderRequestToken Members
-
- string IServiceProviderRequestToken.Token {
- get { return this.Token; }
- }
-
- string IServiceProviderRequestToken.ConsumerKey {
- get { return this.OAuthConsumer.ConsumerKey; }
- }
-
- DateTime IServiceProviderRequestToken.CreatedOn {
- get { return this.IssueDate; }
- }
-
- Uri IServiceProviderRequestToken.Callback {
- get { return string.IsNullOrEmpty(this.RequestTokenCallback) ? null : new Uri(this.RequestTokenCallback); }
- set { this.RequestTokenCallback = value.AbsoluteUri; }
- }
-
- string IServiceProviderRequestToken.VerificationCode {
- get { return this.RequestTokenVerifier; }
- set { this.RequestTokenVerifier = value; }
- }
-
- Version IServiceProviderRequestToken.ConsumerVersion {
- get { return new Version(this.ConsumerVersion); }
- set { this.ConsumerVersion = value.ToString(); }
- }
-
- #endregion
-
- #region IServiceProviderAccessToken Members
-
- string IServiceProviderAccessToken.Token {
- get { return this.Token; }
- }
-
- DateTime? IServiceProviderAccessToken.ExpirationDate {
- get { return null; }
- }
-
- string IServiceProviderAccessToken.Username {
- get { return this.User.OpenIDClaimedIdentifier; }
- }
-
- string[] IServiceProviderAccessToken.Roles {
- get { return this.Scope.Split('|'); }
- }
-
- #endregion
-}
diff --git a/samples/OAuthServiceProvider/App_Code/RequestScopedTokenMessage.cs b/samples/OAuthServiceProvider/App_Code/RequestScopedTokenMessage.cs
deleted file mode 100644
index 4cc4860..0000000
--- a/samples/OAuthServiceProvider/App_Code/RequestScopedTokenMessage.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using DotNetOpenAuth.Messaging;
-using DotNetOpenAuth.OAuth.Messages;
-
-/// <summary>
-/// A custom web app version of the message sent to request an unauthorized token.
-/// </summary>
-public class RequestScopedTokenMessage : UnauthorizedTokenRequest {
- /// <summary>
- /// Initializes a new instance of the <see cref="RequestScopedTokenMessage"/> class.
- /// </summary>
- /// <param name="endpoint">The endpoint that will receive the message.</param>
- /// <param name="version">The OAuth version.</param>
- public RequestScopedTokenMessage(MessageReceivingEndpoint endpoint, Version version) : base(endpoint, version) {
- }
-
- /// <summary>
- /// Gets or sets the scope of the access being requested.
- /// </summary>
- [MessagePart("scope", IsRequired = true)]
- public string Scope { get; set; }
-}
diff --git a/samples/OAuthServiceProvider/App_Code/TokenAuthorizationState.cs b/samples/OAuthServiceProvider/App_Code/TokenAuthorizationState.cs
deleted file mode 100644
index 8d3c8ac..0000000
--- a/samples/OAuthServiceProvider/App_Code/TokenAuthorizationState.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-
-/// <summary>
-/// Various states an OAuth token can be in.
-/// </summary>
-public enum TokenAuthorizationState : int {
- /// <summary>
- /// An unauthorized request token.
- /// </summary>
- UnauthorizedRequestToken = 0,
-
- /// <summary>
- /// An authorized request token.
- /// </summary>
- AuthorizedRequestToken = 1,
-
- /// <summary>
- /// An authorized access token.
- /// </summary>
- AccessToken = 2,
-}
diff --git a/samples/OAuthServiceProvider/App_Code/TracePageAppender.cs b/samples/OAuthServiceProvider/App_Code/TracePageAppender.cs
deleted file mode 100644
index 7490f3d..0000000
--- a/samples/OAuthServiceProvider/App_Code/TracePageAppender.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Web;
-
-public class TracePageAppender : log4net.Appender.AppenderSkeleton {
- protected override void Append(log4net.Core.LoggingEvent loggingEvent) {
- StringWriter sw = new StringWriter(Global.LogMessages);
- Layout.Format(sw, loggingEvent);
- }
-}
diff --git a/samples/OAuthServiceProvider/App_Code/Utilities.cs b/samples/OAuthServiceProvider/App_Code/Utilities.cs
deleted file mode 100644
index 2c25fe8..0000000
--- a/samples/OAuthServiceProvider/App_Code/Utilities.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Principal;
-using System.Web;
-
-/// <summary>
-/// Extension methods and other helpful utility methods.
-/// </summary>
-public static class Utilities {
- /// <summary>
- /// Gets the database entity representing the user identified by a given <see cref="IIdentity"/> instance.
- /// </summary>
- /// <param name="identity">The identity of the user.</param>
- /// <returns>
- /// The database object for that user; or <c>null</c> if the user could not
- /// be found or if <paramref name="identity"/> is <c>null</c> or represents an anonymous identity.
- /// </returns>
- public static User GetUser(this IIdentity identity) {
- if (identity == null || !identity.IsAuthenticated) {
- return null;
- }
-
- return Global.DataContext.Users.SingleOrDefault(user => user.OpenIDClaimedIdentifier == identity.Name);
- }
-}
diff --git a/samples/OAuthServiceProvider/Bin/DotNetOpenAuth.dll.refresh_ b/samples/OAuthServiceProvider/Bin/DotNetOpenAuth.dll.refresh_
deleted file mode 100644
index 946bd4b..0000000
--- a/samples/OAuthServiceProvider/Bin/DotNetOpenAuth.dll.refresh_
+++ /dev/null
Binary files differ
diff --git a/samples/OAuthServiceProvider/Bin/log4net.dll.refresh b/samples/OAuthServiceProvider/Bin/log4net.dll.refresh
deleted file mode 100644
index ede40da..0000000
--- a/samples/OAuthServiceProvider/Bin/log4net.dll.refresh
+++ /dev/null
Binary files differ
diff --git a/samples/OAuthServiceProvider/Code/Constants.cs b/samples/OAuthServiceProvider/Code/Constants.cs
new file mode 100644
index 0000000..3e629f0
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/Constants.cs
@@ -0,0 +1,32 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OAuth;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+
+ /// <summary>
+ /// Service Provider definitions.
+ /// </summary>
+ public static class Constants {
+ public static Uri WebRootUrl { get; set; }
+
+ public static ServiceProviderDescription SelfDescription {
+ get {
+ ServiceProviderDescription description = new ServiceProviderDescription {
+ AccessTokenEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethods.PostRequest),
+ RequestTokenEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethods.PostRequest),
+ UserAuthorizationEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethods.PostRequest),
+ TamperProtectionElements = new ITamperProtectionChannelBindingElement[] {
+ new HmacSha1SigningBindingElement(),
+ },
+ };
+
+ return description;
+ }
+ }
+
+ public static ServiceProvider CreateServiceProvider() {
+ return new ServiceProvider(SelfDescription, Global.TokenManager, Global.NonceStore);
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/CustomOAuthTypeProvider.cs b/samples/OAuthServiceProvider/Code/CustomOAuthTypeProvider.cs
new file mode 100644
index 0000000..67da17c
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/CustomOAuthTypeProvider.cs
@@ -0,0 +1,34 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+ using DotNetOpenAuth.OAuth.Messages;
+
+ /// <summary>
+ /// A custom class that will cause the OAuth library to use our custom message types
+ /// where we have them.
+ /// </summary>
+ public class CustomOAuthMessageFactory : OAuthServiceProviderMessageFactory {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CustomOAuthMessageFactory"/> class.
+ /// </summary>
+ /// <param name="tokenManager">The token manager instance to use.</param>
+ public CustomOAuthMessageFactory(IServiceProviderTokenManager tokenManager)
+ : base(tokenManager) {
+ }
+
+ public override IDirectedProtocolMessage GetNewRequestMessage(MessageReceivingEndpoint recipient, IDictionary<string, string> fields) {
+ var message = base.GetNewRequestMessage(recipient, fields);
+
+ // inject our own type here to replace the standard one
+ if (message is UnauthorizedTokenRequest) {
+ message = new RequestScopedTokenMessage(recipient, message.Version);
+ }
+
+ return message;
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/App_Code/DataClasses.dbml b/samples/OAuthServiceProvider/Code/DataClasses.dbml
index 651de9f..5522ec8 100644
--- a/samples/OAuthServiceProvider/App_Code/DataClasses.dbml
+++ b/samples/OAuthServiceProvider/Code/DataClasses.dbml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Database Name="Database" Class="DataClassesDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
+<?xml version="1.0" encoding="utf-8"?><Database Name="Database" EntityNamespace="OAuthServiceProvider.Code" Class="DataClassesDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
<Connection Mode="WebSettings" ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True" SettingsObjectName="System.Configuration.ConfigurationManager.ConnectionStrings" SettingsPropertyName="DatabaseConnectionString" Provider="System.Data.SqlClient" />
<Table Name="dbo.[User]" Member="Users">
<Type Name="User">
@@ -36,7 +35,7 @@
<Column Name="TokenId" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
<Column Name="Token" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
<Column Name="TokenSecret" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
- <Column Name="State" Type="TokenAuthorizationState" DbType="INT NOT NULL" CanBeNull="false" />
+ <Column Name="State" Type="OAuthServiceProvider.Code.TokenAuthorizationState" DbType="INT NOT NULL" CanBeNull="false" />
<Column Name="IssueDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
<Column Name="ConsumerId" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
<Column Name="UserId" Type="System.Int32" DbType="Int" CanBeNull="true" />
@@ -48,4 +47,11 @@
<Association Name="User_OAuthToken" Member="User" ThisKey="UserId" OtherKey="UserId" Type="User" IsForeignKey="true" DeleteRule="CASCADE" />
</Type>
</Table>
+ <Table Name="" Member="Nonces">
+ <Type Name="Nonce">
+ <Column Member="Context" Type="System.String" IsPrimaryKey="true" CanBeNull="false" />
+ <Column Member="Code" Type="System.String" IsPrimaryKey="true" CanBeNull="false" />
+ <Column Member="Timestamp" Type="System.DateTime" IsPrimaryKey="true" CanBeNull="false" />
+ </Type>
+ </Table>
</Database> \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/App_Code/DataClasses.dbml.layout b/samples/OAuthServiceProvider/Code/DataClasses.dbml.layout
index 71bd4aa..9b80443 100644
--- a/samples/OAuthServiceProvider/App_Code/DataClasses.dbml.layout
+++ b/samples/OAuthServiceProvider/Code/DataClasses.dbml.layout
@@ -33,19 +33,25 @@
<classShapeMoniker Id="8a79b099-7f87-4766-907a-db2c3e1b5716" />
</nodes>
</associationConnector>
- <associationConnector edgePoints="[(2.625 : 4.23159912109375); (3.5 : 4.23159912109375)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+ <associationConnector edgePoints="[(2.625 : 4.23159912109375); (3.5 : 4.23159912109375)]" fixedFrom="NotFixed" fixedTo="NotFixed">
<AssociationMoniker Name="/DataClassesDataContext/OAuthConsumer/OAuthConsumer_OAuthToken" />
<nodes>
<classShapeMoniker Id="f909becb-85b1-4fe6-bb16-3feb3e4fe3ee" />
<classShapeMoniker Id="895ebbc8-8352-4c04-9e53-b8e6c8302d36" />
</nodes>
</associationConnector>
- <associationConnector edgePoints="[(0.53125 : 2.27089680989583); (0.53125 : 5.66270182291667); (3.5 : 5.66270182291667)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+ <associationConnector edgePoints="[(0.53125 : 2.27089680989583); (0.53125 : 5.66270182291667); (3.5 : 5.66270182291667)]" fixedFrom="NotFixed" fixedTo="NotFixed">
<AssociationMoniker Name="/DataClassesDataContext/User/User_OAuthToken" />
<nodes>
<classShapeMoniker Id="696d2c69-040e-411d-9257-bb664b743834" />
<classShapeMoniker Id="895ebbc8-8352-4c04-9e53-b8e6c8302d36" />
</nodes>
</associationConnector>
+ <classShape Id="a63562a7-acf2-4ed9-9686-52a1ad85633e" absoluteBounds="1.375, 6.375, 2, 1.3862939453124996">
+ <DataClassMoniker Name="/DataClassesDataContext/Nonce" />
+ <nestedChildShapes>
+ <elementListCompartment Id="9e4514ef-bc7b-4179-88e6-05363bf6ee5e" absoluteBounds="1.39, 6.835, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+ </nestedChildShapes>
+ </classShape>
</nestedChildShapes>
</ordesignerObjectsDiagram> \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/DataClasses.designer.cs b/samples/OAuthServiceProvider/Code/DataClasses.designer.cs
new file mode 100644
index 0000000..3c0d936
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/DataClasses.designer.cs
@@ -0,0 +1,1190 @@
+#pragma warning disable 1591
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.1
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthServiceProvider.Code
+{
+ using System.Data.Linq;
+ using System.Data.Linq.Mapping;
+ using System.Data;
+ using System.Collections.Generic;
+ using System.Reflection;
+ using System.Linq;
+ using System.Linq.Expressions;
+ using System.ComponentModel;
+ using System;
+
+
+ [global::System.Data.Linq.Mapping.DatabaseAttribute(Name="Database")]
+ public partial class DataClassesDataContext : System.Data.Linq.DataContext
+ {
+
+ private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
+
+ #region Extensibility Method Definitions
+ partial void OnCreated();
+ partial void InsertUser(User instance);
+ partial void UpdateUser(User instance);
+ partial void DeleteUser(User instance);
+ partial void InsertFavoriteSite(FavoriteSite instance);
+ partial void UpdateFavoriteSite(FavoriteSite instance);
+ partial void DeleteFavoriteSite(FavoriteSite instance);
+ partial void InsertOAuthConsumer(OAuthConsumer instance);
+ partial void UpdateOAuthConsumer(OAuthConsumer instance);
+ partial void DeleteOAuthConsumer(OAuthConsumer instance);
+ partial void InsertOAuthToken(OAuthToken instance);
+ partial void UpdateOAuthToken(OAuthToken instance);
+ partial void DeleteOAuthToken(OAuthToken instance);
+ partial void InsertNonce(Nonce instance);
+ partial void UpdateNonce(Nonce instance);
+ partial void DeleteNonce(Nonce instance);
+ #endregion
+
+ public DataClassesDataContext() :
+ base(global::System.Configuration.ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public DataClassesDataContext(string connection) :
+ base(connection, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public DataClassesDataContext(System.Data.IDbConnection connection) :
+ base(connection, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public DataClassesDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
+ base(connection, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public DataClassesDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
+ base(connection, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public System.Data.Linq.Table<User> Users
+ {
+ get
+ {
+ return this.GetTable<User>();
+ }
+ }
+
+ public System.Data.Linq.Table<FavoriteSite> FavoriteSites
+ {
+ get
+ {
+ return this.GetTable<FavoriteSite>();
+ }
+ }
+
+ public System.Data.Linq.Table<OAuthConsumer> OAuthConsumers
+ {
+ get
+ {
+ return this.GetTable<OAuthConsumer>();
+ }
+ }
+
+ public System.Data.Linq.Table<OAuthToken> OAuthTokens
+ {
+ get
+ {
+ return this.GetTable<OAuthToken>();
+ }
+ }
+
+ public System.Data.Linq.Table<Nonce> Nonces
+ {
+ get
+ {
+ return this.GetTable<Nonce>();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.[User]")]
+ public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
+ {
+
+ private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+
+ private int _UserId;
+
+ private string _OpenIDClaimedIdentifier;
+
+ private string _OpenIDFriendlyIdentifier;
+
+ private string _FullName;
+
+ private System.Nullable<int> _Age;
+
+ private EntitySet<FavoriteSite> _FavoriteSites;
+
+ private EntitySet<OAuthToken> _OAuthTokens;
+
+ #region Extensibility Method Definitions
+ partial void OnLoaded();
+ partial void OnValidate(System.Data.Linq.ChangeAction action);
+ partial void OnCreated();
+ partial void OnUserIdChanging(int value);
+ partial void OnUserIdChanged();
+ partial void OnOpenIDClaimedIdentifierChanging(string value);
+ partial void OnOpenIDClaimedIdentifierChanged();
+ partial void OnOpenIDFriendlyIdentifierChanging(string value);
+ partial void OnOpenIDFriendlyIdentifierChanged();
+ partial void OnFullNameChanging(string value);
+ partial void OnFullNameChanged();
+ partial void OnAgeChanging(System.Nullable<int> value);
+ partial void OnAgeChanged();
+ #endregion
+
+ public User()
+ {
+ this._FavoriteSites = new EntitySet<FavoriteSite>(new Action<FavoriteSite>(this.attach_FavoriteSites), new Action<FavoriteSite>(this.detach_FavoriteSites));
+ this._OAuthTokens = new EntitySet<OAuthToken>(new Action<OAuthToken>(this.attach_OAuthTokens), new Action<OAuthToken>(this.detach_OAuthTokens));
+ OnCreated();
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
+ public int UserId
+ {
+ get
+ {
+ return this._UserId;
+ }
+ set
+ {
+ if ((this._UserId != value))
+ {
+ this.OnUserIdChanging(value);
+ this.SendPropertyChanging();
+ this._UserId = value;
+ this.SendPropertyChanged("UserId");
+ this.OnUserIdChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OpenIDClaimedIdentifier", DbType="NVarChar(150) NOT NULL", CanBeNull=false)]
+ public string OpenIDClaimedIdentifier
+ {
+ get
+ {
+ return this._OpenIDClaimedIdentifier;
+ }
+ set
+ {
+ if ((this._OpenIDClaimedIdentifier != value))
+ {
+ this.OnOpenIDClaimedIdentifierChanging(value);
+ this.SendPropertyChanging();
+ this._OpenIDClaimedIdentifier = value;
+ this.SendPropertyChanged("OpenIDClaimedIdentifier");
+ this.OnOpenIDClaimedIdentifierChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OpenIDFriendlyIdentifier", DbType="NVarChar(150)")]
+ public string OpenIDFriendlyIdentifier
+ {
+ get
+ {
+ return this._OpenIDFriendlyIdentifier;
+ }
+ set
+ {
+ if ((this._OpenIDFriendlyIdentifier != value))
+ {
+ this.OnOpenIDFriendlyIdentifierChanging(value);
+ this.SendPropertyChanging();
+ this._OpenIDFriendlyIdentifier = value;
+ this.SendPropertyChanged("OpenIDFriendlyIdentifier");
+ this.OnOpenIDFriendlyIdentifierChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FullName", DbType="NVarChar(150)", CanBeNull=false)]
+ public string FullName
+ {
+ get
+ {
+ return this._FullName;
+ }
+ set
+ {
+ if ((this._FullName != value))
+ {
+ this.OnFullNameChanging(value);
+ this.SendPropertyChanging();
+ this._FullName = value;
+ this.SendPropertyChanged("FullName");
+ this.OnFullNameChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Age", DbType="int")]
+ public System.Nullable<int> Age
+ {
+ get
+ {
+ return this._Age;
+ }
+ set
+ {
+ if ((this._Age != value))
+ {
+ this.OnAgeChanging(value);
+ this.SendPropertyChanging();
+ this._Age = value;
+ this.SendPropertyChanged("Age");
+ this.OnAgeChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_FavoriteSite", Storage="_FavoriteSites", ThisKey="UserId", OtherKey="UserId")]
+ public EntitySet<FavoriteSite> FavoriteSites
+ {
+ get
+ {
+ return this._FavoriteSites;
+ }
+ set
+ {
+ this._FavoriteSites.Assign(value);
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_OAuthToken", Storage="_OAuthTokens", ThisKey="UserId", OtherKey="UserId")]
+ public EntitySet<OAuthToken> OAuthTokens
+ {
+ get
+ {
+ return this._OAuthTokens;
+ }
+ set
+ {
+ this._OAuthTokens.Assign(value);
+ }
+ }
+
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void SendPropertyChanging()
+ {
+ if ((this.PropertyChanging != null))
+ {
+ this.PropertyChanging(this, emptyChangingEventArgs);
+ }
+ }
+
+ protected virtual void SendPropertyChanged(String propertyName)
+ {
+ if ((this.PropertyChanged != null))
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+
+ private void attach_FavoriteSites(FavoriteSite entity)
+ {
+ this.SendPropertyChanging();
+ entity.User = this;
+ }
+
+ private void detach_FavoriteSites(FavoriteSite entity)
+ {
+ this.SendPropertyChanging();
+ entity.User = null;
+ }
+
+ private void attach_OAuthTokens(OAuthToken entity)
+ {
+ this.SendPropertyChanging();
+ entity.User = this;
+ }
+
+ private void detach_OAuthTokens(OAuthToken entity)
+ {
+ this.SendPropertyChanging();
+ entity.User = null;
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.FavoriteSite")]
+ public partial class FavoriteSite : INotifyPropertyChanging, INotifyPropertyChanged
+ {
+
+ private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+
+ private int _FavoriteSiteId;
+
+ private int _UserId;
+
+ private string _SiteUrl;
+
+ private EntityRef<User> _User;
+
+ #region Extensibility Method Definitions
+ partial void OnLoaded();
+ partial void OnValidate(System.Data.Linq.ChangeAction action);
+ partial void OnCreated();
+ partial void OnFavoriteSiteIdChanging(int value);
+ partial void OnFavoriteSiteIdChanged();
+ partial void OnUserIdChanging(int value);
+ partial void OnUserIdChanged();
+ partial void OnSiteUrlChanging(string value);
+ partial void OnSiteUrlChanged();
+ #endregion
+
+ public FavoriteSite()
+ {
+ this._User = default(EntityRef<User>);
+ OnCreated();
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FavoriteSiteId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
+ public int FavoriteSiteId
+ {
+ get
+ {
+ return this._FavoriteSiteId;
+ }
+ set
+ {
+ if ((this._FavoriteSiteId != value))
+ {
+ this.OnFavoriteSiteIdChanging(value);
+ this.SendPropertyChanging();
+ this._FavoriteSiteId = value;
+ this.SendPropertyChanged("FavoriteSiteId");
+ this.OnFavoriteSiteIdChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="Int NOT NULL")]
+ public int UserId
+ {
+ get
+ {
+ return this._UserId;
+ }
+ set
+ {
+ if ((this._UserId != value))
+ {
+ if (this._User.HasLoadedOrAssignedValue)
+ {
+ throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+ }
+ this.OnUserIdChanging(value);
+ this.SendPropertyChanging();
+ this._UserId = value;
+ this.SendPropertyChanged("UserId");
+ this.OnUserIdChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SiteUrl", DbType="NVarChar(255) NOT NULL", CanBeNull=false)]
+ public string SiteUrl
+ {
+ get
+ {
+ return this._SiteUrl;
+ }
+ set
+ {
+ if ((this._SiteUrl != value))
+ {
+ this.OnSiteUrlChanging(value);
+ this.SendPropertyChanging();
+ this._SiteUrl = value;
+ this.SendPropertyChanged("SiteUrl");
+ this.OnSiteUrlChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_FavoriteSite", Storage="_User", ThisKey="UserId", OtherKey="UserId", IsForeignKey=true, DeleteOnNull=true, DeleteRule="CASCADE")]
+ public User User
+ {
+ get
+ {
+ return this._User.Entity;
+ }
+ set
+ {
+ User previousValue = this._User.Entity;
+ if (((previousValue != value)
+ || (this._User.HasLoadedOrAssignedValue == false)))
+ {
+ this.SendPropertyChanging();
+ if ((previousValue != null))
+ {
+ this._User.Entity = null;
+ previousValue.FavoriteSites.Remove(this);
+ }
+ this._User.Entity = value;
+ if ((value != null))
+ {
+ value.FavoriteSites.Add(this);
+ this._UserId = value.UserId;
+ }
+ else
+ {
+ this._UserId = default(int);
+ }
+ this.SendPropertyChanged("User");
+ }
+ }
+ }
+
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void SendPropertyChanging()
+ {
+ if ((this.PropertyChanging != null))
+ {
+ this.PropertyChanging(this, emptyChangingEventArgs);
+ }
+ }
+
+ protected virtual void SendPropertyChanged(String propertyName)
+ {
+ if ((this.PropertyChanged != null))
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.OAuthConsumer")]
+ public partial class OAuthConsumer : INotifyPropertyChanging, INotifyPropertyChanged
+ {
+
+ private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+
+ private int _ConsumerId;
+
+ private string _ConsumerKey;
+
+ private string _ConsumerSecret;
+
+ private string _Callback;
+
+ private DotNetOpenAuth.OAuth.VerificationCodeFormat _VerificationCodeFormat;
+
+ private int _VerificationCodeLength;
+
+ private EntitySet<OAuthToken> _OAuthTokens;
+
+ #region Extensibility Method Definitions
+ partial void OnLoaded();
+ partial void OnValidate(System.Data.Linq.ChangeAction action);
+ partial void OnCreated();
+ partial void OnConsumerIdChanging(int value);
+ partial void OnConsumerIdChanged();
+ partial void OnConsumerKeyChanging(string value);
+ partial void OnConsumerKeyChanged();
+ partial void OnConsumerSecretChanging(string value);
+ partial void OnConsumerSecretChanged();
+ partial void OnCallbackChanging(string value);
+ partial void OnCallbackChanged();
+ partial void OnVerificationCodeFormatChanging(DotNetOpenAuth.OAuth.VerificationCodeFormat value);
+ partial void OnVerificationCodeFormatChanged();
+ partial void OnVerificationCodeLengthChanging(int value);
+ partial void OnVerificationCodeLengthChanged();
+ #endregion
+
+ public OAuthConsumer()
+ {
+ this._OAuthTokens = new EntitySet<OAuthToken>(new Action<OAuthToken>(this.attach_OAuthTokens), new Action<OAuthToken>(this.detach_OAuthTokens));
+ OnCreated();
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConsumerId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
+ public int ConsumerId
+ {
+ get
+ {
+ return this._ConsumerId;
+ }
+ set
+ {
+ if ((this._ConsumerId != value))
+ {
+ this.OnConsumerIdChanging(value);
+ this.SendPropertyChanging();
+ this._ConsumerId = value;
+ this.SendPropertyChanged("ConsumerId");
+ this.OnConsumerIdChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConsumerKey", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string ConsumerKey
+ {
+ get
+ {
+ return this._ConsumerKey;
+ }
+ set
+ {
+ if ((this._ConsumerKey != value))
+ {
+ this.OnConsumerKeyChanging(value);
+ this.SendPropertyChanging();
+ this._ConsumerKey = value;
+ this.SendPropertyChanged("ConsumerKey");
+ this.OnConsumerKeyChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConsumerSecret", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string ConsumerSecret
+ {
+ get
+ {
+ return this._ConsumerSecret;
+ }
+ set
+ {
+ if ((this._ConsumerSecret != value))
+ {
+ this.OnConsumerSecretChanging(value);
+ this.SendPropertyChanging();
+ this._ConsumerSecret = value;
+ this.SendPropertyChanged("ConsumerSecret");
+ this.OnConsumerSecretChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Callback")]
+ public string Callback
+ {
+ get
+ {
+ return this._Callback;
+ }
+ set
+ {
+ if ((this._Callback != value))
+ {
+ this.OnCallbackChanging(value);
+ this.SendPropertyChanging();
+ this._Callback = value;
+ this.SendPropertyChanged("Callback");
+ this.OnCallbackChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_VerificationCodeFormat")]
+ public DotNetOpenAuth.OAuth.VerificationCodeFormat VerificationCodeFormat
+ {
+ get
+ {
+ return this._VerificationCodeFormat;
+ }
+ set
+ {
+ if ((this._VerificationCodeFormat != value))
+ {
+ this.OnVerificationCodeFormatChanging(value);
+ this.SendPropertyChanging();
+ this._VerificationCodeFormat = value;
+ this.SendPropertyChanged("VerificationCodeFormat");
+ this.OnVerificationCodeFormatChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_VerificationCodeLength")]
+ public int VerificationCodeLength
+ {
+ get
+ {
+ return this._VerificationCodeLength;
+ }
+ set
+ {
+ if ((this._VerificationCodeLength != value))
+ {
+ this.OnVerificationCodeLengthChanging(value);
+ this.SendPropertyChanging();
+ this._VerificationCodeLength = value;
+ this.SendPropertyChanged("VerificationCodeLength");
+ this.OnVerificationCodeLengthChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="OAuthConsumer_OAuthToken", Storage="_OAuthTokens", ThisKey="ConsumerId", OtherKey="ConsumerId")]
+ public EntitySet<OAuthToken> OAuthTokens
+ {
+ get
+ {
+ return this._OAuthTokens;
+ }
+ set
+ {
+ this._OAuthTokens.Assign(value);
+ }
+ }
+
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void SendPropertyChanging()
+ {
+ if ((this.PropertyChanging != null))
+ {
+ this.PropertyChanging(this, emptyChangingEventArgs);
+ }
+ }
+
+ protected virtual void SendPropertyChanged(String propertyName)
+ {
+ if ((this.PropertyChanged != null))
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+
+ private void attach_OAuthTokens(OAuthToken entity)
+ {
+ this.SendPropertyChanging();
+ entity.OAuthConsumer = this;
+ }
+
+ private void detach_OAuthTokens(OAuthToken entity)
+ {
+ this.SendPropertyChanging();
+ entity.OAuthConsumer = null;
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.OAuthToken")]
+ public partial class OAuthToken : INotifyPropertyChanging, INotifyPropertyChanged
+ {
+
+ private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+
+ private int _TokenId;
+
+ private string _Token;
+
+ private string _TokenSecret;
+
+ private OAuthServiceProvider.Code.TokenAuthorizationState _State;
+
+ private System.DateTime _IssueDate;
+
+ private int _ConsumerId;
+
+ private System.Nullable<int> _UserId;
+
+ private string _Scope;
+
+ private string _RequestTokenVerifier;
+
+ private string _RequestTokenCallback;
+
+ private string _ConsumerVersion;
+
+ private EntityRef<OAuthConsumer> _OAuthConsumer;
+
+ private EntityRef<User> _User;
+
+ #region Extensibility Method Definitions
+ partial void OnLoaded();
+ partial void OnValidate(System.Data.Linq.ChangeAction action);
+ partial void OnCreated();
+ partial void OnTokenIdChanging(int value);
+ partial void OnTokenIdChanged();
+ partial void OnTokenChanging(string value);
+ partial void OnTokenChanged();
+ partial void OnTokenSecretChanging(string value);
+ partial void OnTokenSecretChanged();
+ partial void OnStateChanging(OAuthServiceProvider.Code.TokenAuthorizationState value);
+ partial void OnStateChanged();
+ partial void OnIssueDateChanging(System.DateTime value);
+ partial void OnIssueDateChanged();
+ partial void OnConsumerIdChanging(int value);
+ partial void OnConsumerIdChanged();
+ partial void OnUserIdChanging(System.Nullable<int> value);
+ partial void OnUserIdChanged();
+ partial void OnScopeChanging(string value);
+ partial void OnScopeChanged();
+ partial void OnRequestTokenVerifierChanging(string value);
+ partial void OnRequestTokenVerifierChanged();
+ partial void OnRequestTokenCallbackChanging(string value);
+ partial void OnRequestTokenCallbackChanged();
+ partial void OnConsumerVersionChanging(string value);
+ partial void OnConsumerVersionChanged();
+ #endregion
+
+ public OAuthToken()
+ {
+ this._OAuthConsumer = default(EntityRef<OAuthConsumer>);
+ this._User = default(EntityRef<User>);
+ OnCreated();
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TokenId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
+ public int TokenId
+ {
+ get
+ {
+ return this._TokenId;
+ }
+ set
+ {
+ if ((this._TokenId != value))
+ {
+ this.OnTokenIdChanging(value);
+ this.SendPropertyChanging();
+ this._TokenId = value;
+ this.SendPropertyChanged("TokenId");
+ this.OnTokenIdChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Token", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string Token
+ {
+ get
+ {
+ return this._Token;
+ }
+ set
+ {
+ if ((this._Token != value))
+ {
+ this.OnTokenChanging(value);
+ this.SendPropertyChanging();
+ this._Token = value;
+ this.SendPropertyChanged("Token");
+ this.OnTokenChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TokenSecret", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string TokenSecret
+ {
+ get
+ {
+ return this._TokenSecret;
+ }
+ set
+ {
+ if ((this._TokenSecret != value))
+ {
+ this.OnTokenSecretChanging(value);
+ this.SendPropertyChanging();
+ this._TokenSecret = value;
+ this.SendPropertyChanged("TokenSecret");
+ this.OnTokenSecretChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_State", DbType="INT NOT NULL", CanBeNull=false)]
+ public OAuthServiceProvider.Code.TokenAuthorizationState State
+ {
+ get
+ {
+ return this._State;
+ }
+ set
+ {
+ if ((this._State != value))
+ {
+ this.OnStateChanging(value);
+ this.SendPropertyChanging();
+ this._State = value;
+ this.SendPropertyChanged("State");
+ this.OnStateChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IssueDate", DbType="DateTime NOT NULL")]
+ public System.DateTime IssueDate
+ {
+ get
+ {
+ return this._IssueDate;
+ }
+ set
+ {
+ if ((this._IssueDate != value))
+ {
+ this.OnIssueDateChanging(value);
+ this.SendPropertyChanging();
+ this._IssueDate = value;
+ this.SendPropertyChanged("IssueDate");
+ this.OnIssueDateChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConsumerId", DbType="Int NOT NULL")]
+ public int ConsumerId
+ {
+ get
+ {
+ return this._ConsumerId;
+ }
+ set
+ {
+ if ((this._ConsumerId != value))
+ {
+ if (this._OAuthConsumer.HasLoadedOrAssignedValue)
+ {
+ throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+ }
+ this.OnConsumerIdChanging(value);
+ this.SendPropertyChanging();
+ this._ConsumerId = value;
+ this.SendPropertyChanged("ConsumerId");
+ this.OnConsumerIdChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="Int")]
+ public System.Nullable<int> UserId
+ {
+ get
+ {
+ return this._UserId;
+ }
+ set
+ {
+ if ((this._UserId != value))
+ {
+ if (this._User.HasLoadedOrAssignedValue)
+ {
+ throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+ }
+ this.OnUserIdChanging(value);
+ this.SendPropertyChanging();
+ this._UserId = value;
+ this.SendPropertyChanged("UserId");
+ this.OnUserIdChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Scope", DbType="nvarchar(MAX)", CanBeNull=false)]
+ public string Scope
+ {
+ get
+ {
+ return this._Scope;
+ }
+ set
+ {
+ if ((this._Scope != value))
+ {
+ this.OnScopeChanging(value);
+ this.SendPropertyChanging();
+ this._Scope = value;
+ this.SendPropertyChanged("Scope");
+ this.OnScopeChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RequestTokenVerifier")]
+ public string RequestTokenVerifier
+ {
+ get
+ {
+ return this._RequestTokenVerifier;
+ }
+ set
+ {
+ if ((this._RequestTokenVerifier != value))
+ {
+ this.OnRequestTokenVerifierChanging(value);
+ this.SendPropertyChanging();
+ this._RequestTokenVerifier = value;
+ this.SendPropertyChanged("RequestTokenVerifier");
+ this.OnRequestTokenVerifierChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RequestTokenCallback")]
+ public string RequestTokenCallback
+ {
+ get
+ {
+ return this._RequestTokenCallback;
+ }
+ set
+ {
+ if ((this._RequestTokenCallback != value))
+ {
+ this.OnRequestTokenCallbackChanging(value);
+ this.SendPropertyChanging();
+ this._RequestTokenCallback = value;
+ this.SendPropertyChanged("RequestTokenCallback");
+ this.OnRequestTokenCallbackChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConsumerVersion")]
+ public string ConsumerVersion
+ {
+ get
+ {
+ return this._ConsumerVersion;
+ }
+ set
+ {
+ if ((this._ConsumerVersion != value))
+ {
+ this.OnConsumerVersionChanging(value);
+ this.SendPropertyChanging();
+ this._ConsumerVersion = value;
+ this.SendPropertyChanged("ConsumerVersion");
+ this.OnConsumerVersionChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="OAuthConsumer_OAuthToken", Storage="_OAuthConsumer", ThisKey="ConsumerId", OtherKey="ConsumerId", IsForeignKey=true, DeleteOnNull=true, DeleteRule="CASCADE")]
+ public OAuthConsumer OAuthConsumer
+ {
+ get
+ {
+ return this._OAuthConsumer.Entity;
+ }
+ set
+ {
+ OAuthConsumer previousValue = this._OAuthConsumer.Entity;
+ if (((previousValue != value)
+ || (this._OAuthConsumer.HasLoadedOrAssignedValue == false)))
+ {
+ this.SendPropertyChanging();
+ if ((previousValue != null))
+ {
+ this._OAuthConsumer.Entity = null;
+ previousValue.OAuthTokens.Remove(this);
+ }
+ this._OAuthConsumer.Entity = value;
+ if ((value != null))
+ {
+ value.OAuthTokens.Add(this);
+ this._ConsumerId = value.ConsumerId;
+ }
+ else
+ {
+ this._ConsumerId = default(int);
+ }
+ this.SendPropertyChanged("OAuthConsumer");
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.AssociationAttribute(Name="User_OAuthToken", Storage="_User", ThisKey="UserId", OtherKey="UserId", IsForeignKey=true, DeleteRule="CASCADE")]
+ public User User
+ {
+ get
+ {
+ return this._User.Entity;
+ }
+ set
+ {
+ User previousValue = this._User.Entity;
+ if (((previousValue != value)
+ || (this._User.HasLoadedOrAssignedValue == false)))
+ {
+ this.SendPropertyChanging();
+ if ((previousValue != null))
+ {
+ this._User.Entity = null;
+ previousValue.OAuthTokens.Remove(this);
+ }
+ this._User.Entity = value;
+ if ((value != null))
+ {
+ value.OAuthTokens.Add(this);
+ this._UserId = value.UserId;
+ }
+ else
+ {
+ this._UserId = default(Nullable<int>);
+ }
+ this.SendPropertyChanged("User");
+ }
+ }
+ }
+
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void SendPropertyChanging()
+ {
+ if ((this.PropertyChanging != null))
+ {
+ this.PropertyChanging(this, emptyChangingEventArgs);
+ }
+ }
+
+ protected virtual void SendPropertyChanged(String propertyName)
+ {
+ if ((this.PropertyChanged != null))
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
+ public partial class Nonce : INotifyPropertyChanging, INotifyPropertyChanged
+ {
+
+ private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+
+ private string _Context;
+
+ private string _Code;
+
+ private System.DateTime _Timestamp;
+
+ #region Extensibility Method Definitions
+ partial void OnLoaded();
+ partial void OnValidate(System.Data.Linq.ChangeAction action);
+ partial void OnCreated();
+ partial void OnContextChanging(string value);
+ partial void OnContextChanged();
+ partial void OnCodeChanging(string value);
+ partial void OnCodeChanged();
+ partial void OnTimestampChanging(System.DateTime value);
+ partial void OnTimestampChanged();
+ #endregion
+
+ public Nonce()
+ {
+ OnCreated();
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Context", CanBeNull=false, IsPrimaryKey=true)]
+ public string Context
+ {
+ get
+ {
+ return this._Context;
+ }
+ set
+ {
+ if ((this._Context != value))
+ {
+ this.OnContextChanging(value);
+ this.SendPropertyChanging();
+ this._Context = value;
+ this.SendPropertyChanged("Context");
+ this.OnContextChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Code", CanBeNull=false, IsPrimaryKey=true)]
+ public string Code
+ {
+ get
+ {
+ return this._Code;
+ }
+ set
+ {
+ if ((this._Code != value))
+ {
+ this.OnCodeChanging(value);
+ this.SendPropertyChanging();
+ this._Code = value;
+ this.SendPropertyChanged("Code");
+ this.OnCodeChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Timestamp", IsPrimaryKey=true)]
+ public System.DateTime Timestamp
+ {
+ get
+ {
+ return this._Timestamp;
+ }
+ set
+ {
+ if ((this._Timestamp != value))
+ {
+ this.OnTimestampChanging(value);
+ this.SendPropertyChanging();
+ this._Timestamp = value;
+ this.SendPropertyChanged("Timestamp");
+ this.OnTimestampChanged();
+ }
+ }
+ }
+
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void SendPropertyChanging()
+ {
+ if ((this.PropertyChanging != null))
+ {
+ this.PropertyChanging(this, emptyChangingEventArgs);
+ }
+ }
+
+ protected virtual void SendPropertyChanged(String propertyName)
+ {
+ if ((this.PropertyChanged != null))
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+}
+#pragma warning restore 1591
diff --git a/samples/OAuthServiceProvider/Code/DatabaseNonceStore.cs b/samples/OAuthServiceProvider/Code/DatabaseNonceStore.cs
new file mode 100644
index 0000000..1f8f56e
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/DatabaseNonceStore.cs
@@ -0,0 +1,55 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using DotNetOpenAuth.Messaging.Bindings;
+
+ /// <summary>
+ /// A database-persisted nonce store.
+ /// </summary>
+ public class DatabaseNonceStore : INonceStore {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DatabaseNonceStore"/> class.
+ /// </summary>
+ public DatabaseNonceStore() {
+ }
+
+ #region INonceStore Members
+
+ /// <summary>
+ /// Stores a given nonce and timestamp.
+ /// </summary>
+ /// <param name="context">The context, or namespace, within which the
+ /// <paramref name="nonce"/> must be unique.
+ /// The context SHOULD be treated as case-sensitive.
+ /// The value will never be <c>null</c> but may be the empty string.</param>
+ /// <param name="nonce">A series of random characters.</param>
+ /// <param name="timestampUtc">The UTC timestamp that together with the nonce string make it unique
+ /// within the given <paramref name="context"/>.
+ /// The timestamp may also be used by the data store to clear out old nonces.</param>
+ /// <returns>
+ /// True if the context+nonce+timestamp (combination) was not previously in the database.
+ /// False if the nonce was stored previously with the same timestamp and context.
+ /// </returns>
+ /// <remarks>
+ /// The nonce must be stored for no less than the maximum time window a message may
+ /// be processed within before being discarded as an expired message.
+ /// This maximum message age can be looked up via the
+ /// <see cref="DotNetOpenAuth.Configuration.MessagingElement.MaximumMessageLifetime"/>
+ /// property, accessible via the <see cref="DotNetOpenAuth.Configuration.DotNetOpenAuthSection.Configuration"/>
+ /// property.
+ /// </remarks>
+ public bool StoreNonce(string context, string nonce, DateTime timestampUtc) {
+ Global.DataContext.Nonces.InsertOnSubmit(new Nonce { Context = context, Code = nonce, Timestamp = timestampUtc });
+ try {
+ Global.DataContext.SubmitChanges();
+ return true;
+ } catch (System.Data.Linq.DuplicateKeyException) {
+ return false;
+ }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/DatabaseTokenManager.cs b/samples/OAuthServiceProvider/Code/DatabaseTokenManager.cs
new file mode 100644
index 0000000..721e124
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/DatabaseTokenManager.cs
@@ -0,0 +1,159 @@
+//-----------------------------------------------------------------------
+// <copyright file="DatabaseTokenManager.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Linq;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+ using DotNetOpenAuth.OAuth.Messages;
+
+ public class DatabaseTokenManager : IServiceProviderTokenManager {
+ #region IServiceProviderTokenManager
+
+ public IConsumerDescription GetConsumer(string consumerKey) {
+ var consumerRow = Global.DataContext.OAuthConsumers.SingleOrDefault(
+ consumerCandidate => consumerCandidate.ConsumerKey == consumerKey);
+ if (consumerRow == null) {
+ throw new KeyNotFoundException();
+ }
+
+ return consumerRow;
+ }
+
+ public IServiceProviderRequestToken GetRequestToken(string token) {
+ try {
+ return Global.DataContext.OAuthTokens.First(t => t.Token == token && t.State != TokenAuthorizationState.AccessToken);
+ } catch (InvalidOperationException ex) {
+ throw new KeyNotFoundException("Unrecognized token", ex);
+ }
+ }
+
+ public IServiceProviderAccessToken GetAccessToken(string token) {
+ try {
+ return Global.DataContext.OAuthTokens.First(t => t.Token == token && t.State == TokenAuthorizationState.AccessToken);
+ } catch (InvalidOperationException ex) {
+ throw new KeyNotFoundException("Unrecognized token", ex);
+ }
+ }
+
+ public void UpdateToken(IServiceProviderRequestToken token) {
+ // Nothing to do here, since we're using Linq To SQL.
+ }
+
+ #endregion
+
+ #region ITokenManager Members
+
+ public string GetTokenSecret(string token) {
+ var tokenRow = Global.DataContext.OAuthTokens.SingleOrDefault(
+ tokenCandidate => tokenCandidate.Token == token);
+ if (tokenRow == null) {
+ throw new ArgumentException();
+ }
+
+ return tokenRow.TokenSecret;
+ }
+
+ public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
+ RequestScopedTokenMessage scopedRequest = (RequestScopedTokenMessage)request;
+ var consumer = Global.DataContext.OAuthConsumers.Single(consumerRow => consumerRow.ConsumerKey == request.ConsumerKey);
+ string scope = scopedRequest.Scope;
+ OAuthToken newToken = new OAuthToken {
+ OAuthConsumer = consumer,
+ Token = response.Token,
+ TokenSecret = response.TokenSecret,
+ IssueDate = DateTime.UtcNow,
+ Scope = scope,
+ };
+
+ Global.DataContext.OAuthTokens.InsertOnSubmit(newToken);
+ Global.DataContext.SubmitChanges();
+ }
+
+ /// <summary>
+ /// Checks whether a given request token has already been authorized
+ /// by some user for use by the Consumer that requested it.
+ /// </summary>
+ /// <param name="requestToken">The Consumer's request token.</param>
+ /// <returns>
+ /// True if the request token has already been fully authorized by the user
+ /// who owns the relevant protected resources. False if the token has not yet
+ /// been authorized, has expired or does not exist.
+ /// </returns>
+ public bool IsRequestTokenAuthorized(string requestToken) {
+ var tokenFound = Global.DataContext.OAuthTokens.SingleOrDefault(
+ token => token.Token == requestToken &&
+ token.State == TokenAuthorizationState.AuthorizedRequestToken);
+ return tokenFound != null;
+ }
+
+ public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
+ var data = Global.DataContext;
+ var consumerRow = data.OAuthConsumers.Single(consumer => consumer.ConsumerKey == consumerKey);
+ var tokenRow = data.OAuthTokens.Single(token => token.Token == requestToken && token.OAuthConsumer == consumerRow);
+ Debug.Assert(tokenRow.State == TokenAuthorizationState.AuthorizedRequestToken, "The token should be authorized already!");
+
+ // Update the existing row to be an access token.
+ tokenRow.IssueDate = DateTime.UtcNow;
+ tokenRow.State = TokenAuthorizationState.AccessToken;
+ tokenRow.Token = accessToken;
+ tokenRow.TokenSecret = accessTokenSecret;
+ }
+
+ /// <summary>
+ /// Classifies a token as a request token or an access token.
+ /// </summary>
+ /// <param name="token">The token to classify.</param>
+ /// <returns>Request or Access token, or invalid if the token is not recognized.</returns>
+ public TokenType GetTokenType(string token) {
+ var tokenRow = Global.DataContext.OAuthTokens.SingleOrDefault(tokenCandidate => tokenCandidate.Token == token);
+ if (tokenRow == null) {
+ return TokenType.InvalidToken;
+ } else if (tokenRow.State == TokenAuthorizationState.AccessToken) {
+ return TokenType.AccessToken;
+ } else {
+ return TokenType.RequestToken;
+ }
+ }
+
+ #endregion
+
+ public void AuthorizeRequestToken(string requestToken, User user) {
+ if (requestToken == null) {
+ throw new ArgumentNullException("requestToken");
+ }
+ if (user == null) {
+ throw new ArgumentNullException("user");
+ }
+
+ var tokenRow = Global.DataContext.OAuthTokens.SingleOrDefault(
+ tokenCandidate => tokenCandidate.Token == requestToken &&
+ tokenCandidate.State == TokenAuthorizationState.UnauthorizedRequestToken);
+ if (tokenRow == null) {
+ throw new ArgumentException();
+ }
+
+ tokenRow.State = TokenAuthorizationState.AuthorizedRequestToken;
+ tokenRow.User = user;
+ }
+
+ public OAuthConsumer GetConsumerForToken(string token) {
+ if (String.IsNullOrEmpty(token)) {
+ throw new ArgumentNullException("requestToken");
+ }
+
+ var tokenRow = Global.DataContext.OAuthTokens.SingleOrDefault(
+ tokenCandidate => tokenCandidate.Token == token);
+ if (tokenRow == null) {
+ throw new ArgumentException();
+ }
+
+ return tokenRow.OAuthConsumer;
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/Global.cs b/samples/OAuthServiceProvider/Code/Global.cs
new file mode 100644
index 0000000..ceaeac8
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/Global.cs
@@ -0,0 +1,126 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Linq;
+ using System.ServiceModel;
+ using System.Text;
+ using System.Web;
+ using DotNetOpenAuth.OAuth.Messages;
+
+ /// <summary>
+ /// The web application global events and properties.
+ /// </summary>
+ public class Global : HttpApplication {
+ /// <summary>
+ /// An application memory cache of recent log messages.
+ /// </summary>
+ public static StringBuilder LogMessages = new StringBuilder();
+
+ /// <summary>
+ /// The logger for this sample to use.
+ /// </summary>
+ public static log4net.ILog Logger = log4net.LogManager.GetLogger("DotNetOpenAuth.OAuthServiceProvider");
+
+ /// <summary>
+ /// Gets the transaction-protected database connection for the current request.
+ /// </summary>
+ public static DataClassesDataContext DataContext {
+ get {
+ DataClassesDataContext dataContext = dataContextSimple;
+ if (dataContext == null) {
+ dataContext = new DataClassesDataContext();
+ dataContext.Connection.Open();
+ dataContext.Transaction = dataContext.Connection.BeginTransaction();
+ dataContextSimple = dataContext;
+ }
+
+ return dataContext;
+ }
+ }
+
+ public static DatabaseTokenManager TokenManager { get; set; }
+
+ public static DatabaseNonceStore NonceStore { get; set; }
+
+ public static User LoggedInUser {
+ get { return Global.DataContext.Users.SingleOrDefault(user => user.OpenIDClaimedIdentifier == HttpContext.Current.User.Identity.Name); }
+ }
+
+ public static UserAuthorizationRequest PendingOAuthAuthorization {
+ get { return HttpContext.Current.Session["authrequest"] as UserAuthorizationRequest; }
+ set { HttpContext.Current.Session["authrequest"] = value; }
+ }
+
+ private static DataClassesDataContext dataContextSimple {
+ get {
+ if (HttpContext.Current != null) {
+ return HttpContext.Current.Items["DataContext"] as DataClassesDataContext;
+ } else if (OperationContext.Current != null) {
+ object data;
+ if (OperationContext.Current.IncomingMessageProperties.TryGetValue("DataContext", out data)) {
+ return data as DataClassesDataContext;
+ } else {
+ return null;
+ }
+ } else {
+ throw new InvalidOperationException();
+ }
+ }
+
+ set {
+ if (HttpContext.Current != null) {
+ HttpContext.Current.Items["DataContext"] = value;
+ } else if (OperationContext.Current != null) {
+ OperationContext.Current.IncomingMessageProperties["DataContext"] = value;
+ } else {
+ throw new InvalidOperationException();
+ }
+ }
+ }
+
+ public static void AuthorizePendingRequestToken() {
+ ITokenContainingMessage tokenMessage = PendingOAuthAuthorization;
+ TokenManager.AuthorizeRequestToken(tokenMessage.Token, LoggedInUser);
+ PendingOAuthAuthorization = null;
+ }
+
+ private static void CommitAndCloseDatabaseIfNecessary() {
+ var dataContext = dataContextSimple;
+ if (dataContext != null) {
+ dataContext.SubmitChanges();
+ dataContext.Transaction.Commit();
+ dataContext.Connection.Close();
+ }
+ }
+
+ private void Application_Start(object sender, EventArgs e) {
+ log4net.Config.XmlConfigurator.Configure();
+ Logger.Info("Sample starting...");
+ string appPath = HttpContext.Current.Request.ApplicationPath;
+ if (!appPath.EndsWith("/")) {
+ appPath += "/";
+ }
+
+ // This will break in IIS Integrated Pipeline mode, since applications
+ // start before the first incoming request context is available.
+ // TODO: fix this.
+ Constants.WebRootUrl = new Uri(HttpContext.Current.Request.Url, appPath);
+ Global.TokenManager = new DatabaseTokenManager();
+ Global.NonceStore = new DatabaseNonceStore();
+ }
+
+ private void Application_End(object sender, EventArgs e) {
+ Logger.Info("Sample shutting down...");
+
+ // this would be automatic, but in partial trust scenarios it is not.
+ log4net.LogManager.Shutdown();
+ }
+
+ private void Application_Error(object sender, EventArgs e) {
+ Logger.Error("An unhandled exception occurred in ASP.NET processing: " + Server.GetLastError(), Server.GetLastError());
+ }
+
+ private void Application_EndRequest(object sender, EventArgs e) {
+ CommitAndCloseDatabaseIfNecessary();
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/IDataApi.cs b/samples/OAuthServiceProvider/Code/IDataApi.cs
new file mode 100644
index 0000000..45853cd
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/IDataApi.cs
@@ -0,0 +1,20 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Runtime.Serialization;
+ using System.ServiceModel;
+ using System.Text;
+
+ [ServiceContract]
+ public interface IDataApi {
+ [OperationContract]
+ int? GetAge();
+
+ [OperationContract]
+ string GetName();
+
+ [OperationContract]
+ string[] GetFavoriteSites();
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs b/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs
new file mode 100644
index 0000000..6d5bfff
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs
@@ -0,0 +1,65 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.IdentityModel.Policy;
+ using System.Linq;
+ using System.Security.Principal;
+ using System.ServiceModel;
+ using System.ServiceModel.Channels;
+ using System.ServiceModel.Security;
+ using DotNetOpenAuth;
+ using DotNetOpenAuth.OAuth;
+
+ /// <summary>
+ /// A WCF extension to authenticate incoming messages using OAuth.
+ /// </summary>
+ public class OAuthAuthorizationManager : ServiceAuthorizationManager {
+ public OAuthAuthorizationManager() {
+ }
+
+ protected override bool CheckAccessCore(OperationContext operationContext) {
+ if (!base.CheckAccessCore(operationContext)) {
+ return false;
+ }
+
+ HttpRequestMessageProperty httpDetails = operationContext.RequestContext.RequestMessage.Properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
+ Uri requestUri = operationContext.RequestContext.RequestMessage.Properties["OriginalHttpRequestUri"] as Uri;
+ ServiceProvider sp = Constants.CreateServiceProvider();
+ try {
+ var auth = sp.ReadProtectedResourceAuthorization(httpDetails, requestUri);
+ if (auth != null) {
+ var accessToken = Global.DataContext.OAuthTokens.Single(token => token.Token == auth.AccessToken);
+
+ var principal = sp.CreatePrincipal(auth);
+ var policy = new OAuthPrincipalAuthorizationPolicy(principal);
+ var policies = new List<IAuthorizationPolicy> {
+ policy,
+ };
+
+ var securityContext = new ServiceSecurityContext(policies.AsReadOnly());
+ if (operationContext.IncomingMessageProperties.Security != null) {
+ operationContext.IncomingMessageProperties.Security.ServiceSecurityContext = securityContext;
+ } else {
+ operationContext.IncomingMessageProperties.Security = new SecurityMessageProperty {
+ ServiceSecurityContext = securityContext,
+ };
+ }
+
+ securityContext.AuthorizationContext.Properties["Identities"] = new List<IIdentity> {
+ principal.Identity,
+ };
+
+ // Only allow this method call if the access token scope permits it.
+ string[] scopes = accessToken.Scope.Split('|');
+ if (scopes.Contains(operationContext.IncomingMessageHeaders.Action)) {
+ return true;
+ }
+ }
+ } catch (ProtocolException ex) {
+ Global.Logger.Error("Error processing OAuth messages.", ex);
+ }
+
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/OAuthConsumer.cs b/samples/OAuthServiceProvider/Code/OAuthConsumer.cs
new file mode 100644
index 0000000..d7dfc06
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/OAuthConsumer.cs
@@ -0,0 +1,43 @@
+//-----------------------------------------------------------------------
+// <copyright file="OAuthConsumer.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+
+ public partial class OAuthConsumer : IConsumerDescription {
+ #region IConsumerDescription Members
+
+ string IConsumerDescription.Key {
+ get { return this.ConsumerKey; }
+ }
+
+ string IConsumerDescription.Secret {
+ get { return this.ConsumerSecret; }
+ }
+
+ System.Security.Cryptography.X509Certificates.X509Certificate2 IConsumerDescription.Certificate {
+ get { return null; }
+ }
+
+ Uri IConsumerDescription.Callback {
+ get { return string.IsNullOrEmpty(this.Callback) ? null : new Uri(this.Callback); }
+ }
+
+ DotNetOpenAuth.OAuth.VerificationCodeFormat IConsumerDescription.VerificationCodeFormat {
+ get { return this.VerificationCodeFormat; }
+ }
+
+ int IConsumerDescription.VerificationCodeLength {
+ get { return this.VerificationCodeLength; }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/OAuthPrincipalAuthorizationPolicy.cs b/samples/OAuthServiceProvider/Code/OAuthPrincipalAuthorizationPolicy.cs
new file mode 100644
index 0000000..a25f4c5
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/OAuthPrincipalAuthorizationPolicy.cs
@@ -0,0 +1,47 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.IdentityModel.Claims;
+ using System.IdentityModel.Policy;
+ using System.Linq;
+ using System.Web;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+
+ public class OAuthPrincipalAuthorizationPolicy : IAuthorizationPolicy {
+ private readonly Guid uniqueId = Guid.NewGuid();
+ private readonly OAuthPrincipal principal;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="OAuthPrincipalAuthorizationPolicy"/> class.
+ /// </summary>
+ /// <param name="principal">The principal.</param>
+ public OAuthPrincipalAuthorizationPolicy(OAuthPrincipal principal) {
+ this.principal = principal;
+ }
+
+ #region IAuthorizationComponent Members
+
+ /// <summary>
+ /// Gets a unique ID for this instance.
+ /// </summary>
+ public string Id {
+ get { return this.uniqueId.ToString(); }
+ }
+
+ #endregion
+
+ #region IAuthorizationPolicy Members
+
+ public ClaimSet Issuer {
+ get { return ClaimSet.System; }
+ }
+
+ public bool Evaluate(EvaluationContext evaluationContext, ref object state) {
+ evaluationContext.AddClaimSet(this, new DefaultClaimSet(Claim.CreateNameClaim(this.principal.Identity.Name)));
+ evaluationContext.Properties["Principal"] = this.principal;
+ return true;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/OAuthToken.cs b/samples/OAuthServiceProvider/Code/OAuthToken.cs
new file mode 100644
index 0000000..182a3e3
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/OAuthToken.cs
@@ -0,0 +1,66 @@
+//-----------------------------------------------------------------------
+// <copyright file="OAuthToken.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+
+ public partial class OAuthToken : IServiceProviderRequestToken, IServiceProviderAccessToken {
+ #region IServiceProviderRequestToken Members
+
+ string IServiceProviderRequestToken.Token {
+ get { return this.Token; }
+ }
+
+ string IServiceProviderRequestToken.ConsumerKey {
+ get { return this.OAuthConsumer.ConsumerKey; }
+ }
+
+ DateTime IServiceProviderRequestToken.CreatedOn {
+ get { return this.IssueDate; }
+ }
+
+ Uri IServiceProviderRequestToken.Callback {
+ get { return string.IsNullOrEmpty(this.RequestTokenCallback) ? null : new Uri(this.RequestTokenCallback); }
+ set { this.RequestTokenCallback = value.AbsoluteUri; }
+ }
+
+ string IServiceProviderRequestToken.VerificationCode {
+ get { return this.RequestTokenVerifier; }
+ set { this.RequestTokenVerifier = value; }
+ }
+
+ Version IServiceProviderRequestToken.ConsumerVersion {
+ get { return new Version(this.ConsumerVersion); }
+ set { this.ConsumerVersion = value.ToString(); }
+ }
+
+ #endregion
+
+ #region IServiceProviderAccessToken Members
+
+ string IServiceProviderAccessToken.Token {
+ get { return this.Token; }
+ }
+
+ DateTime? IServiceProviderAccessToken.ExpirationDate {
+ get { return null; }
+ }
+
+ string IServiceProviderAccessToken.Username {
+ get { return this.User.OpenIDClaimedIdentifier; }
+ }
+
+ string[] IServiceProviderAccessToken.Roles {
+ get { return this.Scope.Split('|'); }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/RequestScopedTokenMessage.cs b/samples/OAuthServiceProvider/Code/RequestScopedTokenMessage.cs
new file mode 100644
index 0000000..984d683
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/RequestScopedTokenMessage.cs
@@ -0,0 +1,25 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OAuth.Messages;
+
+ /// <summary>
+ /// A custom web app version of the message sent to request an unauthorized token.
+ /// </summary>
+ public class RequestScopedTokenMessage : UnauthorizedTokenRequest {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="RequestScopedTokenMessage"/> class.
+ /// </summary>
+ /// <param name="endpoint">The endpoint that will receive the message.</param>
+ /// <param name="version">The OAuth version.</param>
+ public RequestScopedTokenMessage(MessageReceivingEndpoint endpoint, Version version)
+ : base(endpoint, version) {
+ }
+
+ /// <summary>
+ /// Gets or sets the scope of the access being requested.
+ /// </summary>
+ [MessagePart("scope", IsRequired = true)]
+ public string Scope { get; set; }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/TokenAuthorizationState.cs b/samples/OAuthServiceProvider/Code/TokenAuthorizationState.cs
new file mode 100644
index 0000000..a9cfa4e
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/TokenAuthorizationState.cs
@@ -0,0 +1,26 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+
+ /// <summary>
+ /// Various states an OAuth token can be in.
+ /// </summary>
+ public enum TokenAuthorizationState : int {
+ /// <summary>
+ /// An unauthorized request token.
+ /// </summary>
+ UnauthorizedRequestToken = 0,
+
+ /// <summary>
+ /// An authorized request token.
+ /// </summary>
+ AuthorizedRequestToken = 1,
+
+ /// <summary>
+ /// An authorized access token.
+ /// </summary>
+ AccessToken = 2,
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/TracePageAppender.cs b/samples/OAuthServiceProvider/Code/TracePageAppender.cs
new file mode 100644
index 0000000..8f97c89
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/TracePageAppender.cs
@@ -0,0 +1,13 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Web;
+
+ public class TracePageAppender : log4net.Appender.AppenderSkeleton {
+ protected override void Append(log4net.Core.LoggingEvent loggingEvent) {
+ StringWriter sw = new StringWriter(Global.LogMessages);
+ Layout.Format(sw, loggingEvent);
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Code/Utilities.cs b/samples/OAuthServiceProvider/Code/Utilities.cs
new file mode 100644
index 0000000..a225650
--- /dev/null
+++ b/samples/OAuthServiceProvider/Code/Utilities.cs
@@ -0,0 +1,28 @@
+namespace OAuthServiceProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Security.Principal;
+ using System.Web;
+
+ /// <summary>
+ /// Extension methods and other helpful utility methods.
+ /// </summary>
+ public static class Utilities {
+ /// <summary>
+ /// Gets the database entity representing the user identified by a given <see cref="IIdentity"/> instance.
+ /// </summary>
+ /// <param name="identity">The identity of the user.</param>
+ /// <returns>
+ /// The database object for that user; or <c>null</c> if the user could not
+ /// be found or if <paramref name="identity"/> is <c>null</c> or represents an anonymous identity.
+ /// </returns>
+ public static User GetUser(this IIdentity identity) {
+ if (identity == null || !identity.IsAuthenticated) {
+ return null;
+ }
+
+ return Global.DataContext.Users.SingleOrDefault(user => user.OpenIDClaimedIdentifier == identity.Name);
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/DataApi.cs b/samples/OAuthServiceProvider/DataApi.cs
new file mode 100644
index 0000000..9d531e6
--- /dev/null
+++ b/samples/OAuthServiceProvider/DataApi.cs
@@ -0,0 +1,34 @@
+namespace OAuthServiceProvider {
+ using System.Linq;
+ using System.ServiceModel;
+ using OAuthServiceProvider.Code;
+
+ /// <summary>
+ /// The WCF service API.
+ /// </summary>
+ /// <remarks>
+ /// Note how there is no code here that is bound to OAuth or any other
+ /// credential/authorization scheme. That's all part of the channel/binding elsewhere.
+ /// And the reference to OperationContext.Current.ServiceSecurityContext.PrimaryIdentity
+ /// is the user being impersonated by the WCF client.
+ /// In the OAuth case, it is the user who authorized the OAuth access token that was used
+ /// to gain access to the service.
+ /// </remarks>
+ public class DataApi : IDataApi {
+ private User User {
+ get { return OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.GetUser(); }
+ }
+
+ public int? GetAge() {
+ return User.Age;
+ }
+
+ public string GetName() {
+ return User.FullName;
+ }
+
+ public string[] GetFavoriteSites() {
+ return User.FavoriteSites.Select(site => site.SiteUrl).ToArray();
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/DataApi.svc b/samples/OAuthServiceProvider/DataApi.svc
index 4e9e477..50e952c 100644
--- a/samples/OAuthServiceProvider/DataApi.svc
+++ b/samples/OAuthServiceProvider/DataApi.svc
@@ -1 +1 @@
-<%@ ServiceHost Language="C#" Debug="true" Service="DataApi" CodeBehind="~/App_Code/DataApi.cs" %>
+<%@ ServiceHost Language="C#" Debug="true" Service="OAuthServiceProvider.DataApi" CodeBehind="DataApi.cs" %>
diff --git a/samples/OAuthServiceProvider/Default.aspx b/samples/OAuthServiceProvider/Default.aspx
index 683a939..3e5d820 100644
--- a/samples/OAuthServiceProvider/Default.aspx
+++ b/samples/OAuthServiceProvider/Default.aspx
@@ -1,48 +1,8 @@
-<%@ Page Title="DotNetOpenAuth Service Provider Sample" Language="C#" MasterPageFile="~/MasterPage.master" %>
+<%@ Page Title="DotNetOpenAuth Service Provider Sample" Language="C#" MasterPageFile="~/MasterPage.master" CodeBehind="~/Default.aspx.cs" Inherits="OAuthServiceProvider._Default" AutoEventWireup="True" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data.SqlClient" %>
-<script runat="server">
-
- protected void createDatabaseButton_Click(object sender, EventArgs e) {
- string dbPath = Path.Combine(Server.MapPath(Request.ApplicationPath), "App_Data");
- if (!Directory.Exists(dbPath)) {
- Directory.CreateDirectory(dbPath);
- }
- string connectionString = ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString.Replace("|DataDirectory|", dbPath);
- var dc = new DataClassesDataContext(connectionString);
- if (dc.DatabaseExists()) {
- dc.DeleteDatabase();
- }
- try {
- dc.CreateDatabase();
- // Fill with sample data.
- dc.OAuthConsumers.InsertOnSubmit(new OAuthConsumer {
- ConsumerKey = "sampleconsumer",
- ConsumerSecret = "samplesecret",
- });
- dc.Users.InsertOnSubmit(new User {
- OpenIDFriendlyIdentifier = "=arnott",
- OpenIDClaimedIdentifier = "=!9B72.7DD1.50A9.5CCD",
- Age = 27,
- FullName = "Andrew Arnott",
- FavoriteSites = new System.Data.Linq.EntitySet<FavoriteSite> {
- new FavoriteSite { SiteUrl = "http://www.microsoft.com" },
- new FavoriteSite { SiteUrl = "http://www.google.com" },
- },
- });
-
- dc.SubmitChanges();
- databaseStatus.Visible = true;
- } catch (System.Data.SqlClient.SqlException ex) {
- foreach (System.Data.SqlClient.SqlError error in ex.Errors) {
- Response.Write(error.Message);
- }
- }
- }
-</script>
-
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
<asp:Button ID="createDatabaseButton" runat="server" Text="(Re)create Database" OnClick="createDatabaseButton_Click" />
<asp:Label runat="server" ID="databaseStatus" EnableViewState="false" Text="Database recreated!"
diff --git a/samples/OAuthServiceProvider/Default.aspx.cs b/samples/OAuthServiceProvider/Default.aspx.cs
new file mode 100644
index 0000000..653046a
--- /dev/null
+++ b/samples/OAuthServiceProvider/Default.aspx.cs
@@ -0,0 +1,49 @@
+namespace OAuthServiceProvider {
+ using System;
+ using System.Collections.Generic;
+ using System.Configuration;
+ using System.IO;
+ using System.Linq;
+ using System.Web;
+ using OAuthServiceProvider.Code;
+
+ public partial class _Default : System.Web.UI.Page {
+ protected void createDatabaseButton_Click(object sender, EventArgs e) {
+ string databasePath = Path.Combine(Server.MapPath(Request.ApplicationPath), "App_Data");
+ if (!Directory.Exists(databasePath)) {
+ Directory.CreateDirectory(databasePath);
+ }
+ string connectionString = ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString.Replace("|DataDirectory|", databasePath);
+ var dc = new DataClassesDataContext(connectionString);
+ if (dc.DatabaseExists()) {
+ dc.DeleteDatabase();
+ }
+ try {
+ dc.CreateDatabase();
+
+ // Fill with sample data.
+ dc.OAuthConsumers.InsertOnSubmit(new OAuthConsumer {
+ ConsumerKey = "sampleconsumer",
+ ConsumerSecret = "samplesecret",
+ });
+ dc.Users.InsertOnSubmit(new User {
+ OpenIDFriendlyIdentifier = "=arnott",
+ OpenIDClaimedIdentifier = "=!9B72.7DD1.50A9.5CCD",
+ Age = 27,
+ FullName = "Andrew Arnott",
+ FavoriteSites = new System.Data.Linq.EntitySet<FavoriteSite> {
+ new FavoriteSite { SiteUrl = "http://www.microsoft.com" },
+ new FavoriteSite { SiteUrl = "http://www.google.com" },
+ },
+ });
+
+ dc.SubmitChanges();
+ this.databaseStatus.Visible = true;
+ } catch (System.Data.SqlClient.SqlException ex) {
+ foreach (System.Data.SqlClient.SqlError error in ex.Errors) {
+ Response.Write(error.Message);
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Default.aspx.designer.cs b/samples/OAuthServiceProvider/Default.aspx.designer.cs
new file mode 100644
index 0000000..afa79c0
--- /dev/null
+++ b/samples/OAuthServiceProvider/Default.aspx.designer.cs
@@ -0,0 +1,33 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthServiceProvider {
+
+
+ public partial class _Default {
+
+ /// <summary>
+ /// createDatabaseButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button createDatabaseButton;
+
+ /// <summary>
+ /// databaseStatus control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label databaseStatus;
+ }
+}
diff --git a/samples/OAuthServiceProvider/Global.asax b/samples/OAuthServiceProvider/Global.asax
index e9ae062..3007bd3 100644
--- a/samples/OAuthServiceProvider/Global.asax
+++ b/samples/OAuthServiceProvider/Global.asax
@@ -1 +1 @@
-<%@ Application Inherits="Global" CodeBehind="App_Code\Global.cs" %> \ No newline at end of file
+<%@ Application Inherits="OAuthServiceProvider.Code.Global" CodeBehind="Code\Global.cs" %> \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Members/Authorize.aspx b/samples/OAuthServiceProvider/Members/Authorize.aspx
index 321d7f3..b3e2c6a 100644
--- a/samples/OAuthServiceProvider/Members/Authorize.aspx
+++ b/samples/OAuthServiceProvider/Members/Authorize.aspx
@@ -1,5 +1,4 @@
-<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
- CodeFile="Authorize.aspx.cs" Inherits="Authorize" %>
+<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="OAuthServiceProvider.Authorize" Codebehind="Authorize.aspx.cs" %>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
<asp:MultiView runat="server" ActiveViewIndex="0" ID="multiView">
diff --git a/samples/OAuthServiceProvider/Members/Authorize.aspx.cs b/samples/OAuthServiceProvider/Members/Authorize.aspx.cs
index 1e981a3..faa2147 100644
--- a/samples/OAuthServiceProvider/Members/Authorize.aspx.cs
+++ b/samples/OAuthServiceProvider/Members/Authorize.aspx.cs
@@ -1,77 +1,80 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Web;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using DotNetOpenAuth;
-using DotNetOpenAuth.OAuth;
-using DotNetOpenAuth.OAuth.Messages;
+namespace OAuthServiceProvider {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Security.Cryptography;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using DotNetOpenAuth;
+ using DotNetOpenAuth.OAuth;
+ using DotNetOpenAuth.OAuth.Messages;
+ using OAuthServiceProvider.Code;
-/// <summary>
-/// Conducts the user through a Consumer authorization process.
-/// </summary>
-public partial class Authorize : System.Web.UI.Page {
- private static readonly RandomNumberGenerator CryptoRandomDataGenerator = new RNGCryptoServiceProvider();
+ /// <summary>
+ /// Conducts the user through a Consumer authorization process.
+ /// </summary>
+ public partial class Authorize : System.Web.UI.Page {
+ private static readonly RandomNumberGenerator CryptoRandomDataGenerator = new RNGCryptoServiceProvider();
- private string AuthorizationSecret {
- get { return Session["OAuthAuthorizationSecret"] as string; }
- set { Session["OAuthAuthorizationSecret"] = value; }
- }
+ private string AuthorizationSecret {
+ get { return Session["OAuthAuthorizationSecret"] as string; }
+ set { Session["OAuthAuthorizationSecret"] = value; }
+ }
- protected void Page_Load(object sender, EventArgs e) {
- if (!IsPostBack) {
- if (Global.PendingOAuthAuthorization == null) {
- Response.Redirect("~/Members/AuthorizedConsumers.aspx");
- } else {
- ITokenContainingMessage pendingToken = Global.PendingOAuthAuthorization;
- var token = Global.DataContext.OAuthTokens.Single(t => t.Token == pendingToken.Token);
- desiredAccessLabel.Text = token.Scope;
- consumerLabel.Text = Global.TokenManager.GetConsumerForToken(token.Token).ConsumerKey;
+ protected void Page_Load(object sender, EventArgs e) {
+ if (!IsPostBack) {
+ if (Global.PendingOAuthAuthorization == null) {
+ Response.Redirect("~/Members/AuthorizedConsumers.aspx");
+ } else {
+ ITokenContainingMessage pendingToken = Global.PendingOAuthAuthorization;
+ var token = Global.DataContext.OAuthTokens.Single(t => t.Token == pendingToken.Token);
+ this.desiredAccessLabel.Text = token.Scope;
+ this.consumerLabel.Text = Global.TokenManager.GetConsumerForToken(token.Token).ConsumerKey;
- // Generate an unpredictable secret that goes to the user agent and must come back
- // with authorization to guarantee the user interacted with this page rather than
- // being scripted by an evil Consumer.
- byte[] randomData = new byte[8];
- CryptoRandomDataGenerator.GetBytes(randomData);
- this.AuthorizationSecret = Convert.ToBase64String(randomData);
- OAuthAuthorizationSecToken.Value = this.AuthorizationSecret;
+ // Generate an unpredictable secret that goes to the user agent and must come back
+ // with authorization to guarantee the user interacted with this page rather than
+ // being scripted by an evil Consumer.
+ byte[] randomData = new byte[8];
+ CryptoRandomDataGenerator.GetBytes(randomData);
+ this.AuthorizationSecret = Convert.ToBase64String(randomData);
+ this.OAuthAuthorizationSecToken.Value = this.AuthorizationSecret;
- OAuth10ConsumerWarning.Visible = Global.PendingOAuthAuthorization.IsUnsafeRequest;
+ this.OAuth10ConsumerWarning.Visible = Global.PendingOAuthAuthorization.IsUnsafeRequest;
+ }
}
}
- }
- protected void allowAccessButton_Click(object sender, EventArgs e) {
- if (this.AuthorizationSecret != OAuthAuthorizationSecToken.Value) {
- throw new ArgumentException(); // probably someone trying to hack in.
- }
- this.AuthorizationSecret = null; // clear one time use secret
- var pending = Global.PendingOAuthAuthorization;
- Global.AuthorizePendingRequestToken();
- multiView.ActiveViewIndex = 1;
+ protected void allowAccessButton_Click(object sender, EventArgs e) {
+ if (this.AuthorizationSecret != this.OAuthAuthorizationSecToken.Value) {
+ throw new ArgumentException(); // probably someone trying to hack in.
+ }
+ this.AuthorizationSecret = null; // clear one time use secret
+ var pending = Global.PendingOAuthAuthorization;
+ Global.AuthorizePendingRequestToken();
+ this.multiView.ActiveViewIndex = 1;
- ServiceProvider sp = new ServiceProvider(Constants.SelfDescription, Global.TokenManager);
- var response = sp.PrepareAuthorizationResponse(pending);
- if (response != null) {
- sp.Channel.Send(response);
- } else {
- if (pending.IsUnsafeRequest) {
- verifierMultiView.ActiveViewIndex = 1;
+ ServiceProvider sp = new ServiceProvider(Constants.SelfDescription, Global.TokenManager);
+ var response = sp.PrepareAuthorizationResponse(pending);
+ if (response != null) {
+ sp.Channel.Send(response);
} else {
- string verifier = ServiceProvider.CreateVerificationCode(VerificationCodeFormat.AlphaNumericNoLookAlikes, 10);
- verificationCodeLabel.Text = verifier;
- ITokenContainingMessage requestTokenMessage = pending;
- var requestToken = Global.TokenManager.GetRequestToken(requestTokenMessage.Token);
- requestToken.VerificationCode = verifier;
- Global.TokenManager.UpdateToken(requestToken);
+ if (pending.IsUnsafeRequest) {
+ this.verifierMultiView.ActiveViewIndex = 1;
+ } else {
+ string verifier = ServiceProvider.CreateVerificationCode(VerificationCodeFormat.AlphaNumericNoLookAlikes, 10);
+ this.verificationCodeLabel.Text = verifier;
+ ITokenContainingMessage requestTokenMessage = pending;
+ var requestToken = Global.TokenManager.GetRequestToken(requestTokenMessage.Token);
+ requestToken.VerificationCode = verifier;
+ Global.TokenManager.UpdateToken(requestToken);
+ }
}
}
- }
- protected void denyAccessButton_Click(object sender, EventArgs e) {
- // erase the request token.
- multiView.ActiveViewIndex = 2;
+ protected void denyAccessButton_Click(object sender, EventArgs e) {
+ // erase the request token.
+ this.multiView.ActiveViewIndex = 2;
+ }
}
-}
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Members/Authorize.aspx.designer.cs b/samples/OAuthServiceProvider/Members/Authorize.aspx.designer.cs
new file mode 100644
index 0000000..8aaf94d
--- /dev/null
+++ b/samples/OAuthServiceProvider/Members/Authorize.aspx.designer.cs
@@ -0,0 +1,105 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthServiceProvider {
+
+
+ public partial class Authorize {
+
+ /// <summary>
+ /// multiView control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.MultiView multiView;
+
+ /// <summary>
+ /// OAuthAuthorizationSecToken control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.HiddenField OAuthAuthorizationSecToken;
+
+ /// <summary>
+ /// consumerLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label consumerLabel;
+
+ /// <summary>
+ /// desiredAccessLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label desiredAccessLabel;
+
+ /// <summary>
+ /// allowAccessButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button allowAccessButton;
+
+ /// <summary>
+ /// denyAccessButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button denyAccessButton;
+
+ /// <summary>
+ /// OAuth10ConsumerWarning control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Panel OAuth10ConsumerWarning;
+
+ /// <summary>
+ /// verifierMultiView control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.MultiView verifierMultiView;
+
+ /// <summary>
+ /// verificationCodeLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label verificationCodeLabel;
+
+ /// <summary>
+ /// View1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.View View1;
+ }
+}
diff --git a/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx b/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx
index d6ea668..3506eb9 100644
--- a/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx
+++ b/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx
@@ -1,7 +1,6 @@
-<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
- CodeFile="AuthorizedConsumers.aspx.cs" Inherits="AuthorizedConsumers" %>
+<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="OAuthServiceProvider.AuthorizedConsumers" Codebehind="AuthorizedConsumers.aspx.cs" %>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
- <h2>The following consumers have access to your data</h2>
- <p>TODO</p>
+ <h2>The following consumers have access to your data</h2>
+ <p>TODO</p>
</asp:Content>
diff --git a/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx.cs b/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx.cs
index e7af629..fe647a8 100644
--- a/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx.cs
+++ b/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx.cs
@@ -1,15 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using System.Web.UI;
-using System.Web.UI.WebControls;
+namespace OAuthServiceProvider {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
-/// <summary>
-/// Lists the consumers that have active request or access tokens
-/// and provides a mechanism for the user to revoke permissions.
-/// </summary>
-public partial class AuthorizedConsumers : System.Web.UI.Page {
- protected void Page_Load(object sender, EventArgs e) {
+ /// <summary>
+ /// Lists the consumers that have active request or access tokens
+ /// and provides a mechanism for the user to revoke permissions.
+ /// </summary>
+ public partial class AuthorizedConsumers : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ }
}
-}
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx.designer.cs b/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx.designer.cs
new file mode 100644
index 0000000..419c114
--- /dev/null
+++ b/samples/OAuthServiceProvider/Members/AuthorizedConsumers.aspx.designer.cs
@@ -0,0 +1,15 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthServiceProvider {
+
+
+ public partial class AuthorizedConsumers {
+ }
+}
diff --git a/samples/OAuthServiceProvider/OAuth.ashx b/samples/OAuthServiceProvider/OAuth.ashx
index 46a516f..8a74926 100644
--- a/samples/OAuthServiceProvider/OAuth.ashx
+++ b/samples/OAuthServiceProvider/OAuth.ashx
@@ -8,6 +8,7 @@ using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
using DotNetOpenAuth.Messaging;
+using OAuthServiceProvider.Code;
public class OAuth : IHttpHandler, IRequiresSessionState {
ServiceProvider sp;
diff --git a/samples/OAuthServiceProvider/OAuthServiceProvider.csproj b/samples/OAuthServiceProvider/OAuthServiceProvider.csproj
new file mode 100644
index 0000000..68b2d90
--- /dev/null
+++ b/samples/OAuthServiceProvider/OAuthServiceProvider.csproj
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>
+ </ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{E135F455-0669-49F8-9207-07FCA8C8FC79}</ProjectGuid>
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>OAuthServiceProvider</RootNamespace>
+ <AssemblyName>OAuthServiceProvider</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net">
+ <HintPath>..\..\lib\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Data.Linq" />
+ <Reference Include="System.IdentityModel" />
+ <Reference Include="System.ServiceModel" />
+ <Reference Include="System.Web.Extensions" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.EnterpriseServices" />
+ <Reference Include="System.Web.Mobile" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="DataApi.svc" />
+ <Content Include="Default.aspx" />
+ <Content Include="favicon.ico" />
+ <Content Include="Global.asax" />
+ <Content Include="Login.aspx" />
+ <Content Include="Members\Authorize.aspx" />
+ <Content Include="Members\AuthorizedConsumers.aspx" />
+ <Content Include="Members\Logoff.aspx" />
+ <Content Include="TracePage.aspx" />
+ <Content Include="Web.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Code\DatabaseNonceStore.cs" />
+ <Compile Include="Default.aspx.designer.cs">
+ <DependentUpon>Default.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="DataApi.cs">
+ <DependentUpon>DataApi.svc</DependentUpon>
+ </Compile>
+ <Compile Include="Members\Authorize.aspx.designer.cs">
+ <DependentUpon>Authorize.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Members\AuthorizedConsumers.aspx.designer.cs">
+ <DependentUpon>AuthorizedConsumers.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Code\Constants.cs" />
+ <Compile Include="Code\CustomOAuthTypeProvider.cs" />
+ <Compile Include="Code\DatabaseTokenManager.cs" />
+ <Compile Include="Code\Global.cs" />
+ <Compile Include="Code\IDataApi.cs" />
+ <Compile Include="Code\OAuthAuthorizationManager.cs" />
+ <Compile Include="Code\OAuthConsumer.cs" />
+ <Compile Include="Code\OAuthPrincipalAuthorizationPolicy.cs" />
+ <Compile Include="Code\OAuthToken.cs" />
+ <Compile Include="Code\RequestScopedTokenMessage.cs" />
+ <Compile Include="Code\TokenAuthorizationState.cs" />
+ <Compile Include="Code\TracePageAppender.cs" />
+ <Compile Include="Code\Utilities.cs" />
+ <Compile Include="Code\DataClasses.designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>DataClasses.dbml</DependentUpon>
+ </Compile>
+ <Compile Include="Default.aspx.cs">
+ <DependentUpon>Default.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Members\Authorize.aspx.cs">
+ <DependentUpon>Authorize.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Members\AuthorizedConsumers.aspx.cs">
+ <DependentUpon>AuthorizedConsumers.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="TracePage.aspx.cs">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="TracePage.aspx.designer.cs">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="App_Data\" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="OAuth.ashx" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="MasterPage.master" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Code\DataClasses.dbml">
+ <Generator>MSLinqToSQLGenerator</Generator>
+ <LastGenOutput>DataClasses.designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </None>
+ <Content Include="Members\Web.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Code\DataClasses.dbml.layout">
+ <DependentUpon>DataClasses.dbml</DependentUpon>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{3259AA49-8AA1-44D3-9025-A0B520596A8C}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\DotNetOpenAuth\DotNetOpenAuth.csproj">
+ <Project>{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}</Project>
+ <Name>DotNetOpenAuth</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+ <WebProjectProperties>
+ <UseIIS>False</UseIIS>
+ <AutoAssignPort>False</AutoAssignPort>
+ <DevelopmentServerPort>65169</DevelopmentServerPort>
+ <DevelopmentServerVPath>/</DevelopmentServerVPath>
+ <IISUrl>
+ </IISUrl>
+ <NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
+ <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+ </WebProjectProperties>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/Properties/AssemblyInfo.cs b/samples/OAuthServiceProvider/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..09d299c
--- /dev/null
+++ b/samples/OAuthServiceProvider/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OAuthServiceProvider")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OAuthServiceProvider")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("B6206451-6557-4568-8D25-84AF93EC8B7B")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/samples/OAuthServiceProvider/TracePage.aspx b/samples/OAuthServiceProvider/TracePage.aspx
index 4d6ecc5..e83adc3 100644
--- a/samples/OAuthServiceProvider/TracePage.aspx
+++ b/samples/OAuthServiceProvider/TracePage.aspx
@@ -1,4 +1,4 @@
-<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TracePage.aspx.cs" Inherits="TracePage" %>
+<%@ Page Language="C#" AutoEventWireup="true" Inherits="OAuthServiceProvider.TracePage" Codebehind="TracePage.aspx.cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
diff --git a/samples/OAuthServiceProvider/TracePage.aspx.cs b/samples/OAuthServiceProvider/TracePage.aspx.cs
index 52848f2..fcfade5 100644
--- a/samples/OAuthServiceProvider/TracePage.aspx.cs
+++ b/samples/OAuthServiceProvider/TracePage.aspx.cs
@@ -1,21 +1,24 @@
-using System;
-using System.Collections.Generic;
-using System.Web;
-using System.Web.UI;
-using System.Web.UI.WebControls;
+namespace OAuthServiceProvider {
+ using System;
+ using System.Collections.Generic;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using OAuthServiceProvider.Code;
-/// <summary>
-/// A page to display recent log messages.
-/// </summary>
-public partial class TracePage : System.Web.UI.Page {
- protected void Page_Load(object sender, EventArgs e) {
- this.placeHolder1.Controls.Add(new Label { Text = HttpUtility.HtmlEncode(Global.LogMessages.ToString()) });
- }
+ /// <summary>
+ /// A page to display recent log messages.
+ /// </summary>
+ public partial class TracePage : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ this.placeHolder1.Controls.Add(new Label { Text = HttpUtility.HtmlEncode(Global.LogMessages.ToString()) });
+ }
- protected void clearLogButton_Click(object sender, EventArgs e) {
- Global.LogMessages.Length = 0;
+ protected void clearLogButton_Click(object sender, EventArgs e) {
+ Global.LogMessages.Length = 0;
- // clear the page immediately, and allow for F5 without a Postback warning.
- Response.Redirect(Request.Url.AbsoluteUri);
+ // clear the page immediately, and allow for F5 without a Postback warning.
+ Response.Redirect(Request.Url.AbsoluteUri);
+ }
}
-}
+} \ No newline at end of file
diff --git a/samples/OAuthServiceProvider/TracePage.aspx.designer.cs b/samples/OAuthServiceProvider/TracePage.aspx.designer.cs
new file mode 100644
index 0000000..3cd04be
--- /dev/null
+++ b/samples/OAuthServiceProvider/TracePage.aspx.designer.cs
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OAuthServiceProvider {
+
+
+ public partial class TracePage {
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ /// <summary>
+ /// clearLogButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button clearLogButton;
+
+ /// <summary>
+ /// placeHolder1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.PlaceHolder placeHolder1;
+ }
+}
diff --git a/samples/OAuthServiceProvider/Web.config b/samples/OAuthServiceProvider/Web.config
index 3ea490f..dc440fd 100644
--- a/samples/OAuthServiceProvider/Web.config
+++ b/samples/OAuthServiceProvider/Web.config
@@ -129,7 +129,7 @@
</assemblyBinding>
</runtime>
<log4net>
- <appender name="TracePageAppender" type="TracePageAppender, __code">
+ <appender name="TracePageAppender" type="OAuthServiceProvider.Code.TracePageAppender, OAuthServiceProvider">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline"/>
</layout>
@@ -151,15 +151,13 @@
<behavior name="DataApiBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
- <serviceAuthorization
- serviceAuthorizationManagerType="OAuthAuthorizationManager, __code"
- principalPermissionMode="Custom" />
+ <serviceAuthorization serviceAuthorizationManagerType="OAuthServiceProvider.Code.OAuthAuthorizationManager, OAuthServiceProvider" principalPermissionMode="Custom"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
- <service behaviorConfiguration="DataApiBehavior" name="DataApi">
- <endpoint address="" binding="wsHttpBinding" contract="IDataApi">
+ <service behaviorConfiguration="DataApiBehavior" name="OAuthServiceProvider.DataApi">
+ <endpoint address="" binding="wsHttpBinding" contract="OAuthServiceProvider.Code.IDataApi">
<identity>
<dns value="localhost"/>
</identity>
diff --git a/samples/OAuthServiceProvider/favicon.ico b/samples/OAuthServiceProvider/favicon.ico
new file mode 100644
index 0000000..e227dbe
--- /dev/null
+++ b/samples/OAuthServiceProvider/favicon.ico
Binary files differ
diff --git a/samples/OpenIdOfflineProvider/MainWindow.xaml b/samples/OpenIdOfflineProvider/MainWindow.xaml
index de215ba..5e9438f 100644
--- a/samples/OpenIdOfflineProvider/MainWindow.xaml
+++ b/samples/OpenIdOfflineProvider/MainWindow.xaml
@@ -6,7 +6,9 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
+ <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
@@ -20,6 +22,13 @@
<ComboBoxItem>Auto respond: No</ComboBoxItem>
<ComboBoxItem>Intercept</ComboBoxItem>
</ComboBox>
- <TextBox Height="auto" Margin="0,8,0,0" Grid.Row="2" Grid.ColumnSpan="2" Name="logBox" IsReadOnly="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" />
+ <Expander Grid.Row="2" Grid.ColumnSpan="2" Header="Advanced options">
+ <StackPanel Margin="3">
+ <CheckBox Name="directedIdentityTrailingPeriodsCheckbox">Directed identity uses trailing periods in path</CheckBox>
+ <CheckBox Name="capitalizedHostName">Directed identity uses capitalized host name in claimed identifier</CheckBox>
+ </StackPanel>
+ </Expander>
+ <TextBox Height="auto" Margin="0,8,0,0" Grid.Row="3" Grid.ColumnSpan="2" Name="logBox" IsReadOnly="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" />
+ <Button Grid.Row="4" Grid.ColumnSpan="2" Name="clearLogButton" Click="ClearLogButton_Click">Clear log</Button>
</Grid>
</Window>
diff --git a/samples/OpenIdOfflineProvider/MainWindow.xaml.cs b/samples/OpenIdOfflineProvider/MainWindow.xaml.cs
index 8f04da3..0fcac9c 100644
--- a/samples/OpenIdOfflineProvider/MainWindow.xaml.cs
+++ b/samples/OpenIdOfflineProvider/MainWindow.xaml.cs
@@ -25,6 +25,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider {
using System.Windows.Navigation;
using System.Windows.Shapes;
using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Provider;
using log4net;
using log4net.Appender;
@@ -117,7 +118,15 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider {
switch (checkidRequestList.SelectedIndex) {
case 0:
if (authRequest.IsDirectedIdentity) {
- authRequest.ClaimedIdentifier = new Uri(this.hostedProvider.UserIdentityPageBase, "directedidentity");
+ string userIdentityPageBase = this.hostedProvider.UserIdentityPageBase.AbsoluteUri;
+ if (capitalizedHostName.IsChecked.Value) {
+ userIdentityPageBase = (this.hostedProvider.UserIdentityPageBase.Scheme + Uri.SchemeDelimiter + this.hostedProvider.UserIdentityPageBase.Authority).ToUpperInvariant() + this.hostedProvider.UserIdentityPageBase.PathAndQuery;
+ }
+ string leafPath = "directedidentity";
+ if (directedIdentityTrailingPeriodsCheckbox.IsChecked.Value) {
+ leafPath += ".";
+ }
+ authRequest.ClaimedIdentifier = Identifier.Parse(userIdentityPageBase + leafPath, true);
authRequest.LocalIdentifier = authRequest.ClaimedIdentifier;
}
authRequest.IsAuthenticated = true;
@@ -169,5 +178,14 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider {
MessageBox.Show(this, ex.Message, "Error while copying OP Identifier to the clipboard", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
+
+ /// <summary>
+ /// Handles the Click event of the ClearLogButton control.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
+ private void ClearLogButton_Click(object sender, RoutedEventArgs e) {
+ logBox.Clear();
+ }
}
}
diff --git a/samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj b/samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj
index 43a8093..aeea185 100644
--- a/samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj
+++ b/samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
+ <ProjectRoot Condition="'$(ProjectRoot)' == ''">$(MSBuildProjectDirectory)\..\..\</ProjectRoot>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ </PropertyGroup>
+ <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.props" />
+ <PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5C65603B-235F-47E6-B536-06385C60DE7F}</ProjectGuid>
@@ -10,18 +14,38 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DotNetOpenAuth.OpenIdOfflineProvider</RootNamespace>
<AssemblyName>OpenIdOfflineProvider</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<UICulture>en-US</UICulture>
+ <TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' ">v3.5</TargetFrameworkVersion>
+ <OutputPath Condition=" '$(OutputPath)' == '' ">bin\$(TargetFrameworkVersion)\$(Configuration)\</OutputPath>
<ApplicationIcon>openid.ico</ApplicationIcon>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <TargetFrameworkProfile />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -48,27 +72,21 @@
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
<CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\log4net.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=736440c9b414ea16, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Microsoft.Contracts.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -94,19 +112,28 @@
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="CheckIdWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
@@ -158,6 +185,23 @@
<ItemGroup>
<Resource Include="openid.ico" />
</ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="..\..\tools\DotNetOpenAuth.Versioning.targets" />
+ <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.targets" />
</Project>
diff --git a/samples/OpenIdOfflineProvider/Properties/Resources.Designer.cs b/samples/OpenIdOfflineProvider/Properties/Resources.Designer.cs
index ac28082..a0e18ee 100644
--- a/samples/OpenIdOfflineProvider/Properties/Resources.Designer.cs
+++ b/samples/OpenIdOfflineProvider/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4912
+// Runtime Version:4.0.30104.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -19,7 +19,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/samples/OpenIdOfflineProvider/Properties/Settings.Designer.cs b/samples/OpenIdOfflineProvider/Properties/Settings.Designer.cs
index 014a460..f1e9c35 100644
--- a/samples/OpenIdOfflineProvider/Properties/Settings.Designer.cs
+++ b/samples/OpenIdOfflineProvider/Properties/Settings.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4912
+// Runtime Version:4.0.30104.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -12,7 +12,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/samples/OpenIdOfflineProvider/openid.ico b/samples/OpenIdOfflineProvider/openid.ico
index 651aeba..e227dbe 100644
--- a/samples/OpenIdOfflineProvider/openid.ico
+++ b/samples/OpenIdOfflineProvider/openid.ico
Binary files differ
diff --git a/samples/OpenIdProviderMvc/OpenIdProviderMvc.csproj b/samples/OpenIdProviderMvc/OpenIdProviderMvc.csproj
index 0c01c64..27fd42b 100644
--- a/samples/OpenIdProviderMvc/OpenIdProviderMvc.csproj
+++ b/samples/OpenIdProviderMvc/OpenIdProviderMvc.csproj
@@ -1,17 +1,18 @@
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AEA29D4D-396F-47F6-BC81-B58D4B855245}</ProjectGuid>
- <ProjectTypeGuids>{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenIdProviderMvc</RootNamespace>
<AssemblyName>OpenIdProviderMvc</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -29,39 +31,35 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
+ <Reference Include="System.Core" />
<Reference Include="System.Data" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\System.Web.Mvc.dll</HintPath>
- </Reference>
- <Reference Include="System.Xml.Linq">
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web.DynamicData" />
+ <Reference Include="System.Web.Entity" />
+ <Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Drawing" />
+ <Reference Include="System.Web.Mvc" />
<Reference Include="System.Web" />
- <Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
- <Reference Include="System.Web.Abstractions">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\System.Web.Abstractions.dll</HintPath>
+ <Reference Include="System.Web.Extensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Web.Routing">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\System.Web.Routing.dll</HintPath>
+ <Reference Include="System.Web.ApplicationServices">
+ <RequiredTargetFramework>v4.0</RequiredTargetFramework>
</Reference>
+ <Reference Include="System.Web.Abstractions" />
+ <Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
+ <Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Code\AccountMembershipService.cs" />
@@ -88,6 +86,7 @@
<ItemGroup>
<Content Include="App_Data\Users.xml" />
<Content Include="Default.aspx" />
+ <Content Include="favicon.ico" />
<Content Include="Global.asax" />
<Content Include="Views\Account\ChangePassword.aspx" />
<Content Include="Views\Account\ChangePasswordSuccess.aspx" />
@@ -124,13 +123,13 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target> -->
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
- <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
+ <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
</Target>
<ProjectExtensions>
<VisualStudio>
diff --git a/samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.debug.js b/samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.debug.js
index afd4566..2364244 100644
--- a/samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.debug.js
+++ b/samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.debug.js
@@ -31,6 +31,24 @@ Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode', false);
////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.JsonValidationField
+
+Sys.Mvc.$create_JsonValidationField = function Sys_Mvc_JsonValidationField() { return {}; }
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.JsonValidationOptions
+
+Sys.Mvc.$create_JsonValidationOptions = function Sys_Mvc_JsonValidationOptions() { return {}; }
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.JsonValidationRule
+
+Sys.Mvc.$create_JsonValidationRule = function Sys_Mvc_JsonValidationRule() { return {}; }
+
+
+////////////////////////////////////////////////////////////////////////////////
// Sys.Mvc.AjaxContext
Sys.Mvc.AjaxContext = function Sys_Mvc_AjaxContext(request, updateTarget, loadingElement, insertionMode) {
@@ -84,6 +102,12 @@ Sys.Mvc.AjaxContext.prototype = {
return this._loadingElement;
},
+ get_object: function Sys_Mvc_AjaxContext$get_object() {
+ /// <value type="Object"></value>
+ var executor = this.get_response();
+ return (executor) ? executor.get_object() : null;
+ },
+
get_response: function Sys_Mvc_AjaxContext$get_response() {
/// <value type="Sys.Net.WebRequestExecutor"></value>
return this._response;
@@ -124,10 +148,473 @@ Sys.Mvc.AsyncHyperlink.handleClick = function Sys_Mvc_AsyncHyperlink$handleClick
////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.FieldValidation
+
+Sys.Mvc.FieldValidation = function Sys_Mvc_FieldValidation(formValidation, fieldElements, validationMessageElement, replaceValidationMessageContents) {
+ /// <param name="formValidation" type="Sys.Mvc.FormValidation">
+ /// </param>
+ /// <param name="fieldElements" type="Array" elementType="Object" elementDomElement="true">
+ /// </param>
+ /// <param name="validationMessageElement" type="Object" domElement="true">
+ /// </param>
+ /// <param name="replaceValidationMessageContents" type="Boolean">
+ /// </param>
+ /// <field name="_hasTextChangedTag" type="String" static="true">
+ /// </field>
+ /// <field name="_hasValidationFiredTag" type="String" static="true">
+ /// </field>
+ /// <field name="_inputElementErrorCss" type="String" static="true">
+ /// </field>
+ /// <field name="_inputElementValidCss" type="String" static="true">
+ /// </field>
+ /// <field name="_validationMessageErrorCss" type="String" static="true">
+ /// </field>
+ /// <field name="_validationMessageValidCss" type="String" static="true">
+ /// </field>
+ /// <field name="_onBlurHandler" type="Sys.UI.DomEventHandler">
+ /// </field>
+ /// <field name="_onChangeHandler" type="Sys.UI.DomEventHandler">
+ /// </field>
+ /// <field name="_onInputHandler" type="Sys.UI.DomEventHandler">
+ /// </field>
+ /// <field name="_onPropertyChangeHandler" type="Sys.UI.DomEventHandler">
+ /// </field>
+ /// <field name="_errors" type="Array">
+ /// </field>
+ /// <field name="_fieldElements" type="Array" elementType="Object" elementDomElement="true">
+ /// </field>
+ /// <field name="_formValidation" type="Sys.Mvc.FormValidation">
+ /// </field>
+ /// <field name="_replaceValidationMessageContents" type="Boolean">
+ /// </field>
+ /// <field name="_validationMessageElement" type="Object" domElement="true">
+ /// </field>
+ /// <field name="_validators" type="Array">
+ /// </field>
+ this._errors = [];
+ this._validators = [];
+ this._formValidation = formValidation;
+ this._fieldElements = fieldElements;
+ this._validationMessageElement = validationMessageElement;
+ this._replaceValidationMessageContents = replaceValidationMessageContents;
+ this._onBlurHandler = Function.createDelegate(this, this._element_OnBlur);
+ this._onChangeHandler = Function.createDelegate(this, this._element_OnChange);
+ this._onInputHandler = Function.createDelegate(this, this._element_OnInput);
+ this._onPropertyChangeHandler = Function.createDelegate(this, this._element_OnPropertyChange);
+}
+Sys.Mvc.FieldValidation.prototype = {
+ _onBlurHandler: null,
+ _onChangeHandler: null,
+ _onInputHandler: null,
+ _onPropertyChangeHandler: null,
+ _fieldElements: null,
+ _formValidation: null,
+ _replaceValidationMessageContents: false,
+ _validationMessageElement: null,
+
+ addError: function Sys_Mvc_FieldValidation$addError(message) {
+ /// <param name="message" type="String">
+ /// </param>
+ this.addErrors([ message ]);
+ },
+
+ addErrors: function Sys_Mvc_FieldValidation$addErrors(messages) {
+ /// <param name="messages" type="Array" elementType="String">
+ /// </param>
+ if (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(messages)) {
+ Array.addRange(this._errors, messages);
+ this._onErrorCountChanged();
+ }
+ },
+
+ addValidator: function Sys_Mvc_FieldValidation$addValidator(validator) {
+ /// <param name="validator" type="Sys.Mvc.Validator">
+ /// </param>
+ Array.add(this._validators, validator);
+ },
+
+ disableDynamicValidation: function Sys_Mvc_FieldValidation$disableDynamicValidation() {
+ for (var i = 0; i < this._fieldElements.length; i++) {
+ var fieldElement = this._fieldElements[i];
+ if (Sys.Mvc._validationUtil.elementSupportsEvent(fieldElement, 'onpropertychange')) {
+ Sys.UI.DomEvent.removeHandler(fieldElement, 'propertychange', this._onPropertyChangeHandler);
+ }
+ else {
+ Sys.UI.DomEvent.removeHandler(fieldElement, 'input', this._onInputHandler);
+ }
+ Sys.UI.DomEvent.removeHandler(fieldElement, 'change', this._onChangeHandler);
+ Sys.UI.DomEvent.removeHandler(fieldElement, 'blur', this._onBlurHandler);
+ }
+ },
+
+ _displayError: function Sys_Mvc_FieldValidation$_displayError() {
+ if (this._validationMessageElement) {
+ if (this._replaceValidationMessageContents) {
+ Sys.Mvc._validationUtil.setInnerText(this._validationMessageElement, this._errors[0]);
+ }
+ Sys.UI.DomElement.removeCssClass(this._validationMessageElement, Sys.Mvc.FieldValidation._validationMessageValidCss);
+ Sys.UI.DomElement.addCssClass(this._validationMessageElement, Sys.Mvc.FieldValidation._validationMessageErrorCss);
+ }
+ for (var i = 0; i < this._fieldElements.length; i++) {
+ var fieldElement = this._fieldElements[i];
+ Sys.UI.DomElement.removeCssClass(fieldElement, Sys.Mvc.FieldValidation._inputElementValidCss);
+ Sys.UI.DomElement.addCssClass(fieldElement, Sys.Mvc.FieldValidation._inputElementErrorCss);
+ }
+ },
+
+ _displaySuccess: function Sys_Mvc_FieldValidation$_displaySuccess() {
+ if (this._validationMessageElement) {
+ if (this._replaceValidationMessageContents) {
+ Sys.Mvc._validationUtil.setInnerText(this._validationMessageElement, '');
+ }
+ Sys.UI.DomElement.removeCssClass(this._validationMessageElement, Sys.Mvc.FieldValidation._validationMessageErrorCss);
+ Sys.UI.DomElement.addCssClass(this._validationMessageElement, Sys.Mvc.FieldValidation._validationMessageValidCss);
+ }
+ for (var i = 0; i < this._fieldElements.length; i++) {
+ var fieldElement = this._fieldElements[i];
+ Sys.UI.DomElement.removeCssClass(fieldElement, Sys.Mvc.FieldValidation._inputElementErrorCss);
+ Sys.UI.DomElement.addCssClass(fieldElement, Sys.Mvc.FieldValidation._inputElementValidCss);
+ }
+ },
+
+ _element_OnInput: function Sys_Mvc_FieldValidation$_element_OnInput(e) {
+ /// <param name="e" type="Sys.UI.DomEvent">
+ /// </param>
+ e.target[Sys.Mvc.FieldValidation._hasTextChangedTag] = true;
+ if (e.target[Sys.Mvc.FieldValidation._hasValidationFiredTag]) {
+ this.validate();
+ }
+ },
+
+ _element_OnBlur: function Sys_Mvc_FieldValidation$_element_OnBlur(e) {
+ /// <param name="e" type="Sys.UI.DomEvent">
+ /// </param>
+ if (e.target[Sys.Mvc.FieldValidation._hasTextChangedTag] || e.target[Sys.Mvc.FieldValidation._hasValidationFiredTag]) {
+ this.validate();
+ }
+ },
+
+ _element_OnChange: function Sys_Mvc_FieldValidation$_element_OnChange(e) {
+ /// <param name="e" type="Sys.UI.DomEvent">
+ /// </param>
+ e.target[Sys.Mvc.FieldValidation._hasTextChangedTag] = true;
+ },
+
+ _element_OnPropertyChange: function Sys_Mvc_FieldValidation$_element_OnPropertyChange(e) {
+ /// <param name="e" type="Sys.UI.DomEvent">
+ /// </param>
+ if (e.rawEvent.propertyName === 'value') {
+ e.target[Sys.Mvc.FieldValidation._hasTextChangedTag] = true;
+ if (e.target[Sys.Mvc.FieldValidation._hasValidationFiredTag]) {
+ this.validate();
+ }
+ }
+ },
+
+ enableDynamicValidation: function Sys_Mvc_FieldValidation$enableDynamicValidation() {
+ for (var i = 0; i < this._fieldElements.length; i++) {
+ var fieldElement = this._fieldElements[i];
+ if (Sys.Mvc._validationUtil.elementSupportsEvent(fieldElement, 'onpropertychange')) {
+ Sys.UI.DomEvent.addHandler(fieldElement, 'propertychange', this._onPropertyChangeHandler);
+ }
+ else {
+ Sys.UI.DomEvent.addHandler(fieldElement, 'input', this._onInputHandler);
+ }
+ Sys.UI.DomEvent.addHandler(fieldElement, 'change', this._onChangeHandler);
+ Sys.UI.DomEvent.addHandler(fieldElement, 'blur', this._onBlurHandler);
+ }
+ },
+
+ _getStringValue: function Sys_Mvc_FieldValidation$_getStringValue() {
+ /// <returns type="String"></returns>
+ return (this._fieldElements.length > 0) ? this._fieldElements[0].value : null;
+ },
+
+ _onErrorCountChanged: function Sys_Mvc_FieldValidation$_onErrorCountChanged() {
+ if (!this._errors.length) {
+ this._displaySuccess();
+ }
+ else {
+ this._displayError();
+ }
+ },
+
+ removeAllErrors: function Sys_Mvc_FieldValidation$removeAllErrors() {
+ Array.clear(this._errors);
+ this._onErrorCountChanged();
+ },
+
+ validate: function Sys_Mvc_FieldValidation$validate() {
+ /// <returns type="Array" elementType="String"></returns>
+ var allErrors = [];
+ for (var i = 0; i < this._validators.length; i++) {
+ var validator = this._validators[i];
+ var thisErrors = validator.validate(this, this._fieldElements, this._getStringValue());
+ if (thisErrors) {
+ Array.addRange(allErrors, thisErrors);
+ }
+ }
+ for (var i = 0; i < this._fieldElements.length; i++) {
+ var fieldElement = this._fieldElements[i];
+ fieldElement[Sys.Mvc.FieldValidation._hasValidationFiredTag] = true;
+ }
+ this.removeAllErrors();
+ this.addErrors(allErrors);
+ return allErrors;
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.FormValidation
+
+Sys.Mvc.FormValidation = function Sys_Mvc_FormValidation(formElement, validationSummaryElement) {
+ /// <param name="formElement" type="Object" domElement="true">
+ /// </param>
+ /// <param name="validationSummaryElement" type="Object" domElement="true">
+ /// </param>
+ /// <field name="_validationSummaryErrorCss" type="String" static="true">
+ /// </field>
+ /// <field name="_validationSummaryValidCss" type="String" static="true">
+ /// </field>
+ /// <field name="_formValidationTag" type="String" static="true">
+ /// </field>
+ /// <field name="_onSubmitHandler" type="Sys.UI.DomEventHandler">
+ /// </field>
+ /// <field name="_errors" type="Array">
+ /// </field>
+ /// <field name="_fieldValidations" type="Array">
+ /// </field>
+ /// <field name="_formElement" type="Object" domElement="true">
+ /// </field>
+ /// <field name="_validationSummaryElement" type="Object" domElement="true">
+ /// </field>
+ /// <field name="_validationSummaryULElement" type="Object" domElement="true">
+ /// </field>
+ this._errors = [];
+ this._fieldValidations = [];
+ this._formElement = formElement;
+ this._validationSummaryElement = validationSummaryElement;
+ formElement[Sys.Mvc.FormValidation._formValidationTag] = this;
+ if (validationSummaryElement) {
+ var ulElements = validationSummaryElement.getElementsByTagName('ul');
+ if (ulElements.length > 0) {
+ this._validationSummaryULElement = ulElements[0];
+ }
+ }
+ this._onSubmitHandler = Function.createDelegate(this, this._form_OnSubmit);
+}
+Sys.Mvc.FormValidation.enableClientValidation = function Sys_Mvc_FormValidation$enableClientValidation(options, userState) {
+ /// <param name="options" type="Sys.Mvc.JsonValidationOptions">
+ /// </param>
+ /// <param name="userState" type="Object">
+ /// </param>
+ Sys.Application.add_load(Function.createDelegate(null, function(sender, e) {
+ Sys.Mvc.FormValidation.parseJsonOptions(options);
+ }));
+}
+Sys.Mvc.FormValidation._getFormElementsWithName = function Sys_Mvc_FormValidation$_getFormElementsWithName(formElement, name) {
+ /// <param name="formElement" type="Object" domElement="true">
+ /// </param>
+ /// <param name="name" type="String">
+ /// </param>
+ /// <returns type="Array" elementType="Object" elementDomElement="true"></returns>
+ var allElementsWithNameInForm = [];
+ var allElementsWithName = document.getElementsByName(name);
+ for (var i = 0; i < allElementsWithName.length; i++) {
+ var thisElement = allElementsWithName[i];
+ if (Sys.Mvc.FormValidation._isElementInHierarchy(formElement, thisElement)) {
+ Array.add(allElementsWithNameInForm, thisElement);
+ }
+ }
+ return allElementsWithNameInForm;
+}
+Sys.Mvc.FormValidation.getValidationForForm = function Sys_Mvc_FormValidation$getValidationForForm(formElement) {
+ /// <param name="formElement" type="Object" domElement="true">
+ /// </param>
+ /// <returns type="Sys.Mvc.FormValidation"></returns>
+ return formElement[Sys.Mvc.FormValidation._formValidationTag];
+}
+Sys.Mvc.FormValidation._isElementInHierarchy = function Sys_Mvc_FormValidation$_isElementInHierarchy(parent, child) {
+ /// <param name="parent" type="Object" domElement="true">
+ /// </param>
+ /// <param name="child" type="Object" domElement="true">
+ /// </param>
+ /// <returns type="Boolean"></returns>
+ while (child) {
+ if (parent === child) {
+ return true;
+ }
+ child = child.parentNode;
+ }
+ return false;
+}
+Sys.Mvc.FormValidation.parseJsonOptions = function Sys_Mvc_FormValidation$parseJsonOptions(options) {
+ /// <param name="options" type="Sys.Mvc.JsonValidationOptions">
+ /// </param>
+ /// <returns type="Sys.Mvc.FormValidation"></returns>
+ var formElement = $get(options.FormId);
+ var validationSummaryElement = (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(options.ValidationSummaryId)) ? $get(options.ValidationSummaryId) : null;
+ var formValidation = new Sys.Mvc.FormValidation(formElement, validationSummaryElement);
+ formValidation.enableDynamicValidation();
+ for (var i = 0; i < options.Fields.length; i++) {
+ var field = options.Fields[i];
+ var fieldElements = Sys.Mvc.FormValidation._getFormElementsWithName(formElement, field.FieldName);
+ var validationMessageElement = (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(field.ValidationMessageId)) ? $get(field.ValidationMessageId) : null;
+ var fieldValidation = new Sys.Mvc.FieldValidation(formValidation, fieldElements, validationMessageElement, field.ReplaceValidationMessageContents);
+ for (var j = 0; j < field.ValidationRules.length; j++) {
+ var rule = field.ValidationRules[j];
+ var validator = Sys.Mvc.ValidatorRegistry.getValidator(rule);
+ if (validator) {
+ fieldValidation.addValidator(validator);
+ }
+ }
+ fieldValidation.enableDynamicValidation();
+ formValidation.addFieldValidation(fieldValidation);
+ }
+ return formValidation;
+}
+Sys.Mvc.FormValidation.prototype = {
+ _onSubmitHandler: null,
+ _formElement: null,
+ _validationSummaryElement: null,
+ _validationSummaryULElement: null,
+
+ addError: function Sys_Mvc_FormValidation$addError(message) {
+ /// <param name="message" type="String">
+ /// </param>
+ this.addErrors([ message ]);
+ },
+
+ addErrors: function Sys_Mvc_FormValidation$addErrors(messages) {
+ /// <param name="messages" type="Array" elementType="String">
+ /// </param>
+ if (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(messages)) {
+ Array.addRange(this._errors, messages);
+ this._onErrorCountChanged();
+ }
+ },
+
+ addFieldValidation: function Sys_Mvc_FormValidation$addFieldValidation(validation) {
+ /// <param name="validation" type="Sys.Mvc.FieldValidation">
+ /// </param>
+ Array.add(this._fieldValidations, validation);
+ },
+
+ disableDynamicValidation: function Sys_Mvc_FormValidation$disableDynamicValidation() {
+ Sys.UI.DomEvent.removeHandler(this._formElement, 'submit', this._onSubmitHandler);
+ },
+
+ _displayError: function Sys_Mvc_FormValidation$_displayError() {
+ if (this._validationSummaryElement) {
+ if (this._validationSummaryULElement) {
+ Sys.Mvc._validationUtil.removeAllChildren(this._validationSummaryULElement);
+ for (var i = 0; i < this._errors.length; i++) {
+ var liElement = document.createElement('li');
+ Sys.Mvc._validationUtil.setInnerText(liElement, this._errors[i]);
+ this._validationSummaryULElement.appendChild(liElement);
+ }
+ }
+ Sys.UI.DomElement.removeCssClass(this._validationSummaryElement, Sys.Mvc.FormValidation._validationSummaryValidCss);
+ Sys.UI.DomElement.addCssClass(this._validationSummaryElement, Sys.Mvc.FormValidation._validationSummaryErrorCss);
+ }
+ },
+
+ _displaySuccess: function Sys_Mvc_FormValidation$_displaySuccess() {
+ if (this._validationSummaryElement) {
+ if (this._validationSummaryULElement) {
+ this._validationSummaryULElement.innerHTML = '';
+ }
+ Sys.UI.DomElement.removeCssClass(this._validationSummaryElement, Sys.Mvc.FormValidation._validationSummaryErrorCss);
+ Sys.UI.DomElement.addCssClass(this._validationSummaryElement, Sys.Mvc.FormValidation._validationSummaryValidCss);
+ }
+ },
+
+ enableDynamicValidation: function Sys_Mvc_FormValidation$enableDynamicValidation() {
+ Sys.UI.DomEvent.addHandler(this._formElement, 'submit', this._onSubmitHandler);
+ },
+
+ _form_OnSubmit: function Sys_Mvc_FormValidation$_form_OnSubmit(e) {
+ /// <param name="e" type="Sys.UI.DomEvent">
+ /// </param>
+ var form = e.target;
+ var errorMessages = this.validate(true);
+ if (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(errorMessages)) {
+ e.preventDefault();
+ }
+ },
+
+ _onErrorCountChanged: function Sys_Mvc_FormValidation$_onErrorCountChanged() {
+ if (!this._errors.length) {
+ this._displaySuccess();
+ }
+ else {
+ this._displayError();
+ }
+ },
+
+ removeAllErrors: function Sys_Mvc_FormValidation$removeAllErrors() {
+ Array.clear(this._errors);
+ this._onErrorCountChanged();
+ },
+
+ validate: function Sys_Mvc_FormValidation$validate(replaceValidationSummary) {
+ /// <param name="replaceValidationSummary" type="Boolean">
+ /// </param>
+ /// <returns type="Array" elementType="String"></returns>
+ var allErrors = [];
+ for (var i = 0; i < this._fieldValidations.length; i++) {
+ var validation = this._fieldValidations[i];
+ var thisErrors = validation.validate();
+ if (thisErrors) {
+ Array.addRange(allErrors, thisErrors);
+ }
+ }
+ if (replaceValidationSummary) {
+ this.removeAllErrors();
+ this.addErrors(allErrors);
+ }
+ return allErrors;
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
// Sys.Mvc.MvcHelpers
Sys.Mvc.MvcHelpers = function Sys_Mvc_MvcHelpers() {
}
+Sys.Mvc.MvcHelpers._serializeSubmitButton = function Sys_Mvc_MvcHelpers$_serializeSubmitButton(element, offsetX, offsetY) {
+ /// <param name="element" type="Object" domElement="true">
+ /// </param>
+ /// <param name="offsetX" type="Number" integer="true">
+ /// </param>
+ /// <param name="offsetY" type="Number" integer="true">
+ /// </param>
+ /// <returns type="String"></returns>
+ if (element.disabled) {
+ return null;
+ }
+ var name = element.name;
+ if (name) {
+ var tagName = element.tagName.toUpperCase();
+ var encodedName = encodeURIComponent(name);
+ var inputElement = element;
+ if (tagName === 'INPUT') {
+ var type = inputElement.type;
+ if (type === 'submit') {
+ return encodedName + '=' + encodeURIComponent(inputElement.value);
+ }
+ else if (type === 'image') {
+ return encodedName + '.x=' + offsetX + '&' + encodedName + '.y=' + offsetY;
+ }
+ }
+ else if ((tagName === 'BUTTON') && (name.length) && (inputElement.type === 'submit')) {
+ return encodedName + '=' + encodeURIComponent(inputElement.value);
+ }
+ }
+ return null;
+}
Sys.Mvc.MvcHelpers._serializeForm = function Sys_Mvc_MvcHelpers$_serializeForm(form) {
/// <param name="form" type="Object" domElement="true">
/// </param>
@@ -172,6 +659,11 @@ Sys.Mvc.MvcHelpers._serializeForm = function Sys_Mvc_MvcHelpers$_serializeForm(f
formBody.append('&');
}
}
+ var additionalInput = form._additionalInput;
+ if (additionalInput) {
+ formBody.append(additionalInput);
+ formBody.append('&');
+ }
return formBody.toString();
}
Sys.Mvc.MvcHelpers._asyncRequest = function Sys_Mvc_MvcHelpers$_asyncRequest(url, verb, body, triggerElement, ajaxOptions) {
@@ -200,8 +692,14 @@ Sys.Mvc.MvcHelpers._asyncRequest = function Sys_Mvc_MvcHelpers$_asyncRequest(url
body += '&';
}
body += 'X-Requested-With=XMLHttpRequest';
+ var upperCaseVerb = verb.toUpperCase();
+ var isGetOrPost = (upperCaseVerb === 'GET' || upperCaseVerb === 'POST');
+ if (!isGetOrPost) {
+ body += '&';
+ body += 'X-HTTP-Method-Override=' + upperCaseVerb;
+ }
var requestBody = '';
- if (verb.toUpperCase() === 'GET' || verb.toUpperCase() === 'DELETE') {
+ if (upperCaseVerb === 'GET' || upperCaseVerb === 'DELETE') {
if (url.indexOf('?') > -1) {
if (!url.endsWith('&')) {
url += '&';
@@ -218,7 +716,13 @@ Sys.Mvc.MvcHelpers._asyncRequest = function Sys_Mvc_MvcHelpers$_asyncRequest(url
}
var request = new Sys.Net.WebRequest();
request.set_url(url);
- request.set_httpVerb(verb);
+ if (isGetOrPost) {
+ request.set_httpVerb(verb);
+ }
+ else {
+ request.set_httpVerb('POST');
+ request.get_headers()['X-HTTP-Method-Override'] = upperCaseVerb;
+ }
request.set_body(requestBody);
if (verb.toUpperCase() === 'PUT') {
request.get_headers()['Content-Type'] = 'application/x-www-form-urlencoded;';
@@ -314,6 +818,14 @@ Sys.Mvc.MvcHelpers.updateDomElement = function Sys_Mvc_MvcHelpers$updateDomEleme
Sys.Mvc.AsyncForm = function Sys_Mvc_AsyncForm() {
}
+Sys.Mvc.AsyncForm.handleClick = function Sys_Mvc_AsyncForm$handleClick(form, evt) {
+ /// <param name="form" type="Object" domElement="true">
+ /// </param>
+ /// <param name="evt" type="Sys.UI.DomEvent">
+ /// </param>
+ var additionalInput = Sys.Mvc.MvcHelpers._serializeSubmitButton(evt.target, evt.offsetX, evt.offsetY);
+ form._additionalInput = additionalInput;
+}
Sys.Mvc.AsyncForm.handleSubmit = function Sys_Mvc_AsyncForm$handleSubmit(form, evt, ajaxOptions) {
/// <param name="form" type="Object" domElement="true">
/// </param>
@@ -327,10 +839,369 @@ Sys.Mvc.AsyncForm.handleSubmit = function Sys_Mvc_AsyncForm$handleSubmit(form, e
}
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.RangeValidator
+
+Sys.Mvc.RangeValidator = function Sys_Mvc_RangeValidator(errorMessage, minimum, maximum) {
+ /// <param name="errorMessage" type="String">
+ /// </param>
+ /// <param name="minimum" type="Number">
+ /// </param>
+ /// <param name="maximum" type="Number">
+ /// </param>
+ /// <field name="_errorMessage$1" type="String">
+ /// </field>
+ /// <field name="_minimum$1" type="Number">
+ /// </field>
+ /// <field name="_maximum$1" type="Number">
+ /// </field>
+ Sys.Mvc.RangeValidator.initializeBase(this);
+ this._errorMessage$1 = errorMessage;
+ this._minimum$1 = minimum;
+ this._maximum$1 = maximum;
+}
+Sys.Mvc.RangeValidator._create = function Sys_Mvc_RangeValidator$_create(rule) {
+ /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
+ /// </param>
+ /// <returns type="Sys.Mvc.RangeValidator"></returns>
+ var min = rule.ValidationParameters['minimum'];
+ var max = rule.ValidationParameters['maximum'];
+ return new Sys.Mvc.RangeValidator(rule.ErrorMessage, min, max);
+}
+Sys.Mvc.RangeValidator.prototype = {
+ _errorMessage$1: null,
+ _minimum$1: null,
+ _maximum$1: null,
+
+ validate: function Sys_Mvc_RangeValidator$validate(validation, elements, value) {
+ /// <param name="validation" type="Sys.Mvc.FieldValidation">
+ /// </param>
+ /// <param name="elements" type="Array" elementType="Object" elementDomElement="true">
+ /// </param>
+ /// <param name="value" type="String">
+ /// </param>
+ /// <returns type="Array" elementType="String"></returns>
+ if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) {
+ return null;
+ }
+ var n = Number.parseLocale(value);
+ return (isNaN(n) || n < this._minimum$1 || n > this._maximum$1) ? [ this._errorMessage$1 ] : null;
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.RegularExpressionValidator
+
+Sys.Mvc.RegularExpressionValidator = function Sys_Mvc_RegularExpressionValidator(errorMessage, pattern) {
+ /// <param name="errorMessage" type="String">
+ /// </param>
+ /// <param name="pattern" type="String">
+ /// </param>
+ /// <field name="_errorMessage$1" type="String">
+ /// </field>
+ /// <field name="_pattern$1" type="String">
+ /// </field>
+ Sys.Mvc.RegularExpressionValidator.initializeBase(this);
+ this._errorMessage$1 = errorMessage;
+ this._pattern$1 = pattern;
+}
+Sys.Mvc.RegularExpressionValidator._create = function Sys_Mvc_RegularExpressionValidator$_create(rule) {
+ /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
+ /// </param>
+ /// <returns type="Sys.Mvc.RegularExpressionValidator"></returns>
+ var pattern = rule.ValidationParameters['pattern'];
+ return new Sys.Mvc.RegularExpressionValidator(rule.ErrorMessage, pattern);
+}
+Sys.Mvc.RegularExpressionValidator.prototype = {
+ _errorMessage$1: null,
+ _pattern$1: null,
+
+ validate: function Sys_Mvc_RegularExpressionValidator$validate(validation, elements, value) {
+ /// <param name="validation" type="Sys.Mvc.FieldValidation">
+ /// </param>
+ /// <param name="elements" type="Array" elementType="Object" elementDomElement="true">
+ /// </param>
+ /// <param name="value" type="String">
+ /// </param>
+ /// <returns type="Array" elementType="String"></returns>
+ if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) {
+ return null;
+ }
+ var regExp = new RegExp(this._pattern$1);
+ var matches = regExp.exec(value);
+ return (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(matches) && matches[0].length === value.length) ? null : [ this._errorMessage$1 ];
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.RequiredValidator
+
+Sys.Mvc.RequiredValidator = function Sys_Mvc_RequiredValidator(errorMessage) {
+ /// <param name="errorMessage" type="String">
+ /// </param>
+ /// <field name="_errorMessage$1" type="String">
+ /// </field>
+ Sys.Mvc.RequiredValidator.initializeBase(this);
+ this._errorMessage$1 = errorMessage;
+}
+Sys.Mvc.RequiredValidator._create = function Sys_Mvc_RequiredValidator$_create(rule) {
+ /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
+ /// </param>
+ /// <returns type="Sys.Mvc.RequiredValidator"></returns>
+ return new Sys.Mvc.RequiredValidator(rule.ErrorMessage);
+}
+Sys.Mvc.RequiredValidator._isRadioInputElement$1 = function Sys_Mvc_RequiredValidator$_isRadioInputElement$1(element) {
+ /// <param name="element" type="Object" domElement="true">
+ /// </param>
+ /// <returns type="Boolean"></returns>
+ if (element.tagName.toUpperCase() === 'INPUT') {
+ var inputType = (element.type).toUpperCase();
+ if (inputType === 'RADIO') {
+ return true;
+ }
+ }
+ return false;
+}
+Sys.Mvc.RequiredValidator._isSelectInputElement$1 = function Sys_Mvc_RequiredValidator$_isSelectInputElement$1(element) {
+ /// <param name="element" type="Object" domElement="true">
+ /// </param>
+ /// <returns type="Boolean"></returns>
+ if (element.tagName.toUpperCase() === 'SELECT') {
+ return true;
+ }
+ return false;
+}
+Sys.Mvc.RequiredValidator._isTextualInputElement$1 = function Sys_Mvc_RequiredValidator$_isTextualInputElement$1(element) {
+ /// <param name="element" type="Object" domElement="true">
+ /// </param>
+ /// <returns type="Boolean"></returns>
+ if (element.tagName.toUpperCase() === 'INPUT') {
+ var inputType = (element.type).toUpperCase();
+ switch (inputType) {
+ case 'TEXT':
+ case 'PASSWORD':
+ case 'FILE':
+ return true;
+ }
+ }
+ if (element.tagName.toUpperCase() === 'TEXTAREA') {
+ return true;
+ }
+ return false;
+}
+Sys.Mvc.RequiredValidator.prototype = {
+ _errorMessage$1: null,
+
+ validate: function Sys_Mvc_RequiredValidator$validate(validation, elements, value) {
+ /// <param name="validation" type="Sys.Mvc.FieldValidation">
+ /// </param>
+ /// <param name="elements" type="Array" elementType="Object" elementDomElement="true">
+ /// </param>
+ /// <param name="value" type="String">
+ /// </param>
+ /// <returns type="Array" elementType="String"></returns>
+ if (!elements.length) {
+ return null;
+ }
+ var sampleElement = elements[0];
+ if (Sys.Mvc.RequiredValidator._isTextualInputElement$1(sampleElement)) {
+ return this._validateTextualInput$1(sampleElement);
+ }
+ if (Sys.Mvc.RequiredValidator._isRadioInputElement$1(sampleElement)) {
+ return this._validateRadioInput$1(elements);
+ }
+ if (Sys.Mvc.RequiredValidator._isSelectInputElement$1(sampleElement)) {
+ return this._validateSelectInput$1((sampleElement).options);
+ }
+ return null;
+ },
+
+ _validateRadioInput$1: function Sys_Mvc_RequiredValidator$_validateRadioInput$1(elements) {
+ /// <param name="elements" type="Array" elementType="Object" elementDomElement="true">
+ /// </param>
+ /// <returns type="Array" elementType="String"></returns>
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i];
+ if (element.checked) {
+ return null;
+ }
+ }
+ return [ this._errorMessage$1 ];
+ },
+
+ _validateSelectInput$1: function Sys_Mvc_RequiredValidator$_validateSelectInput$1(optionElements) {
+ /// <param name="optionElements" type="DOMElementCollection">
+ /// </param>
+ /// <returns type="Array" elementType="String"></returns>
+ for (var i = 0; i < optionElements.length; i++) {
+ var element = optionElements[i];
+ if (element.selected) {
+ if (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(element.value)) {
+ return null;
+ }
+ }
+ }
+ return [ this._errorMessage$1 ];
+ },
+
+ _validateTextualInput$1: function Sys_Mvc_RequiredValidator$_validateTextualInput$1(element) {
+ /// <param name="element" type="Object" domElement="true">
+ /// </param>
+ /// <returns type="Array" elementType="String"></returns>
+ return (Sys.Mvc._validationUtil.stringIsNullOrEmpty(element.value)) ? [ this._errorMessage$1 ] : null;
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.StringLengthValidator
+
+Sys.Mvc.StringLengthValidator = function Sys_Mvc_StringLengthValidator(errorMessage, minLength, maxLength) {
+ /// <param name="errorMessage" type="String">
+ /// </param>
+ /// <param name="minLength" type="Number" integer="true">
+ /// </param>
+ /// <param name="maxLength" type="Number" integer="true">
+ /// </param>
+ /// <field name="_errorMessage$1" type="String">
+ /// </field>
+ /// <field name="_maxLength$1" type="Number" integer="true">
+ /// </field>
+ /// <field name="_minLength$1" type="Number" integer="true">
+ /// </field>
+ Sys.Mvc.StringLengthValidator.initializeBase(this);
+ this._errorMessage$1 = errorMessage;
+ this._minLength$1 = minLength;
+ this._maxLength$1 = maxLength;
+}
+Sys.Mvc.StringLengthValidator._create = function Sys_Mvc_StringLengthValidator$_create(rule) {
+ /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
+ /// </param>
+ /// <returns type="Sys.Mvc.StringLengthValidator"></returns>
+ var minLength = rule.ValidationParameters['minimumLength'];
+ var maxLength = rule.ValidationParameters['maximumLength'];
+ return new Sys.Mvc.StringLengthValidator(rule.ErrorMessage, minLength, maxLength);
+}
+Sys.Mvc.StringLengthValidator.prototype = {
+ _errorMessage$1: null,
+ _maxLength$1: 0,
+ _minLength$1: 0,
+
+ validate: function Sys_Mvc_StringLengthValidator$validate(validation, elements, value) {
+ /// <param name="validation" type="Sys.Mvc.FieldValidation">
+ /// </param>
+ /// <param name="elements" type="Array" elementType="Object" elementDomElement="true">
+ /// </param>
+ /// <param name="value" type="String">
+ /// </param>
+ /// <returns type="Array" elementType="String"></returns>
+ if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) {
+ return null;
+ }
+ return (this._minLength$1 <= value.length && value.length <= this._maxLength$1) ? null : [ this._errorMessage$1 ];
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc._validationUtil
+
+Sys.Mvc._validationUtil = function Sys_Mvc__validationUtil() {
+}
+Sys.Mvc._validationUtil.arrayIsNullOrEmpty = function Sys_Mvc__validationUtil$arrayIsNullOrEmpty(array) {
+ /// <param name="array" type="Array" elementType="Object">
+ /// </param>
+ /// <returns type="Boolean"></returns>
+ return (!array || !array.length);
+}
+Sys.Mvc._validationUtil.stringIsNullOrEmpty = function Sys_Mvc__validationUtil$stringIsNullOrEmpty(value) {
+ /// <param name="value" type="String">
+ /// </param>
+ /// <returns type="Boolean"></returns>
+ return (!value || !value.length);
+}
+Sys.Mvc._validationUtil.elementSupportsEvent = function Sys_Mvc__validationUtil$elementSupportsEvent(element, eventAttributeName) {
+ /// <param name="element" type="Object" domElement="true">
+ /// </param>
+ /// <param name="eventAttributeName" type="String">
+ /// </param>
+ /// <returns type="Boolean"></returns>
+ return (eventAttributeName in element);
+}
+Sys.Mvc._validationUtil.removeAllChildren = function Sys_Mvc__validationUtil$removeAllChildren(element) {
+ /// <param name="element" type="Object" domElement="true">
+ /// </param>
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+Sys.Mvc._validationUtil.setInnerText = function Sys_Mvc__validationUtil$setInnerText(element, innerText) {
+ /// <param name="element" type="Object" domElement="true">
+ /// </param>
+ /// <param name="innerText" type="String">
+ /// </param>
+ var textNode = document.createTextNode(innerText);
+ Sys.Mvc._validationUtil.removeAllChildren(element);
+ element.appendChild(textNode);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.Validator
+
+Sys.Mvc.Validator = function Sys_Mvc_Validator() {
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Sys.Mvc.ValidatorRegistry
+
+Sys.Mvc.ValidatorRegistry = function Sys_Mvc_ValidatorRegistry() {
+ /// <field name="_validators" type="Object" static="true">
+ /// </field>
+}
+Sys.Mvc.ValidatorRegistry.get_creators = function Sys_Mvc_ValidatorRegistry$get_creators() {
+ /// <value type="Object"></value>
+ return Sys.Mvc.ValidatorRegistry._validators;
+}
+Sys.Mvc.ValidatorRegistry.getValidator = function Sys_Mvc_ValidatorRegistry$getValidator(rule) {
+ /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
+ /// </param>
+ /// <returns type="Sys.Mvc.Validator"></returns>
+ var creator = Sys.Mvc.ValidatorRegistry._validators[rule.ValidationType];
+ return (creator) ? creator(rule) : null;
+}
+Sys.Mvc.ValidatorRegistry._getDefaultValidators = function Sys_Mvc_ValidatorRegistry$_getDefaultValidators() {
+ /// <returns type="Object"></returns>
+ return { required: Function.createDelegate(null, Sys.Mvc.RequiredValidator._create), stringLength: Function.createDelegate(null, Sys.Mvc.StringLengthValidator._create), regularExpression: Function.createDelegate(null, Sys.Mvc.RegularExpressionValidator._create), range: Function.createDelegate(null, Sys.Mvc.RangeValidator._create) };
+}
+
+
Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext');
Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink');
+Sys.Mvc.FieldValidation.registerClass('Sys.Mvc.FieldValidation');
+Sys.Mvc.FormValidation.registerClass('Sys.Mvc.FormValidation');
Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers');
Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm');
+Sys.Mvc.Validator.registerClass('Sys.Mvc.Validator');
+Sys.Mvc.RangeValidator.registerClass('Sys.Mvc.RangeValidator', Sys.Mvc.Validator);
+Sys.Mvc.RegularExpressionValidator.registerClass('Sys.Mvc.RegularExpressionValidator', Sys.Mvc.Validator);
+Sys.Mvc.RequiredValidator.registerClass('Sys.Mvc.RequiredValidator', Sys.Mvc.Validator);
+Sys.Mvc.StringLengthValidator.registerClass('Sys.Mvc.StringLengthValidator', Sys.Mvc.Validator);
+Sys.Mvc._validationUtil.registerClass('Sys.Mvc._validationUtil');
+Sys.Mvc.ValidatorRegistry.registerClass('Sys.Mvc.ValidatorRegistry');
+Sys.Mvc.FieldValidation._hasTextChangedTag = '__MVC_HasTextChanged';
+Sys.Mvc.FieldValidation._hasValidationFiredTag = '__MVC_HasValidationFired';
+Sys.Mvc.FieldValidation._inputElementErrorCss = 'input-validation-error';
+Sys.Mvc.FieldValidation._inputElementValidCss = 'input-validation-valid';
+Sys.Mvc.FieldValidation._validationMessageErrorCss = 'field-validation-error';
+Sys.Mvc.FieldValidation._validationMessageValidCss = 'field-validation-valid';
+Sys.Mvc.FormValidation._validationSummaryErrorCss = 'validation-summary-errors';
+Sys.Mvc.FormValidation._validationSummaryValidCss = 'validation-summary-valid';
+Sys.Mvc.FormValidation._formValidationTag = '__MVC_FormValidation';
+Sys.Mvc.ValidatorRegistry._validators = Sys.Mvc.ValidatorRegistry._getDefaultValidators();
// ---- Do not remove this footer ----
// Generated using Script# v0.5.0.0 (http://projects.nikhilk.net)
diff --git a/samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.js b/samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.js
index 6d6a7e8..7bdc08b 100644
--- a/samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.js
+++ b/samples/OpenIdProviderMvc/Scripts/MicrosoftMvcAjax.js
@@ -5,19 +5,60 @@
Type.registerNamespace('Sys.Mvc');Sys.Mvc.$create_AjaxOptions=function(){return {};}
Sys.Mvc.InsertionMode=function(){};Sys.Mvc.InsertionMode.prototype = {replace:0,insertBefore:1,insertAfter:2}
-Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode',false);Sys.Mvc.AjaxContext=function(request,updateTarget,loadingElement,insertionMode){this.$3=request;this.$4=updateTarget;this.$1=loadingElement;this.$0=insertionMode;}
-Sys.Mvc.AjaxContext.prototype={$0:0,$1:null,$2:null,$3:null,$4:null,get_data:function(){if(this.$2){return this.$2.get_responseData();}else{return null;}},get_insertionMode:function(){return this.$0;},get_loadingElement:function(){return this.$1;},get_response:function(){return this.$2;},set_response:function(value){this.$2=value;return value;},get_request:function(){return this.$3;},get_updateTarget:function(){return this.$4;}}
+Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode',false);Sys.Mvc.$create_JsonValidationField=function(){return {};}
+Sys.Mvc.$create_JsonValidationOptions=function(){return {};}
+Sys.Mvc.$create_JsonValidationRule=function(){return {};}
+Sys.Mvc.AjaxContext=function(request,updateTarget,loadingElement,insertionMode){this.$3=request;this.$4=updateTarget;this.$1=loadingElement;this.$0=insertionMode;}
+Sys.Mvc.AjaxContext.prototype={$0:0,$1:null,$2:null,$3:null,$4:null,get_data:function(){if(this.$2){return this.$2.get_responseData();}else{return null;}},get_insertionMode:function(){return this.$0;},get_loadingElement:function(){return this.$1;},get_object:function(){var $0=this.get_response();return ($0)?$0.get_object():null;},get_response:function(){return this.$2;},set_response:function(value){this.$2=value;return value;},get_request:function(){return this.$3;},get_updateTarget:function(){return this.$4;}}
Sys.Mvc.AsyncHyperlink=function(){}
-Sys.Mvc.AsyncHyperlink.handleClick=function(anchor,evt,ajaxOptions){evt.preventDefault();Sys.Mvc.MvcHelpers.$1(anchor.href,'post','',anchor,ajaxOptions);}
+Sys.Mvc.AsyncHyperlink.handleClick=function(anchor,evt,ajaxOptions){evt.preventDefault();Sys.Mvc.MvcHelpers.$2(anchor.href,'post','',anchor,ajaxOptions);}
+Sys.Mvc.FieldValidation=function(formValidation,fieldElements,validationMessageElement,replaceValidationMessageContents){this.$A=[];this.$F=[];this.$C=formValidation;this.$B=fieldElements;this.$E=validationMessageElement;this.$D=replaceValidationMessageContents;this.$6=Function.createDelegate(this,this.$13);this.$7=Function.createDelegate(this,this.$14);this.$8=Function.createDelegate(this,this.$12);this.$9=Function.createDelegate(this,this.$15);}
+Sys.Mvc.FieldValidation.prototype={$6:null,$7:null,$8:null,$9:null,$B:null,$C:null,$D:false,$E:null,addError:function(message){this.addErrors([message]);},addErrors:function(messages){if(!Sys.Mvc._ValidationUtil.$0(messages)){Array.addRange(this.$A,messages);this.$17();}},addValidator:function(validator){Array.add(this.$F,validator);},disableDynamicValidation:function(){for(var $0=0;$0<this.$B.length;$0++){var $1=this.$B[$0];if(Sys.Mvc._ValidationUtil.$2($1,'onpropertychange')){Sys.UI.DomEvent.removeHandler($1,'propertychange',this.$9);}else{Sys.UI.DomEvent.removeHandler($1,'input',this.$8);}Sys.UI.DomEvent.removeHandler($1,'change',this.$7);Sys.UI.DomEvent.removeHandler($1,'blur',this.$6);}},$10:function(){if(this.$E){if(this.$D){Sys.Mvc._ValidationUtil.$4(this.$E,this.$A[0]);}Sys.UI.DomElement.removeCssClass(this.$E,'field-validation-valid');Sys.UI.DomElement.addCssClass(this.$E,'field-validation-error');}for(var $0=0;$0<this.$B.length;$0++){var $1=this.$B[$0];Sys.UI.DomElement.removeCssClass($1,'input-validation-valid');Sys.UI.DomElement.addCssClass($1,'input-validation-error');}},$11:function(){if(this.$E){if(this.$D){Sys.Mvc._ValidationUtil.$4(this.$E,'');}Sys.UI.DomElement.removeCssClass(this.$E,'field-validation-error');Sys.UI.DomElement.addCssClass(this.$E,'field-validation-valid');}for(var $0=0;$0<this.$B.length;$0++){var $1=this.$B[$0];Sys.UI.DomElement.removeCssClass($1,'input-validation-error');Sys.UI.DomElement.addCssClass($1,'input-validation-valid');}},$12:function($p0){$p0.target['__MVC_HasTextChanged'] = true;if($p0.target['__MVC_HasValidationFired']){this.validate();}},$13:function($p0){if($p0.target['__MVC_HasTextChanged']||$p0.target['__MVC_HasValidationFired']){this.validate();}},$14:function($p0){$p0.target['__MVC_HasTextChanged'] = true;},$15:function($p0){if($p0.rawEvent.propertyName==='value'){$p0.target['__MVC_HasTextChanged'] = true;if($p0.target['__MVC_HasValidationFired']){this.validate();}}},enableDynamicValidation:function(){for(var $0=0;$0<this.$B.length;$0++){var $1=this.$B[$0];if(Sys.Mvc._ValidationUtil.$2($1,'onpropertychange')){Sys.UI.DomEvent.addHandler($1,'propertychange',this.$9);}else{Sys.UI.DomEvent.addHandler($1,'input',this.$8);}Sys.UI.DomEvent.addHandler($1,'change',this.$7);Sys.UI.DomEvent.addHandler($1,'blur',this.$6);}},$16:function(){return (this.$B.length>0)?this.$B[0].value:null;},$17:function(){if(!this.$A.length){this.$11();}else{this.$10();}},removeAllErrors:function(){Array.clear(this.$A);this.$17();},validate:function(){var $0=[];for(var $1=0;$1<this.$F.length;$1++){var $2=this.$F[$1];var $3=$2.validate(this,this.$B,this.$16());if($3){Array.addRange($0,$3);}}for(var $4=0;$4<this.$B.length;$4++){var $5=this.$B[$4];$5['__MVC_HasValidationFired'] = true;}this.removeAllErrors();this.addErrors($0);return $0;}}
+Sys.Mvc.FormValidation=function(formElement,validationSummaryElement){this.$4=[];this.$5=[];this.$6=formElement;this.$7=validationSummaryElement;formElement['__MVC_FormValidation'] = this;if(validationSummaryElement){var $0=validationSummaryElement.getElementsByTagName('ul');if($0.length>0){this.$8=$0[0];}}this.$3=Function.createDelegate(this,this.$B);}
+Sys.Mvc.FormValidation.enableClientValidation=function(options,userState){Sys.Application.add_load(Function.createDelegate(null,function($p1_0,$p1_1){
+Sys.Mvc.FormValidation.parseJsonOptions(options);}));}
+Sys.Mvc.FormValidation.$C=function($p0,$p1){var $0=[];var $1=document.getElementsByName($p1);for(var $2=0;$2<$1.length;$2++){var $3=$1[$2];if(Sys.Mvc.FormValidation.$D($p0,$3)){Array.add($0,$3);}}return $0;}
+Sys.Mvc.FormValidation.getValidationForForm=function(formElement){return formElement['__MVC_FormValidation'];}
+Sys.Mvc.FormValidation.$D=function($p0,$p1){while($p1){if($p0===$p1){return true;}$p1=$p1.parentNode;}return false;}
+Sys.Mvc.FormValidation.parseJsonOptions=function(options){var $0=$get(options.FormId);var $1=(!Sys.Mvc._ValidationUtil.$1(options.ValidationSummaryId))?$get(options.ValidationSummaryId):null;var $2=new Sys.Mvc.FormValidation($0,$1);$2.enableDynamicValidation();for(var $3=0;$3<options.Fields.length;$3++){var $4=options.Fields[$3];var $5=Sys.Mvc.FormValidation.$C($0,$4.FieldName);var $6=(!Sys.Mvc._ValidationUtil.$1($4.ValidationMessageId))?$get($4.ValidationMessageId):null;var $7=new Sys.Mvc.FieldValidation($2,$5,$6,$4.ReplaceValidationMessageContents);for(var $8=0;$8<$4.ValidationRules.length;$8++){var $9=$4.ValidationRules[$8];var $A=Sys.Mvc.ValidatorRegistry.getValidator($9);if($A){$7.addValidator($A);}}$7.enableDynamicValidation();$2.addFieldValidation($7);}return $2;}
+Sys.Mvc.FormValidation.prototype={$3:null,$6:null,$7:null,$8:null,addError:function(message){this.addErrors([message]);},addErrors:function(messages){if(!Sys.Mvc._ValidationUtil.$0(messages)){Array.addRange(this.$4,messages);this.$E();}},addFieldValidation:function(validation){Array.add(this.$5,validation);},disableDynamicValidation:function(){Sys.UI.DomEvent.removeHandler(this.$6,'submit',this.$3);},$9:function(){if(this.$7){if(this.$8){Sys.Mvc._ValidationUtil.$3(this.$8);for(var $0=0;$0<this.$4.length;$0++){var $1=document.createElement('li');Sys.Mvc._ValidationUtil.$4($1,this.$4[$0]);this.$8.appendChild($1);}}Sys.UI.DomElement.removeCssClass(this.$7,'validation-summary-valid');Sys.UI.DomElement.addCssClass(this.$7,'validation-summary-errors');}},$A:function(){if(this.$7){if(this.$8){this.$8.innerHTML='';}Sys.UI.DomElement.removeCssClass(this.$7,'validation-summary-errors');Sys.UI.DomElement.addCssClass(this.$7,'validation-summary-valid');}},enableDynamicValidation:function(){Sys.UI.DomEvent.addHandler(this.$6,'submit',this.$3);},$B:function($p0){var $0=$p0.target;var $1=this.validate(true);if(!Sys.Mvc._ValidationUtil.$0($1)){$p0.preventDefault();}},$E:function(){if(!this.$4.length){this.$A();}else{this.$9();}},removeAllErrors:function(){Array.clear(this.$4);this.$E();},validate:function(replaceValidationSummary){var $0=[];for(var $1=0;$1<this.$5.length;$1++){var $2=this.$5[$1];var $3=$2.validate();if($3){Array.addRange($0,$3);}}if(replaceValidationSummary){this.removeAllErrors();this.addErrors($0);}return $0;}}
Sys.Mvc.MvcHelpers=function(){}
-Sys.Mvc.MvcHelpers.$0=function($p0){var $0=$p0.elements;var $1=new Sys.StringBuilder();var $2=$0.length;for(var $3=0;$3<$2;$3++){var $4=$0[$3];var $5=$4.name;if(!$5||!$5.length){continue;}var $6=$4.tagName.toUpperCase();if($6==='INPUT'){var $7=$4;var $8=$7.type;if(($8==='text')||($8==='password')||($8==='hidden')||((($8==='checkbox')||($8==='radio'))&&$4.checked)){$1.append(encodeURIComponent($5));$1.append('=');$1.append(encodeURIComponent($7.value));$1.append('&');}}else if($6==='SELECT'){var $9=$4;var $A=$9.options.length;for(var $B=0;$B<$A;$B++){var $C=$9.options[$B];if($C.selected){$1.append(encodeURIComponent($5));$1.append('=');$1.append(encodeURIComponent($C.value));$1.append('&');}}}else if($6==='TEXTAREA'){$1.append(encodeURIComponent($5));$1.append('=');$1.append(encodeURIComponent(($4.value)));$1.append('&');}}return $1.toString();}
-Sys.Mvc.MvcHelpers.$1=function($p0,$p1,$p2,$p3,$p4){if($p4.confirm){if(!confirm($p4.confirm)){return;}}if($p4.url){$p0=$p4.url;}if($p4.httpMethod){$p1=$p4.httpMethod;}if($p2.length>0&&!$p2.endsWith('&')){$p2+='&';}$p2+='X-Requested-With=XMLHttpRequest';var $0='';if($p1.toUpperCase()==='GET'||$p1.toUpperCase()==='DELETE'){if($p0.indexOf('?')>-1){if(!$p0.endsWith('&')){$p0+='&';}$p0+=$p2;}else{$p0+='?';$p0+=$p2;}}else{$0=$p2;}var $1=new Sys.Net.WebRequest();$1.set_url($p0);$1.set_httpVerb($p1);$1.set_body($0);if($p1.toUpperCase()==='PUT'){$1.get_headers()['Content-Type']='application/x-www-form-urlencoded;';}$1.get_headers()['X-Requested-With']='XMLHttpRequest';var $2=null;if($p4.updateTargetId){$2=$get($p4.updateTargetId);}var $3=null;if($p4.loadingElementId){$3=$get($p4.loadingElementId);}var $4=new Sys.Mvc.AjaxContext($1,$2,$3,$p4.insertionMode);var $5=true;if($p4.onBegin){$5=$p4.onBegin($4)!==false;}if($3){Sys.UI.DomElement.setVisible($4.get_loadingElement(),true);}if($5){$1.add_completed(Function.createDelegate(null,function($p1_0){
-Sys.Mvc.MvcHelpers.$2($1,$p4,$4);}));$1.invoke();}}
-Sys.Mvc.MvcHelpers.$2=function($p0,$p1,$p2){$p2.set_response($p0.get_executor());if($p1.onComplete&&$p1.onComplete($p2)===false){return;}var $0=$p2.get_response().get_statusCode();if(($0>=200&&$0<300)||$0===304||$0===1223){if($0!==204&&$0!==304&&$0!==1223){var $1=$p2.get_response().getResponseHeader('Content-Type');if(($1)&&($1.indexOf('application/x-javascript')!==-1)){eval($p2.get_data());}else{Sys.Mvc.MvcHelpers.updateDomElement($p2.get_updateTarget(),$p2.get_insertionMode(),$p2.get_data());}}if($p1.onSuccess){$p1.onSuccess($p2);}}else{if($p1.onFailure){$p1.onFailure($p2);}}if($p2.get_loadingElement()){Sys.UI.DomElement.setVisible($p2.get_loadingElement(),false);}}
+Sys.Mvc.MvcHelpers.$0=function($p0,$p1,$p2){if($p0.disabled){return null;}var $0=$p0.name;if($0){var $1=$p0.tagName.toUpperCase();var $2=encodeURIComponent($0);var $3=$p0;if($1==='INPUT'){var $4=$3.type;if($4==='submit'){return $2+'='+encodeURIComponent($3.value);}else if($4==='image'){return $2+'.x='+$p1+'&'+$2+'.y='+$p2;}}else if(($1==='BUTTON')&&($0.length)&&($3.type==='submit')){return $2+'='+encodeURIComponent($3.value);}}return null;}
+Sys.Mvc.MvcHelpers.$1=function($p0){var $0=$p0.elements;var $1=new Sys.StringBuilder();var $2=$0.length;for(var $4=0;$4<$2;$4++){var $5=$0[$4];var $6=$5.name;if(!$6||!$6.length){continue;}var $7=$5.tagName.toUpperCase();if($7==='INPUT'){var $8=$5;var $9=$8.type;if(($9==='text')||($9==='password')||($9==='hidden')||((($9==='checkbox')||($9==='radio'))&&$5.checked)){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($8.value));$1.append('&');}}else if($7==='SELECT'){var $A=$5;var $B=$A.options.length;for(var $C=0;$C<$B;$C++){var $D=$A.options[$C];if($D.selected){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($D.value));$1.append('&');}}}else if($7==='TEXTAREA'){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent(($5.value)));$1.append('&');}}var $3=$p0._additionalInput;if($3){$1.append($3);$1.append('&');}return $1.toString();}
+Sys.Mvc.MvcHelpers.$2=function($p0,$p1,$p2,$p3,$p4){if($p4.confirm){if(!confirm($p4.confirm)){return;}}if($p4.url){$p0=$p4.url;}if($p4.httpMethod){$p1=$p4.httpMethod;}if($p2.length>0&&!$p2.endsWith('&')){$p2+='&';}$p2+='X-Requested-With=XMLHttpRequest';var $0=$p1.toUpperCase();var $1=($0==='GET'||$0==='POST');if(!$1){$p2+='&';$p2+='X-HTTP-Method-Override='+$0;}var $2='';if($0==='GET'||$0==='DELETE'){if($p0.indexOf('?')>-1){if(!$p0.endsWith('&')){$p0+='&';}$p0+=$p2;}else{$p0+='?';$p0+=$p2;}}else{$2=$p2;}var $3=new Sys.Net.WebRequest();$3.set_url($p0);if($1){$3.set_httpVerb($p1);}else{$3.set_httpVerb('POST');$3.get_headers()['X-HTTP-Method-Override']=$0;}$3.set_body($2);if($p1.toUpperCase()==='PUT'){$3.get_headers()['Content-Type']='application/x-www-form-urlencoded;';}$3.get_headers()['X-Requested-With']='XMLHttpRequest';var $4=null;if($p4.updateTargetId){$4=$get($p4.updateTargetId);}var $5=null;if($p4.loadingElementId){$5=$get($p4.loadingElementId);}var $6=new Sys.Mvc.AjaxContext($3,$4,$5,$p4.insertionMode);var $7=true;if($p4.onBegin){$7=$p4.onBegin($6)!==false;}if($5){Sys.UI.DomElement.setVisible($6.get_loadingElement(),true);}if($7){$3.add_completed(Function.createDelegate(null,function($p1_0){
+Sys.Mvc.MvcHelpers.$3($3,$p4,$6);}));$3.invoke();}}
+Sys.Mvc.MvcHelpers.$3=function($p0,$p1,$p2){$p2.set_response($p0.get_executor());if($p1.onComplete&&$p1.onComplete($p2)===false){return;}var $0=$p2.get_response().get_statusCode();if(($0>=200&&$0<300)||$0===304||$0===1223){if($0!==204&&$0!==304&&$0!==1223){var $1=$p2.get_response().getResponseHeader('Content-Type');if(($1)&&($1.indexOf('application/x-javascript')!==-1)){eval($p2.get_data());}else{Sys.Mvc.MvcHelpers.updateDomElement($p2.get_updateTarget(),$p2.get_insertionMode(),$p2.get_data());}}if($p1.onSuccess){$p1.onSuccess($p2);}}else{if($p1.onFailure){$p1.onFailure($p2);}}if($p2.get_loadingElement()){Sys.UI.DomElement.setVisible($p2.get_loadingElement(),false);}}
Sys.Mvc.MvcHelpers.updateDomElement=function(target,insertionMode,content){if(target){switch(insertionMode){case 0:target.innerHTML=content;break;case 1:if(content&&content.length>0){target.innerHTML=content+target.innerHTML.trimStart();}break;case 2:if(content&&content.length>0){target.innerHTML=target.innerHTML.trimEnd()+content;}break;}}}
Sys.Mvc.AsyncForm=function(){}
-Sys.Mvc.AsyncForm.handleSubmit=function(form,evt,ajaxOptions){evt.preventDefault();var $0=Sys.Mvc.MvcHelpers.$0(form);Sys.Mvc.MvcHelpers.$1(form.action,form.method||'post',$0,form,ajaxOptions);}
-Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext');Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink');Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers');Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm');
+Sys.Mvc.AsyncForm.handleClick=function(form,evt){var $0=Sys.Mvc.MvcHelpers.$0(evt.target,evt.offsetX,evt.offsetY);form._additionalInput = $0;}
+Sys.Mvc.AsyncForm.handleSubmit=function(form,evt,ajaxOptions){evt.preventDefault();var $0=Sys.Mvc.MvcHelpers.$1(form);Sys.Mvc.MvcHelpers.$2(form.action,form.method||'post',$0,form,ajaxOptions);}
+Sys.Mvc.RangeValidator=function(errorMessage,minimum,maximum){Sys.Mvc.RangeValidator.initializeBase(this);this.$0=errorMessage;this.$1=minimum;this.$2=maximum;}
+Sys.Mvc.RangeValidator.$3=function($p0){var $0=$p0.ValidationParameters['minimum'];var $1=$p0.ValidationParameters['maximum'];return new Sys.Mvc.RangeValidator($p0.ErrorMessage,$0,$1);}
+Sys.Mvc.RangeValidator.prototype={$0:null,$1:null,$2:null,validate:function(validation,elements,value){if(Sys.Mvc._ValidationUtil.$1(value)){return null;}var $0=Number.parseLocale(value);return (isNaN($0)||$0<this.$1||$0>this.$2)?[this.$0]:null;}}
+Sys.Mvc.RegularExpressionValidator=function(errorMessage,pattern){Sys.Mvc.RegularExpressionValidator.initializeBase(this);this.$0=errorMessage;this.$1=pattern;}
+Sys.Mvc.RegularExpressionValidator.$2=function($p0){var $0=$p0.ValidationParameters['pattern'];return new Sys.Mvc.RegularExpressionValidator($p0.ErrorMessage,$0);}
+Sys.Mvc.RegularExpressionValidator.prototype={$0:null,$1:null,validate:function(validation,elements,value){if(Sys.Mvc._ValidationUtil.$1(value)){return null;}var $0=new RegExp(this.$1);var $1=$0.exec(value);return (!Sys.Mvc._ValidationUtil.$0($1)&&$1[0].length===value.length)?null:[this.$0];}}
+Sys.Mvc.RequiredValidator=function(errorMessage){Sys.Mvc.RequiredValidator.initializeBase(this);this.$0=errorMessage;}
+Sys.Mvc.RequiredValidator.$1=function($p0){return new Sys.Mvc.RequiredValidator($p0.ErrorMessage);}
+Sys.Mvc.RequiredValidator.$2=function($p0){if($p0.tagName.toUpperCase()==='INPUT'){var $0=($p0.type).toUpperCase();if($0==='RADIO'){return true;}}return false;}
+Sys.Mvc.RequiredValidator.$3=function($p0){if($p0.tagName.toUpperCase()==='SELECT'){return true;}return false;}
+Sys.Mvc.RequiredValidator.$4=function($p0){if($p0.tagName.toUpperCase()==='INPUT'){var $0=($p0.type).toUpperCase();switch($0){case 'TEXT':case 'PASSWORD':case 'FILE':return true;}}if($p0.tagName.toUpperCase()==='TEXTAREA'){return true;}return false;}
+Sys.Mvc.RequiredValidator.prototype={$0:null,validate:function(validation,elements,value){if(!elements.length){return null;}var $0=elements[0];if(Sys.Mvc.RequiredValidator.$4($0)){return this.$7($0);}if(Sys.Mvc.RequiredValidator.$2($0)){return this.$5(elements);}if(Sys.Mvc.RequiredValidator.$3($0)){return this.$6(($0).options);}return null;},$5:function($p0){for(var $0=0;$0<$p0.length;$0++){var $1=$p0[$0];if($1.checked){return null;}}return [this.$0];},$6:function($p0){for(var $0=0;$0<$p0.length;$0++){var $1=$p0[$0];if($1.selected){if(!Sys.Mvc._ValidationUtil.$1($1.value)){return null;}}}return [this.$0];},$7:function($p0){return (Sys.Mvc._ValidationUtil.$1($p0.value))?[this.$0]:null;}}
+Sys.Mvc.StringLengthValidator=function(errorMessage,minLength,maxLength){Sys.Mvc.StringLengthValidator.initializeBase(this);this.$0=errorMessage;this.$2=minLength;this.$1=maxLength;}
+Sys.Mvc.StringLengthValidator.$3=function($p0){var $0=$p0.ValidationParameters['minimumLength'];var $1=$p0.ValidationParameters['maximumLength'];return new Sys.Mvc.StringLengthValidator($p0.ErrorMessage,$0,$1);}
+Sys.Mvc.StringLengthValidator.prototype={$0:null,$1:0,$2:0,validate:function(validation,elements,value){if(Sys.Mvc._ValidationUtil.$1(value)){return null;}return (this.$2<=value.length&&value.length<=this.$1)?null:[this.$0];}}
+Sys.Mvc._ValidationUtil=function(){}
+Sys.Mvc._ValidationUtil.$0=function($p0){return (!$p0||!$p0.length);}
+Sys.Mvc._ValidationUtil.$1=function($p0){return (!$p0||!$p0.length);}
+Sys.Mvc._ValidationUtil.$2=function($p0,$p1){return ($p1 in $p0);}
+Sys.Mvc._ValidationUtil.$3=function($p0){while($p0.firstChild){$p0.removeChild($p0.firstChild);}}
+Sys.Mvc._ValidationUtil.$4=function($p0,$p1){var $0=document.createTextNode($p1);Sys.Mvc._ValidationUtil.$3($p0);$p0.appendChild($0);}
+Sys.Mvc.Validator=function(){}
+Sys.Mvc.ValidatorRegistry=function(){}
+Sys.Mvc.ValidatorRegistry.get_creators=function(){return Sys.Mvc.ValidatorRegistry.$0;}
+Sys.Mvc.ValidatorRegistry.getValidator=function(rule){var $0=Sys.Mvc.ValidatorRegistry.$0[rule.ValidationType];return ($0)?$0(rule):null;}
+Sys.Mvc.ValidatorRegistry.$1=function(){return {required:Function.createDelegate(null,Sys.Mvc.RequiredValidator.$1),stringLength:Function.createDelegate(null,Sys.Mvc.StringLengthValidator.$3),regularExpression:Function.createDelegate(null,Sys.Mvc.RegularExpressionValidator.$2),range:Function.createDelegate(null,Sys.Mvc.RangeValidator.$3)};}
+Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext');Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink');Sys.Mvc.FieldValidation.registerClass('Sys.Mvc.FieldValidation');Sys.Mvc.FormValidation.registerClass('Sys.Mvc.FormValidation');Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers');Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm');Sys.Mvc.Validator.registerClass('Sys.Mvc.Validator');Sys.Mvc.RangeValidator.registerClass('Sys.Mvc.RangeValidator',Sys.Mvc.Validator);Sys.Mvc.RegularExpressionValidator.registerClass('Sys.Mvc.RegularExpressionValidator',Sys.Mvc.Validator);Sys.Mvc.RequiredValidator.registerClass('Sys.Mvc.RequiredValidator',Sys.Mvc.Validator);Sys.Mvc.StringLengthValidator.registerClass('Sys.Mvc.StringLengthValidator',Sys.Mvc.Validator);Sys.Mvc._ValidationUtil.registerClass('Sys.Mvc._ValidationUtil');Sys.Mvc.ValidatorRegistry.registerClass('Sys.Mvc.ValidatorRegistry');Sys.Mvc.ValidatorRegistry.$0=Sys.Mvc.ValidatorRegistry.$1();
// ---- Do not remove this footer ----
// Generated using Script# v0.5.0.0 (http://projects.nikhilk.net)
// -----------------------------------
diff --git a/samples/OpenIdProviderMvc/Views/Web.config b/samples/OpenIdProviderMvc/Views/Web.config
index df858d4..df0103b 100644
--- a/samples/OpenIdProviderMvc/Views/Web.config
+++ b/samples/OpenIdProviderMvc/Views/Web.config
@@ -2,8 +2,7 @@
<configuration>
<system.web>
<httpHandlers>
- <add path="*" verb="*"
- type="System.Web.HttpNotFoundHandler"/>
+ <add path="*" verb="*" type="System.Web.HttpNotFoundHandler" />
</httpHandlers>
<!--
@@ -13,22 +12,18 @@
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
- <pages
- validateRequest="false"
- pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
- pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
- userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<controls>
- <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
+ <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
<system.webServer>
- <validation validateIntegratedModeConfiguration="false"/>
+ <validation validateIntegratedModeConfiguration="false" />
<handlers>
- <remove name="BlockViewHandler"/>
- <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
+ <remove name="BlockViewHandler" />
+ <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>
diff --git a/samples/OpenIdProviderMvc/Web.config b/samples/OpenIdProviderMvc/Web.config
index ba96c2a..cc30638 100644
--- a/samples/OpenIdProviderMvc/Web.config
+++ b/samples/OpenIdProviderMvc/Web.config
@@ -77,7 +77,7 @@
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
@@ -143,7 +143,7 @@
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
- <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
@@ -186,12 +186,21 @@
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
</system.webServer>
<runtime>
<legacyHMACWarning enabled="0" />
+
+ <!-- When targeting ASP.NET MVC 2, this assemblyBinding makes MVC 1 references relink
+ to MVC 2 so libraries such as DotNetOpenAuth that compile against MVC 1 will work with it. -->
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
+ <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
</runtime>
</configuration>
diff --git a/samples/OpenIdProviderMvc/favicon.ico b/samples/OpenIdProviderMvc/favicon.ico
new file mode 100644
index 0000000..e227dbe
--- /dev/null
+++ b/samples/OpenIdProviderMvc/favicon.ico
Binary files differ
diff --git a/samples/OpenIdProviderWebForms/Code/CustomStoreDataSet.Designer.cs b/samples/OpenIdProviderWebForms/Code/CustomStoreDataSet.Designer.cs
index 813ff62..b8d98ec 100644
--- a/samples/OpenIdProviderWebForms/Code/CustomStoreDataSet.Designer.cs
+++ b/samples/OpenIdProviderWebForms/Code/CustomStoreDataSet.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
+// Runtime Version:4.0.30104.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -16,7 +16,6 @@ namespace OpenIdProviderWebForms.Code {
/// <summary>
///Represents a strongly typed in-memory cache of data.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[global::System.Serializable()]
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
@@ -32,6 +31,7 @@ namespace OpenIdProviderWebForms.Code {
private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public CustomStoreDataSet() {
this.BeginInit();
this.InitClass();
@@ -42,6 +42,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected CustomStoreDataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context, false) {
if ((this.IsBinarySerialized(info, context) == true)) {
@@ -80,6 +81,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public AssociationDataTable Association {
@@ -89,6 +91,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public NonceDataTable Nonce {
@@ -98,6 +101,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.BrowsableAttribute(true)]
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)]
public override global::System.Data.SchemaSerializationMode SchemaSerializationMode {
@@ -110,6 +114,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public new global::System.Data.DataTableCollection Tables {
get {
@@ -118,6 +123,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public new global::System.Data.DataRelationCollection Relations {
get {
@@ -126,6 +132,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void InitializeDerivedDataSet() {
this.BeginInit();
this.InitClass();
@@ -133,6 +140,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public override global::System.Data.DataSet Clone() {
CustomStoreDataSet cln = ((CustomStoreDataSet)(base.Clone()));
cln.InitVars();
@@ -141,16 +149,19 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override bool ShouldSerializeTables() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override bool ShouldSerializeRelations() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) {
if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) {
this.Reset();
@@ -178,6 +189,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() {
global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream();
this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null));
@@ -186,11 +198,13 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal void InitVars() {
this.InitVars(true);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal void InitVars(bool initTable) {
this.tableAssociation = ((AssociationDataTable)(base.Tables["Association"]));
if ((initTable == true)) {
@@ -207,6 +221,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private void InitClass() {
this.DataSetName = "CustomStoreDataSet";
this.Prefix = "";
@@ -220,16 +235,19 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private bool ShouldSerializeAssociation() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private bool ShouldSerializeNonce() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) {
if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) {
this.InitVars();
@@ -237,6 +255,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
CustomStoreDataSet ds = new CustomStoreDataSet();
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
@@ -282,14 +301,15 @@ namespace OpenIdProviderWebForms.Code {
return type;
}
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public delegate void AssociationRowChangeEventHandler(object sender, AssociationRowChangeEvent e);
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public delegate void NonceRowChangeEventHandler(object sender, NonceRowChangeEvent e);
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class AssociationDataTable : global::System.Data.TypedTableBase<AssociationRow> {
@@ -303,6 +323,7 @@ namespace OpenIdProviderWebForms.Code {
private global::System.Data.DataColumn columnPrivateData;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationDataTable() {
this.TableName = "Association";
this.BeginInit();
@@ -311,6 +332,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal AssociationDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
@@ -327,12 +349,14 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected AssociationDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn DistinguishingFactorColumn {
get {
return this.columnDistinguishingFactor;
@@ -340,6 +364,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn HandleColumn {
get {
return this.columnHandle;
@@ -347,6 +372,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn ExpiresColumn {
get {
return this.columnExpires;
@@ -354,6 +380,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn PrivateDataColumn {
get {
return this.columnPrivateData;
@@ -361,6 +388,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
@@ -369,26 +397,33 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow this[int index] {
get {
return ((AssociationRow)(this.Rows[index]));
}
}
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event AssociationRowChangeEventHandler AssociationRowChanging;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event AssociationRowChangeEventHandler AssociationRowChanged;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event AssociationRowChangeEventHandler AssociationRowDeleting;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event AssociationRowChangeEventHandler AssociationRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public void AddAssociationRow(AssociationRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow AddAssociationRow(string DistinguishingFactor, string Handle, System.DateTime Expires, byte[] PrivateData) {
AssociationRow rowAssociationRow = ((AssociationRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
@@ -402,6 +437,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow FindByDistinguishingFactorHandle(string DistinguishingFactor, string Handle) {
return ((AssociationRow)(this.Rows.Find(new object[] {
DistinguishingFactor,
@@ -409,6 +445,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public override global::System.Data.DataTable Clone() {
AssociationDataTable cln = ((AssociationDataTable)(base.Clone()));
cln.InitVars();
@@ -416,11 +453,13 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new AssociationDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal void InitVars() {
this.columnDistinguishingFactor = base.Columns["DistinguishingFactor"];
this.columnHandle = base.Columns["Handle"];
@@ -429,6 +468,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private void InitClass() {
this.columnDistinguishingFactor = new global::System.Data.DataColumn("DistinguishingFactor", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDistinguishingFactor);
@@ -448,21 +488,25 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow NewAssociationRow() {
return ((AssociationRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new AssociationRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(AssociationRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.AssociationRowChanged != null)) {
@@ -471,6 +515,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.AssociationRowChanging != null)) {
@@ -479,6 +524,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.AssociationRowDeleted != null)) {
@@ -487,6 +533,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.AssociationRowDeleting != null)) {
@@ -495,11 +542,13 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public void RemoveAssociationRow(AssociationRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
@@ -565,7 +614,6 @@ namespace OpenIdProviderWebForms.Code {
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class NonceDataTable : global::System.Data.TypedTableBase<NonceRow> {
@@ -579,6 +627,7 @@ namespace OpenIdProviderWebForms.Code {
private global::System.Data.DataColumn columnExpires;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceDataTable() {
this.TableName = "Nonce";
this.BeginInit();
@@ -587,6 +636,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal NonceDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
@@ -603,12 +653,14 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected NonceDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn ContextColumn {
get {
return this.columnContext;
@@ -616,6 +668,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn CodeColumn {
get {
return this.columnCode;
@@ -623,6 +676,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn IssuedColumn {
get {
return this.columnIssued;
@@ -630,6 +684,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn ExpiresColumn {
get {
return this.columnExpires;
@@ -637,6 +692,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
@@ -645,26 +701,33 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow this[int index] {
get {
return ((NonceRow)(this.Rows[index]));
}
}
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event NonceRowChangeEventHandler NonceRowChanging;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event NonceRowChangeEventHandler NonceRowChanged;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event NonceRowChangeEventHandler NonceRowDeleting;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event NonceRowChangeEventHandler NonceRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public void AddNonceRow(NonceRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow AddNonceRow(string Context, string Code, System.DateTime Issued, System.DateTime Expires) {
NonceRow rowNonceRow = ((NonceRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
@@ -678,6 +741,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow FindByIssuedCodeContext(System.DateTime Issued, string Code, string Context) {
return ((NonceRow)(this.Rows.Find(new object[] {
Issued,
@@ -686,6 +750,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public override global::System.Data.DataTable Clone() {
NonceDataTable cln = ((NonceDataTable)(base.Clone()));
cln.InitVars();
@@ -693,11 +758,13 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new NonceDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal void InitVars() {
this.columnContext = base.Columns["Context"];
this.columnCode = base.Columns["Code"];
@@ -706,6 +773,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private void InitClass() {
this.columnContext = new global::System.Data.DataColumn("Context", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnContext);
@@ -726,21 +794,25 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow NewNonceRow() {
return ((NonceRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new NonceRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(NonceRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.NonceRowChanged != null)) {
@@ -749,6 +821,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.NonceRowChanging != null)) {
@@ -757,6 +830,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.NonceRowDeleted != null)) {
@@ -765,6 +839,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.NonceRowDeleting != null)) {
@@ -773,11 +848,13 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public void RemoveNonceRow(NonceRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
@@ -843,18 +920,19 @@ namespace OpenIdProviderWebForms.Code {
/// <summary>
///Represents strongly named DataRow class.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
public partial class AssociationRow : global::System.Data.DataRow {
private AssociationDataTable tableAssociation;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal AssociationRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableAssociation = ((AssociationDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public string DistinguishingFactor {
get {
return ((string)(this[this.tableAssociation.DistinguishingFactorColumn]));
@@ -865,6 +943,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public string Handle {
get {
return ((string)(this[this.tableAssociation.HandleColumn]));
@@ -875,6 +954,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public System.DateTime Expires {
get {
return ((global::System.DateTime)(this[this.tableAssociation.ExpiresColumn]));
@@ -885,6 +965,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public byte[] PrivateData {
get {
return ((byte[])(this[this.tableAssociation.PrivateDataColumn]));
@@ -898,18 +979,19 @@ namespace OpenIdProviderWebForms.Code {
/// <summary>
///Represents strongly named DataRow class.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
public partial class NonceRow : global::System.Data.DataRow {
private NonceDataTable tableNonce;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal NonceRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableNonce = ((NonceDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public string Context {
get {
return ((string)(this[this.tableNonce.ContextColumn]));
@@ -920,6 +1002,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public string Code {
get {
return ((string)(this[this.tableNonce.CodeColumn]));
@@ -930,6 +1013,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public System.DateTime Issued {
get {
return ((global::System.DateTime)(this[this.tableNonce.IssuedColumn]));
@@ -940,6 +1024,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public System.DateTime Expires {
get {
return ((global::System.DateTime)(this[this.tableNonce.ExpiresColumn]));
@@ -953,7 +1038,7 @@ namespace OpenIdProviderWebForms.Code {
/// <summary>
///Row event argument class
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public class AssociationRowChangeEvent : global::System.EventArgs {
private AssociationRow eventRow;
@@ -961,12 +1046,14 @@ namespace OpenIdProviderWebForms.Code {
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRowChangeEvent(AssociationRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow Row {
get {
return this.eventRow;
@@ -974,6 +1061,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
@@ -984,7 +1072,7 @@ namespace OpenIdProviderWebForms.Code {
/// <summary>
///Row event argument class
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public class NonceRowChangeEvent : global::System.EventArgs {
private NonceRow eventRow;
@@ -992,12 +1080,14 @@ namespace OpenIdProviderWebForms.Code {
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRowChangeEvent(NonceRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow Row {
get {
return this.eventRow;
@@ -1005,6 +1095,7 @@ namespace OpenIdProviderWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
diff --git a/samples/OpenIdProviderWebForms/OpenIdProviderWebForms.csproj b/samples/OpenIdProviderWebForms/OpenIdProviderWebForms.csproj
index ffb0f2f..a78cf26 100644
--- a/samples/OpenIdProviderWebForms/OpenIdProviderWebForms.csproj
+++ b/samples/OpenIdProviderWebForms/OpenIdProviderWebForms.csproj
@@ -1,4 +1,5 @@
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -11,6 +12,11 @@
<RootNamespace>OpenIdProviderWebForms</RootNamespace>
<AssemblyName>OpenIdProviderWebForms</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -20,6 +26,7 @@
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -28,6 +35,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CodeAnalysis|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -38,6 +46,7 @@
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
@@ -45,28 +54,21 @@
<HintPath>..\..\lib\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
- <Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
+ <Reference Include="System.Core" />
<Reference Include="System.Data" />
- <Reference Include="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
+ <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
- <Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
+ <Reference Include="System.Web.Extensions" />
+ <Reference Include="System.Web.Extensions.Design" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
- <Reference Include="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Web.ApplicationServices">
+ <RequiredTargetFramework>v4.0</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -159,7 +161,6 @@
</ItemGroup>
<ItemGroup>
<Content Include="favicon.ico" />
- <Content Include="images\dotnetopenid_tiny.gif" />
<Content Include="Site.Master" />
<Content Include="styles.css" />
<Content Include="TracePage.aspx" />
@@ -177,6 +178,7 @@
<None Include="Code\CustomStoreDataSet.xss">
<DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
</None>
+ <Content Include="images\DotNetOpenAuth.png" />
<Content Include="Provider.ashx" />
</ItemGroup>
<ItemGroup>
@@ -184,9 +186,13 @@
<Project>{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}</Project>
<Name>DotNetOpenAuth</Name>
</ProjectReference>
+ <ProjectReference Include="..\DotNetOpenAuth.ApplicationBlock\DotNetOpenAuth.ApplicationBlock.csproj">
+ <Project>{AA78D112-D889-414B-A7D4-467B34C7B663}</Project>
+ <Name>DotNetOpenAuth.ApplicationBlock</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
diff --git a/samples/OpenIdProviderWebForms/Site.Master b/samples/OpenIdProviderWebForms/Site.Master
index 4df9e0a..bc4f933 100644
--- a/samples/OpenIdProviderWebForms/Site.Master
+++ b/samples/OpenIdProviderWebForms/Site.Master
@@ -10,7 +10,7 @@
<body>
<form id="form1" runat="server">
<div><a href="http://dotnetopenauth.net">
- <img runat="server" src="~/images/dotnetopenid_tiny.gif" title="Jump to the project web site."
+ <img runat="server" src="~/images/DotNetOpenAuth.png" title="Jump to the project web site."
alt="DotNetOpenAuth" border='0' /></a> </div>
<div>
<asp:ContentPlaceHolder ID="Main" runat="server" />
diff --git a/samples/OpenIdProviderWebForms/Web.config b/samples/OpenIdProviderWebForms/Web.config
index 9cacf9d..de92621 100644
--- a/samples/OpenIdProviderWebForms/Web.config
+++ b/samples/OpenIdProviderWebForms/Web.config
@@ -62,6 +62,11 @@
<reporting enabled="true" />
</dotNetOpenAuth>
+ <appSettings>
+ <!-- Get your own Yubico API key here: https://upgrade.yubico.com/getapikey/ -->
+ <add key="YubicoAPIKey" value="3961"/>
+ </appSettings>
+
<system.web>
<!--
Set compilation debug="true" to insert debugging
@@ -86,14 +91,14 @@
</providers>
</membership>
<authentication mode="Forms">
- <forms name="ProviderSession"/>
<!-- named cookie prevents conflicts with other samples -->
+ <forms name="OpenIdProviderWebForms"/>
</authentication>
<customErrors mode="RemoteOnly"/>
<!-- Trust level discussion:
- Full: everything works
+ Full: everything works (this is required for Google Apps for Domains support)
High: TRACE compilation symbol must NOT be defined
- Medium: doesn't work unless originUrl=".*" or WebPermission.Connect is extended.
+ Medium: doesn't work unless originUrl=".*" or WebPermission.Connect is extended, and Google Apps doesn't work.
Low: doesn't work because WebPermission.Connect is denied.
-->
<trust level="Medium" originUrl=".*"/>
diff --git a/samples/OpenIdProviderWebForms/decide.aspx.cs b/samples/OpenIdProviderWebForms/decide.aspx.cs
index b392d85..40c17c0 100644
--- a/samples/OpenIdProviderWebForms/decide.aspx.cs
+++ b/samples/OpenIdProviderWebForms/decide.aspx.cs
@@ -50,7 +50,12 @@ namespace OpenIdProviderWebForms {
this.profileFields.SetRequiredFieldsFromRequest(requestedFields);
if (!IsPostBack) {
var sregResponse = requestedFields.CreateResponse();
- sregResponse.Email = Membership.GetUser().Email;
+
+ // We MAY not have an entry for this user if they used Yubikey to log in.
+ MembershipUser user = Membership.GetUser();
+ if (user != null) {
+ sregResponse.Email = Membership.GetUser().Email;
+ }
this.profileFields.SetOpenIdProfileFields(sregResponse);
}
}
diff --git a/samples/OpenIdProviderWebForms/favicon.ico b/samples/OpenIdProviderWebForms/favicon.ico
index beb3cb5..e227dbe 100644
--- a/samples/OpenIdProviderWebForms/favicon.ico
+++ b/samples/OpenIdProviderWebForms/favicon.ico
Binary files differ
diff --git a/samples/OpenIdProviderWebForms/images/DotNetOpenAuth.png b/samples/OpenIdProviderWebForms/images/DotNetOpenAuth.png
new file mode 100644
index 0000000..442b986
--- /dev/null
+++ b/samples/OpenIdProviderWebForms/images/DotNetOpenAuth.png
Binary files differ
diff --git a/samples/OpenIdProviderWebForms/images/dotnetopenid_tiny.gif b/samples/OpenIdProviderWebForms/images/dotnetopenid_tiny.gif
deleted file mode 100644
index c4ed4f5..0000000
--- a/samples/OpenIdProviderWebForms/images/dotnetopenid_tiny.gif
+++ /dev/null
Binary files differ
diff --git a/samples/OpenIdProviderWebForms/login.aspx b/samples/OpenIdProviderWebForms/login.aspx
index e8f42c5..f7898cc 100644
--- a/samples/OpenIdProviderWebForms/login.aspx
+++ b/samples/OpenIdProviderWebForms/login.aspx
@@ -14,4 +14,14 @@
<tr><td>bob3</td><td>test</td></tr>
<tr><td>bob4</td><td>test</td></tr>
</table>
+
+ <asp:Panel DefaultButton="yubicoButton" runat="server" style="margin-top: 25px" ID="yubicoPanel">
+ Login with Yubikey:
+ <asp:TextBox runat="server" type="text" ID="yubicoBox" ToolTip="Click here and press your Yubikey button."
+ style="background-image: url(http://yubico.com/favicon.ico); background-repeat: no-repeat; background-position: 0px 1px; padding-left: 18px; width: 20em;"
+ MaxLength="44" AutoCompleteType="Disabled" />
+ <asp:Button runat="server" ID="yubicoButton" Text="Login"
+ onclick="yubicoButton_Click" />
+ <asp:Label Text="[Yubikey Result]" runat="server" EnableViewState="false" Visible="false" ForeColor="Red" ID="yubikeyFailureLabel" />
+ </asp:Panel>
</asp:Content> \ No newline at end of file
diff --git a/samples/OpenIdProviderWebForms/login.aspx.cs b/samples/OpenIdProviderWebForms/login.aspx.cs
index 4051877..ef5b2c4 100644
--- a/samples/OpenIdProviderWebForms/login.aspx.cs
+++ b/samples/OpenIdProviderWebForms/login.aspx.cs
@@ -1,6 +1,10 @@
namespace OpenIdProviderWebForms {
using System;
+ using System.Configuration;
+ using System.Globalization;
+ using System.Web.Security;
using System.Web.UI.WebControls;
+ using DotNetOpenAuth.ApplicationBlock;
using DotNetOpenAuth.OpenId.Provider;
/// <summary>
@@ -9,6 +13,8 @@ namespace OpenIdProviderWebForms {
public partial class login : System.Web.UI.Page {
protected void Page_Load(object src, EventArgs e) {
if (!IsPostBack) {
+ this.yubicoPanel.Visible = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["YubicoAPIKey"]);
+
if (ProviderEndpoint.PendingAuthenticationRequest != null &&
!ProviderEndpoint.PendingAuthenticationRequest.IsDirectedIdentity) {
this.login1.UserName = Code.Util.ExtractUserName(
@@ -18,5 +24,27 @@ namespace OpenIdProviderWebForms {
}
}
}
+
+ protected void yubicoButton_Click(object sender, EventArgs e) {
+ string username;
+ if (this.TryVerifyYubikeyAndGetUsername(this.yubicoBox.Text, out username)) {
+ FormsAuthentication.RedirectFromLoginPage(username, false);
+ }
+ }
+
+ private bool TryVerifyYubikeyAndGetUsername(string token, out string username) {
+ var yubikey = new YubikeyRelyingParty(int.Parse(ConfigurationManager.AppSettings["YubicoAPIKey"], CultureInfo.InvariantCulture));
+ YubikeyResult result = yubikey.IsValid(token);
+ switch (result) {
+ case YubikeyResult.Ok:
+ username = YubikeyRelyingParty.ExtractUsername(token);
+ return true;
+ default:
+ this.yubikeyFailureLabel.Visible = true;
+ this.yubikeyFailureLabel.Text = result.ToString();
+ username = null;
+ return false;
+ }
+ }
}
} \ No newline at end of file
diff --git a/samples/OpenIdProviderWebForms/login.aspx.designer.cs b/samples/OpenIdProviderWebForms/login.aspx.designer.cs
index 83826a1..307dd96 100644
--- a/samples/OpenIdProviderWebForms/login.aspx.designer.cs
+++ b/samples/OpenIdProviderWebForms/login.aspx.designer.cs
@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.3521
//
// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
+// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@@ -21,5 +20,41 @@ namespace OpenIdProviderWebForms {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Login login1;
+
+ /// <summary>
+ /// yubicoPanel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Panel yubicoPanel;
+
+ /// <summary>
+ /// yubicoBox control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.TextBox yubicoBox;
+
+ /// <summary>
+ /// yubicoButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button yubicoButton;
+
+ /// <summary>
+ /// yubikeyFailureLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label yubikeyFailureLabel;
}
}
diff --git a/samples/OpenIdRelyingPartyClassicAsp/MembersOnly.asp b/samples/OpenIdRelyingPartyClassicAsp/MembersOnly.asp
index da6c18b..9f5917e 100644
--- a/samples/OpenIdRelyingPartyClassicAsp/MembersOnly.asp
+++ b/samples/OpenIdRelyingPartyClassicAsp/MembersOnly.asp
@@ -12,7 +12,7 @@ End If
<body>
<div>
<a href="http://dotnetopenauth.net">
- <img runat="server" src="images/DotNetOpenId_tiny.gif" title="Jump to the project web site."
+ <img runat="server" src="images/DotNetOpenAuth.png" title="Jump to the project web site."
alt="DotNetOpenAuth" border='0' /></a>
</div>
<h2>
diff --git a/samples/OpenIdRelyingPartyClassicAsp/default.asp b/samples/OpenIdRelyingPartyClassicAsp/default.asp
index f4d1d1d..cc2bd57 100644
--- a/samples/OpenIdRelyingPartyClassicAsp/default.asp
+++ b/samples/OpenIdRelyingPartyClassicAsp/default.asp
@@ -7,7 +7,7 @@
<body>
<div>
<a href="http://dotnetopenauth.net">
- <img runat="server" src="images/DotNetOpenId_tiny.gif" title="Jump to the project web site."
+ <img runat="server" src="images/DotNetOpenAuth.png" title="Jump to the project web site."
alt="DotNetOpenAuth" border='0' /></a>
</div>
<h2>Classic ASP OpenID Relying Party</h2>
diff --git a/samples/OpenIdRelyingPartyClassicAsp/favicon.ico b/samples/OpenIdRelyingPartyClassicAsp/favicon.ico
new file mode 100644
index 0000000..e227dbe
--- /dev/null
+++ b/samples/OpenIdRelyingPartyClassicAsp/favicon.ico
Binary files differ
diff --git a/samples/OpenIdRelyingPartyClassicAsp/images/DotNetOpenAuth.png b/samples/OpenIdRelyingPartyClassicAsp/images/DotNetOpenAuth.png
new file mode 100644
index 0000000..442b986
--- /dev/null
+++ b/samples/OpenIdRelyingPartyClassicAsp/images/DotNetOpenAuth.png
Binary files differ
diff --git a/samples/OpenIdRelyingPartyClassicAsp/images/dotnetopenid_tiny.gif b/samples/OpenIdRelyingPartyClassicAsp/images/dotnetopenid_tiny.gif
deleted file mode 100644
index c4ed4f5..0000000
--- a/samples/OpenIdRelyingPartyClassicAsp/images/dotnetopenid_tiny.gif
+++ /dev/null
Binary files differ
diff --git a/samples/OpenIdRelyingPartyClassicAsp/images/openid_login.gif b/samples/OpenIdRelyingPartyClassicAsp/images/openid_login.gif
deleted file mode 100644
index cde836c..0000000
--- a/samples/OpenIdRelyingPartyClassicAsp/images/openid_login.gif
+++ /dev/null
Binary files differ
diff --git a/samples/OpenIdRelyingPartyClassicAsp/images/openid_login.png b/samples/OpenIdRelyingPartyClassicAsp/images/openid_login.png
new file mode 100644
index 0000000..caebd58
--- /dev/null
+++ b/samples/OpenIdRelyingPartyClassicAsp/images/openid_login.png
Binary files differ
diff --git a/samples/OpenIdRelyingPartyClassicAsp/login.asp b/samples/OpenIdRelyingPartyClassicAsp/login.asp
index 449af3e..18c4d4f 100644
--- a/samples/OpenIdRelyingPartyClassicAsp/login.asp
+++ b/samples/OpenIdRelyingPartyClassicAsp/login.asp
@@ -7,7 +7,7 @@
<body>
<div>
<a href="http://dotnetopenauth.net">
- <img runat="server" src="images/DotNetOpenId_tiny.gif" title="Jump to the project web site."
+ <img runat="server" src="images/DotNetOpenAuth.png" title="Jump to the project web site."
alt="DotNetOpenAuth" border='0' /></a>
</div>
<h2>Login Page</h2>
diff --git a/samples/OpenIdRelyingPartyClassicAsp/styles.css b/samples/OpenIdRelyingPartyClassicAsp/styles.css
index d777e33..c9d471b 100644
--- a/samples/OpenIdRelyingPartyClassicAsp/styles.css
+++ b/samples/OpenIdRelyingPartyClassicAsp/styles.css
@@ -16,7 +16,7 @@ body
input.openid
{
- background-image: url(images/openid_login.gif);
+ background-image: url(images/openid_login.png);
background-repeat: no-repeat;
background-position: 0 50%;
padding-left: 15px;
diff --git a/samples/OpenIdRelyingPartyMvc/Content/images/openid.gif b/samples/OpenIdRelyingPartyMvc/Content/images/openid.gif
deleted file mode 100644
index c718b0e..0000000
--- a/samples/OpenIdRelyingPartyMvc/Content/images/openid.gif
+++ /dev/null
Binary files differ
diff --git a/samples/OpenIdRelyingPartyMvc/Content/images/openid.png b/samples/OpenIdRelyingPartyMvc/Content/images/openid.png
new file mode 100644
index 0000000..bf25c16
--- /dev/null
+++ b/samples/OpenIdRelyingPartyMvc/Content/images/openid.png
Binary files differ
diff --git a/samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs b/samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs
index b3698bb..3ff405f 100644
--- a/samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs
+++ b/samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs
@@ -20,10 +20,6 @@
return View("Index");
}
- public ActionResult LoginPopup() {
- return View("LoginPopup");
- }
-
public ActionResult Logout() {
FormsAuthentication.SignOut();
return Redirect("~/Home");
diff --git a/samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj b/samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj
index a6fab7c..a3c7b78 100644
--- a/samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj
+++ b/samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj
@@ -1,16 +1,18 @@
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{07B193F1-68AD-4E9C-98AF-BEFB5E9403CB}</ProjectGuid>
- <ProjectTypeGuids>{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenIdRelyingPartyMvc</RootNamespace>
<AssemblyName>OpenIdRelyingPartyMvc</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <MvcBuildViews>false</MvcBuildViews>
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -20,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -28,39 +31,31 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web.DynamicData" />
+ <Reference Include="System.Web.Entity" />
+ <Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\System.Web.Abstractions.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\System.Web.Mvc.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\System.Web.Routing.dll</HintPath>
- </Reference>
- <Reference Include="System.Xml.Linq">
+ <Reference Include="System.Web.Mvc" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Web.Extensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Drawing" />
- <Reference Include="System.Web" />
- <Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
+ <Reference Include="System.Web.Abstractions" />
+ <Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
+ <Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\HomeController.cs" />
@@ -82,7 +77,7 @@
<Content Include="Content\images\aol.gif" />
<Content Include="Content\images\facebook.gif" />
<Content Include="Content\images\google.gif" />
- <Content Include="Content\images\openid.gif" />
+ <Content Include="Content\images\openid.png" />
<Content Include="Content\images\openid_small.gif" />
<Content Include="Content\images\yahoo.gif" />
<Content Include="Content\scripts\jquery-1.3.1.js" />
@@ -116,10 +111,10 @@
<Content Include="Content\theme\ui.tabs.css" />
<Content Include="Content\theme\ui.theme.css" />
<Content Include="Default.aspx" />
+ <Content Include="favicon.ico" />
<Content Include="Global.asax" />
<Content Include="Views\User\Index.aspx" />
<Content Include="Views\User\Login.aspx" />
- <Content Include="Views\User\LoginPopup.aspx" />
<Content Include="Web.config" />
<Content Include="Content\Site.css" />
<Content Include="Views\Home\Index.aspx" />
@@ -138,14 +133,14 @@
<Folder Include="Models\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
+ </Target> -->
+ <Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
+ <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
</Target>
- <Target Name="AfterBuild">
- </Target>
- -->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
diff --git a/samples/OpenIdRelyingPartyMvc/Views/Home/Index.aspx b/samples/OpenIdRelyingPartyMvc/Views/Home/Index.aspx
index be4bd20..ba9ddfd 100644
--- a/samples/OpenIdRelyingPartyMvc/Views/Home/Index.aspx
+++ b/samples/OpenIdRelyingPartyMvc/Views/Home/Index.aspx
@@ -11,6 +11,5 @@
<p>Visit the
<%=Html.ActionLink("Members Only", "Index", "User") %>
area to trigger a login. </p>
- <p>Optionally, you can try out the <%=Html.ActionLink("JQuery login popup UX", "LoginPopup", "User")%>. </p>
<% } %>
</asp:Content>
diff --git a/samples/OpenIdRelyingPartyMvc/Views/User/LoginPopup.aspx b/samples/OpenIdRelyingPartyMvc/Views/User/LoginPopup.aspx
deleted file mode 100644
index 2f4b276..0000000
--- a/samples/OpenIdRelyingPartyMvc/Views/User/LoginPopup.aspx
+++ /dev/null
@@ -1,207 +0,0 @@
-<%@ Page Title="Popup Login sample" Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
-
-<!-- COPYRIGHT (C) 2009 Andrew Arnott. All rights reserved. -->
-<!-- LICENSE: Microsoft Public License available at http://opensource.org/licenses/ms-pl.html -->
-
-<html>
-<head>
- <title>OpenID login demo</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <link type="text/css" href='<%= Url.Content("~/Content/theme/ui.all.css") %>' rel="Stylesheet" />
- <link type="text/css" href='<%= Url.Content("~/Content/css/openidlogin.css") %>' rel="stylesheet" />
- <script type="text/javascript" src='<%= Url.Content("~/Content/scripts/jquery-1.3.1.js") %>'></script>
- <script type="text/javascript" src='<%= Url.Content("~/Content/scripts/jquery-ui-personalized-1.6rc6.js") %>'></script>
- <script>
- $(function() {
- $('#openidlogin').dialog({
- bgiframe: true,
-// autoOpen: true,
- modal: true,
- title: 'Login or Create new account',
- resizable: false,
- hide: 'clip',
- width: '420px',
- buttons: { },
- closeOnEscape: true,
- focus: function(event, ui) {
- var box = $('#openid_identifier')[0];
- if (box.style.display != 'none') {
- box.focus();
- }
- }
- });
-
- $('#loggedOut').dialog({
- bgiframe: true,
- autoOpen: false,
- title: 'Logged out',
- resizable: false,
- closeOnEscape: true,
- buttons: {
- "Ok": function() { $(this).dialog('close'); }
- }
- });
-
- $('#loginAction').click(function() {
- $('#openidlogin').dialog('open');
- return false;
- });
-
- $('#logoutAction').click(function() {
- // TODO: asynchronously log out.
- document.setClaimedIdentifier();
- //$('#loggedOut').dialog('open');
- return false;
- });
-
- //hover states on the static widgets
- $('.ui-button, ul#icons li').hover(
- function() { $(this).addClass('ui-state-hover'); },
- function() { $(this).removeClass('ui-state-hover'); }
- );
-
- document.usernamePlaceholder = "{username}";
-
- function isCompleteIdentifier(identifier) {
- return identifier && identifier != '' && identifier != 'http://' && identifier.indexOf(document.usernamePlaceholder) < 0;
- };
-
- function setSelection() {
- var box = $('#openid_identifier')[0];
- var usernamePlaceholderIndex = box.value.indexOf(document.usernamePlaceholder);
- if (usernamePlaceholderIndex >= 0) {
- box.setSelectionRange(usernamePlaceholderIndex + document.usernamePlaceholder.length);
- box.setSelectionRange(usernamePlaceholderIndex, usernamePlaceholderIndex + document.usernamePlaceholder.length);
- }
- };
-
- function completeLogin() {
- var box = $('#openid_identifier')[0];
- if (box.value.indexOf(document.usernamePlaceholder) >= 0) {
- alert('You need to type in your username first.');
- box.focus();
- setSelection();
- return;
- }
-
- if (!isCompleteIdentifier(box.value)) {
- alert(box.value + ' is not a valid identifier.');
- return;
- }
-
- var box = $('#openid_identifier')[0];
- $('#openidlogin').dialog('close');
- document.setClaimedIdentifier(box.value);
- $('#loginForm').submit();
- return box.value;
- };
-
- document.selectProvider = function(button, identifierTemplate) {
- var box = $('#openid_identifier')[0];
- $('#openidlogin .provider').removeClass('highlight');
- if (isCompleteIdentifier(identifierTemplate)) {
- box.value = identifierTemplate;
- $('#openidlogin .inputbox').slideUp();
- completeLogin();
- } else {
- if (this.lastIdentifierTemplate == identifierTemplate) {
- $('#openidlogin .inputbox').slideToggle();
- } else {
- $(button).addClass('highlight').show();
- $('#openidlogin .inputbox').slideDown();
- box.value = identifierTemplate;
- if (box.value == null || box.value == '') {
- box.value = 'http://';
- }
-
- setSelection();
- }
-
- box.focus();
- }
- this.lastIdentifierTemplate = identifierTemplate;
- };
-
- $('#loginButton').click(function() {
- completeLogin();
- return true;
- });
-
- document.openid_identifier_keydown = function(e) {
- if (window.event && window.event.keyCode == 13) {
- $('#loginButton').effect('highlight');
- completeLogin();
- }
- };
-
- document.setClaimedIdentifier = function(identifier) {
- if (identifier) {
- // Apply login
- $('#loginAction').hide();
- $('#logoutAction').show();
- } else {
- // Apply logout
- $('#loginAction').show();
- $('#logoutAction').hide();
- }
- $('#claimedIdentifierLabel')[0].innerText = identifier ? identifier : '';
- };
-
- $('#logoutAction').hide();
- });
- </script>
-
- <style>
- body{ font: 62.5% "Trebuchet MS", sans-serif;}
- .ui-button {padding: .4em .5em .4em 20px;text-decoration: none;position: relative;}
- .ui-button span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
- #loginButton {padding: 0.1em 0.4em 0.1em 20px}
- </style>
-</head>
-<body>
-
-<div style="margin-top: 10px">
- <p style="float: right; margin-top: 0px">
- <a href="#" id="loginAction" class="ui-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-locked"></span>Login / New user</a>
- <a href="#" id="logoutAction" class="ui-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-unlocked"></span>Logout</a>
- </p>
- <p style="text-align: center; margin-top: 3px; font-family: Arial" id="claimedIdentifierLabel"/>
-</div>
-
-<div id="openidlogin" class="ui-widget-content">
- <p>Log in with an account you already use:</p>
- <div class="large buttons">
- <div class="provider" onclick="document.selectProvider(this, 'https://www.google.com/accounts/o8/id')"><div><img src='<%= Url.Content("~/Content/images/google.gif") %>'/></div></div>
- <div class="provider" onclick="document.selectProvider(this, 'https://me.yahoo.com/')"><div><img src='<%= Url.Content("~/Content/images/yahoo.gif") %>'/></div></div>
- <div class="provider" onclick="document.selectProvider(this, 'http://openid.aol.com/{username}')"><div><img src='<%= Url.Content("~/Content/images/aol.gif") %>'/></div></div>
- <div class="provider" onclick="document.selectProvider(this, '')"><div><img src='<%= Url.Content("~/Content/images/openid.gif") %>'/></div></div>
- </div>
- <div class="small buttons">
- <div class="provider" onclick="document.selectProvider(this, 'http://www.flickr.com/photos/{username}')"><div><img src="http://flickr.com/favicon.ico"/></div></div>
- <div class="provider" onclick="document.selectProvider(this, 'https://www.myopenid.com/')"><div><img src="http://myopenid.com/favicon.ico"/></div></div>
- <div class="provider" onclick="document.selectProvider(this, 'http://{username}.livejournal.com/')"><div><img src="http://www.livejournal.com/favicon.ico"/></div></div>
- <div class="provider" onclick="document.selectProvider(this, 'https://technorati.com/people/technorati/{username}/')"><div><img src="http://technorati.com/favicon.ico"/></div></div>
- <div class="provider" onclick="document.selectProvider(this, 'https://{username}.wordpress.com/')"><div><img src="http://www.wordpress.com/favicon.ico"/></div></div>
- <div class="provider" onclick="document.selectProvider(this, 'http://{username}.blogspot.com/')"><div><img src="http://blogspot.com/favicon.ico"/></div></div>
- <div class="provider" onclick="document.selectProvider(this, 'https://myvidoop.com/')"><div><img src="http://www.myvidoop.com/favicon.ico"/></div></div>
- <div class="provider" onclick="document.selectProvider(this, 'https://pip.verisignlabs.com/')"><div><img src="http://pip.verisignlabs.com/favicon.ico"/></div></div>
- </div>
- <% Html.BeginForm("Authenticate", "User", FormMethod.Post, new { id = "loginForm" }); %>
- <div class="inputbox">
- <input type="text" id="openid_identifier" name="openid_identifier" onKeyDown="document.openid_identifier_keydown(this)" onFocus="$('#loginButton').addClass('ui-state-hover')" onBlur="$('#loginButton').removeClass('ui-state-hover')" />
- <a href="#" id="loginButton" class="ui-button ui-state-default ui-corner-all" style="color: white; font-size: 10pt"><span class="ui-icon ui-icon-key"></span>Login</a>
- </div>
- <% Html.EndForm(); %>
- <p><a href="javascript:$('#openidlogin .help').slideToggle()">Get help logging in</a></p>
- <div class="help">
- <p>If you don't have an account with any of these services, you can
- <a href="https://www.myopenid.com/signup" target="OpenIdProvider">create one</a>.
- <p>If you have logged into this site previously, click the same button you did last time.</p>
- </div>
-</div>
-
-<div id="loggedOut" class="ui-widget-content">
- <p>You have been logged out.</p>
-</div>
-</body>
-</html> \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyMvc/Views/Web.config b/samples/OpenIdRelyingPartyMvc/Views/Web.config
index e67c0eb..04ff474 100644
--- a/samples/OpenIdRelyingPartyMvc/Views/Web.config
+++ b/samples/OpenIdRelyingPartyMvc/Views/Web.config
@@ -2,19 +2,18 @@
<configuration>
<system.web>
<httpHandlers>
- <remove verb="*" path="*.aspx"/>
- <add path="*.aspx" verb="*"
- type="System.Web.HttpNotFoundHandler"/>
+ <remove verb="*" path="*.aspx" />
+ <add path="*.aspx" verb="*" type="System.Web.HttpNotFoundHandler" />
</httpHandlers>
</system.web>
<system.webServer>
- <validation validateIntegratedModeConfiguration="false"/>
+ <validation validateIntegratedModeConfiguration="false" />
<handlers>
- <remove name="PageHandlerFactory-ISAPI-2.0"/>
- <remove name="PageHandlerFactory-ISAPI-1.1"/>
- <remove name="PageHandlerFactory-Integrated"/>
- <add name="BlockViewHandler" path="*.aspx" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
+ <remove name="PageHandlerFactory-ISAPI-2.0" />
+ <remove name="PageHandlerFactory-ISAPI-1.1" />
+ <remove name="PageHandlerFactory-Integrated" />
+ <add name="BlockViewHandler" path="*.aspx" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>
diff --git a/samples/OpenIdRelyingPartyMvc/Web.config b/samples/OpenIdRelyingPartyMvc/Web.config
index ac59296..8101fb2 100644
--- a/samples/OpenIdRelyingPartyMvc/Web.config
+++ b/samples/OpenIdRelyingPartyMvc/Web.config
@@ -73,7 +73,7 @@
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
@@ -120,7 +120,7 @@
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
- <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
@@ -163,12 +163,21 @@
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
</system.webServer>
<runtime>
<legacyHMACWarning enabled="0" />
+
+ <!-- When targeting ASP.NET MVC 2, this assemblyBinding makes MVC 1 references relink
+ to MVC 2 so libraries such as DotNetOpenAuth that compile against MVC 1 will work with it. -->
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
+ <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
</runtime>
</configuration>
diff --git a/samples/OpenIdRelyingPartyMvc/favicon.ico b/samples/OpenIdRelyingPartyMvc/favicon.ico
new file mode 100644
index 0000000..e227dbe
--- /dev/null
+++ b/samples/OpenIdRelyingPartyMvc/favicon.ico
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebForms/Code/CustomStoreDataSet1.Designer.cs b/samples/OpenIdRelyingPartyWebForms/Code/CustomStoreDataSet1.Designer.cs
index 0c0e194..9922a4d 100644
--- a/samples/OpenIdRelyingPartyWebForms/Code/CustomStoreDataSet1.Designer.cs
+++ b/samples/OpenIdRelyingPartyWebForms/Code/CustomStoreDataSet1.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4927
+// Runtime Version:4.0.30104.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -16,7 +16,6 @@ namespace OpenIdRelyingPartyWebForms.Code {
/// <summary>
///Represents a strongly typed in-memory cache of data.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[global::System.Serializable()]
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
@@ -32,6 +31,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public CustomStoreDataSet() {
this.BeginInit();
this.InitClass();
@@ -42,6 +42,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected CustomStoreDataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context, false) {
if ((this.IsBinarySerialized(info, context) == true)) {
@@ -80,6 +81,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public AssociationDataTable Association {
@@ -89,6 +91,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
[global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
public NonceDataTable Nonce {
@@ -98,6 +101,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.BrowsableAttribute(true)]
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)]
public override global::System.Data.SchemaSerializationMode SchemaSerializationMode {
@@ -110,6 +114,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public new global::System.Data.DataTableCollection Tables {
get {
@@ -118,6 +123,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public new global::System.Data.DataRelationCollection Relations {
get {
@@ -126,6 +132,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void InitializeDerivedDataSet() {
this.BeginInit();
this.InitClass();
@@ -133,6 +140,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public override global::System.Data.DataSet Clone() {
CustomStoreDataSet cln = ((CustomStoreDataSet)(base.Clone()));
cln.InitVars();
@@ -141,16 +149,19 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override bool ShouldSerializeTables() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override bool ShouldSerializeRelations() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) {
if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) {
this.Reset();
@@ -178,6 +189,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() {
global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream();
this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null));
@@ -186,11 +198,13 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal void InitVars() {
this.InitVars(true);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal void InitVars(bool initTable) {
this.tableAssociation = ((AssociationDataTable)(base.Tables["Association"]));
if ((initTable == true)) {
@@ -207,6 +221,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private void InitClass() {
this.DataSetName = "CustomStoreDataSet";
this.Prefix = "";
@@ -220,16 +235,19 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private bool ShouldSerializeAssociation() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private bool ShouldSerializeNonce() {
return false;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) {
if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) {
this.InitVars();
@@ -237,6 +255,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
CustomStoreDataSet ds = new CustomStoreDataSet();
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
@@ -282,14 +301,15 @@ namespace OpenIdRelyingPartyWebForms.Code {
return type;
}
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public delegate void AssociationRowChangeEventHandler(object sender, AssociationRowChangeEvent e);
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public delegate void NonceRowChangeEventHandler(object sender, NonceRowChangeEvent e);
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class AssociationDataTable : global::System.Data.TypedTableBase<AssociationRow> {
@@ -303,6 +323,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
private global::System.Data.DataColumn columnPrivateData;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationDataTable() {
this.TableName = "Association";
this.BeginInit();
@@ -311,6 +332,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal AssociationDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
@@ -327,12 +349,14 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected AssociationDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn DistinguishingFactorColumn {
get {
return this.columnDistinguishingFactor;
@@ -340,6 +364,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn HandleColumn {
get {
return this.columnHandle;
@@ -347,6 +372,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn ExpiresColumn {
get {
return this.columnExpires;
@@ -354,6 +380,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn PrivateDataColumn {
get {
return this.columnPrivateData;
@@ -361,6 +388,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
@@ -369,26 +397,33 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow this[int index] {
get {
return ((AssociationRow)(this.Rows[index]));
}
}
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event AssociationRowChangeEventHandler AssociationRowChanging;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event AssociationRowChangeEventHandler AssociationRowChanged;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event AssociationRowChangeEventHandler AssociationRowDeleting;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event AssociationRowChangeEventHandler AssociationRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public void AddAssociationRow(AssociationRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow AddAssociationRow(string DistinguishingFactor, string Handle, System.DateTime Expires, byte[] PrivateData) {
AssociationRow rowAssociationRow = ((AssociationRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
@@ -402,6 +437,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow FindByDistinguishingFactorHandle(string DistinguishingFactor, string Handle) {
return ((AssociationRow)(this.Rows.Find(new object[] {
DistinguishingFactor,
@@ -409,6 +445,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public override global::System.Data.DataTable Clone() {
AssociationDataTable cln = ((AssociationDataTable)(base.Clone()));
cln.InitVars();
@@ -416,11 +453,13 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new AssociationDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal void InitVars() {
this.columnDistinguishingFactor = base.Columns["DistinguishingFactor"];
this.columnHandle = base.Columns["Handle"];
@@ -429,6 +468,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private void InitClass() {
this.columnDistinguishingFactor = new global::System.Data.DataColumn("DistinguishingFactor", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnDistinguishingFactor);
@@ -448,21 +488,25 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow NewAssociationRow() {
return ((AssociationRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new AssociationRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(AssociationRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.AssociationRowChanged != null)) {
@@ -471,6 +515,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.AssociationRowChanging != null)) {
@@ -479,6 +524,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.AssociationRowDeleted != null)) {
@@ -487,6 +533,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.AssociationRowDeleting != null)) {
@@ -495,11 +542,13 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public void RemoveAssociationRow(AssociationRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
@@ -565,7 +614,6 @@ namespace OpenIdRelyingPartyWebForms.Code {
/// <summary>
///Represents the strongly named DataTable class.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
[global::System.Serializable()]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
public partial class NonceDataTable : global::System.Data.TypedTableBase<NonceRow> {
@@ -579,6 +627,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
private global::System.Data.DataColumn columnExpires;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceDataTable() {
this.TableName = "Nonce";
this.BeginInit();
@@ -587,6 +636,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal NonceDataTable(global::System.Data.DataTable table) {
this.TableName = table.TableName;
if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
@@ -603,12 +653,14 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected NonceDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
base(info, context) {
this.InitVars();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn ContextColumn {
get {
return this.columnContext;
@@ -616,6 +668,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn CodeColumn {
get {
return this.columnCode;
@@ -623,6 +676,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn IssuedColumn {
get {
return this.columnIssued;
@@ -630,6 +684,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataColumn ExpiresColumn {
get {
return this.columnExpires;
@@ -637,6 +692,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.Browsable(false)]
public int Count {
get {
@@ -645,26 +701,33 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow this[int index] {
get {
return ((NonceRow)(this.Rows[index]));
}
}
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event NonceRowChangeEventHandler NonceRowChanging;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event NonceRowChangeEventHandler NonceRowChanged;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event NonceRowChangeEventHandler NonceRowDeleting;
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public event NonceRowChangeEventHandler NonceRowDeleted;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public void AddNonceRow(NonceRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow AddNonceRow(string Context, string Code, System.DateTime Issued, System.DateTime Expires) {
NonceRow rowNonceRow = ((NonceRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
@@ -678,6 +741,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow FindByIssuedCodeContext(System.DateTime Issued, string Code, string Context) {
return ((NonceRow)(this.Rows.Find(new object[] {
Issued,
@@ -686,6 +750,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public override global::System.Data.DataTable Clone() {
NonceDataTable cln = ((NonceDataTable)(base.Clone()));
cln.InitVars();
@@ -693,11 +758,13 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Data.DataTable CreateInstance() {
return new NonceDataTable();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal void InitVars() {
this.columnContext = base.Columns["Context"];
this.columnCode = base.Columns["Code"];
@@ -706,6 +773,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
private void InitClass() {
this.columnContext = new global::System.Data.DataColumn("Context", typeof(string), null, global::System.Data.MappingType.Element);
base.Columns.Add(this.columnContext);
@@ -726,21 +794,25 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow NewNonceRow() {
return ((NonceRow)(this.NewRow()));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
return new NonceRow(builder);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override global::System.Type GetRowType() {
return typeof(NonceRow);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.NonceRowChanged != null)) {
@@ -749,6 +821,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.NonceRowChanging != null)) {
@@ -757,6 +830,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.NonceRowDeleted != null)) {
@@ -765,6 +839,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.NonceRowDeleting != null)) {
@@ -773,11 +848,13 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public void RemoveNonceRow(NonceRow row) {
this.Rows.Remove(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
@@ -843,18 +920,19 @@ namespace OpenIdRelyingPartyWebForms.Code {
/// <summary>
///Represents strongly named DataRow class.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
public partial class AssociationRow : global::System.Data.DataRow {
private AssociationDataTable tableAssociation;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal AssociationRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableAssociation = ((AssociationDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public string DistinguishingFactor {
get {
return ((string)(this[this.tableAssociation.DistinguishingFactorColumn]));
@@ -865,6 +943,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public string Handle {
get {
return ((string)(this[this.tableAssociation.HandleColumn]));
@@ -875,6 +954,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public System.DateTime Expires {
get {
return ((global::System.DateTime)(this[this.tableAssociation.ExpiresColumn]));
@@ -885,6 +965,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public byte[] PrivateData {
get {
return ((byte[])(this[this.tableAssociation.PrivateDataColumn]));
@@ -898,18 +979,19 @@ namespace OpenIdRelyingPartyWebForms.Code {
/// <summary>
///Represents strongly named DataRow class.
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
public partial class NonceRow : global::System.Data.DataRow {
private NonceDataTable tableNonce;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
internal NonceRow(global::System.Data.DataRowBuilder rb) :
base(rb) {
this.tableNonce = ((NonceDataTable)(this.Table));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public string Context {
get {
return ((string)(this[this.tableNonce.ContextColumn]));
@@ -920,6 +1002,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public string Code {
get {
return ((string)(this[this.tableNonce.CodeColumn]));
@@ -930,6 +1013,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public System.DateTime Issued {
get {
return ((global::System.DateTime)(this[this.tableNonce.IssuedColumn]));
@@ -940,6 +1024,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public System.DateTime Expires {
get {
return ((global::System.DateTime)(this[this.tableNonce.ExpiresColumn]));
@@ -953,7 +1038,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
/// <summary>
///Row event argument class
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public class AssociationRowChangeEvent : global::System.EventArgs {
private AssociationRow eventRow;
@@ -961,12 +1046,14 @@ namespace OpenIdRelyingPartyWebForms.Code {
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRowChangeEvent(AssociationRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public AssociationRow Row {
get {
return this.eventRow;
@@ -974,6 +1061,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
@@ -984,7 +1072,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
/// <summary>
///Row event argument class
///</summary>
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public class NonceRowChangeEvent : global::System.EventArgs {
private NonceRow eventRow;
@@ -992,12 +1080,14 @@ namespace OpenIdRelyingPartyWebForms.Code {
private global::System.Data.DataRowAction eventAction;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRowChangeEvent(NonceRow row, global::System.Data.DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public NonceRow Row {
get {
return this.eventRow;
@@ -1005,6 +1095,7 @@ namespace OpenIdRelyingPartyWebForms.Code {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public global::System.Data.DataRowAction Action {
get {
return this.eventAction;
diff --git a/samples/OpenIdRelyingPartyWebForms/Code/InMemoryTokenManager.cs b/samples/OpenIdRelyingPartyWebForms/Code/InMemoryTokenManager.cs
deleted file mode 100644
index 09a5b08..0000000
--- a/samples/OpenIdRelyingPartyWebForms/Code/InMemoryTokenManager.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="InMemoryTokenManager.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace OpenIdRelyingPartyWebForms.Code {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using DotNetOpenAuth.OAuth.ChannelElements;
- using DotNetOpenAuth.OAuth.Messages;
- using DotNetOpenAuth.OpenId.Extensions.OAuth;
-
- public class InMemoryTokenManager : IConsumerTokenManager, IOpenIdOAuthTokenManager {
- private Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
-
- public InMemoryTokenManager(string consumerKey, string consumerSecret) {
- if (String.IsNullOrEmpty(consumerKey)) {
- throw new ArgumentNullException("consumerKey");
- }
-
- this.ConsumerKey = consumerKey;
- this.ConsumerSecret = consumerSecret;
- }
-
- public string ConsumerKey { get; private set; }
-
- public string ConsumerSecret { get; private set; }
-
- #region ITokenManager Members
-
- public string GetConsumerSecret(string consumerKey) {
- if (consumerKey == this.ConsumerKey) {
- return this.ConsumerSecret;
- } else {
- throw new ArgumentException("Unrecognized consumer key.", "consumerKey");
- }
- }
-
- public string GetTokenSecret(string token) {
- return this.tokensAndSecrets[token];
- }
-
- public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
- this.tokensAndSecrets[response.Token] = response.TokenSecret;
- }
-
- public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
- this.tokensAndSecrets.Remove(requestToken);
- this.tokensAndSecrets[accessToken] = accessTokenSecret;
- }
-
- /// <summary>
- /// Classifies a token as a request token or an access token.
- /// </summary>
- /// <param name="token">The token to classify.</param>
- /// <returns>Request or Access token, or invalid if the token is not recognized.</returns>
- public TokenType GetTokenType(string token) {
- throw new NotImplementedException();
- }
-
- #endregion
-
- #region IOpenIdOAuthTokenManager Members
-
- public void StoreOpenIdAuthorizedRequestToken(string consumerKey, AuthorizationApprovedResponse authorization) {
- this.tokensAndSecrets[authorization.RequestToken] = string.Empty;
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebForms/OpenIdRelyingPartyWebForms.csproj b/samples/OpenIdRelyingPartyWebForms/OpenIdRelyingPartyWebForms.csproj
index 6f5df5c..4089d70 100644
--- a/samples/OpenIdRelyingPartyWebForms/OpenIdRelyingPartyWebForms.csproj
+++ b/samples/OpenIdRelyingPartyWebForms/OpenIdRelyingPartyWebForms.csproj
@@ -1,4 +1,5 @@
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -11,15 +12,21 @@
<RootNamespace>OpenIdRelyingPartyWebForms</RootNamespace>
<AssemblyName>OpenIdRelyingPartyWebForms</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -28,6 +35,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CodeAnalysis|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -38,6 +46,10 @@
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup>
+ <DefineConstants>$(DefineConstants);SAMPLESONLY</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
@@ -46,18 +58,10 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
+ <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
@@ -65,10 +69,12 @@
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
+ <Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="Default.aspx" />
<Content Include="Global.asax" />
+ <Content Include="images\openid_login.png" />
<Content Include="login.aspx" />
<Content Include="loginProgrammatic.aspx" />
<Content Include="logout.aspx" />
@@ -78,6 +84,9 @@
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\DotNetOpenAuth.ApplicationBlock\InMemoryTokenManager.cs">
+ <Link>Code\InMemoryTokenManager.cs</Link>
+ </Compile>
<Compile Include="ajaxlogin.aspx.cs">
<DependentUpon>ajaxlogin.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -98,9 +107,15 @@
<DesignTime>True</DesignTime>
<DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
</Compile>
- <Compile Include="Code\InMemoryTokenManager.cs" />
<Compile Include="Code\State.cs" />
<Compile Include="Code\TracePageAppender.cs" />
+ <Compile Include="loginGoogleApps.aspx.cs">
+ <DependentUpon>loginGoogleApps.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="loginGoogleApps.aspx.designer.cs">
+ <DependentUpon>loginGoogleApps.aspx</DependentUpon>
+ </Compile>
<Compile Include="loginPlusOAuthSampleOP.aspx.cs">
<DependentUpon>loginPlusOAuthSampleOP.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -146,13 +161,6 @@
<Compile Include="MembersOnly\ProfileFieldsDisplay.ascx.designer.cs">
<DependentUpon>ProfileFieldsDisplay.ascx</DependentUpon>
</Compile>
- <Compile Include="m\Login.aspx.cs">
- <DependentUpon>Login.aspx</DependentUpon>
- <SubType>ASPXCodeBehind</SubType>
- </Compile>
- <Compile Include="m\Login.aspx.designer.cs">
- <DependentUpon>Login.aspx</DependentUpon>
- </Compile>
<Compile Include="NoIdentityOpenId.aspx.cs">
<DependentUpon>NoIdentityOpenId.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -176,16 +184,16 @@
<Content Include="xrds.aspx" />
</ItemGroup>
<ItemGroup>
+ <Content Include="favicon.ico" />
+ <Content Include="images\DotNetOpenAuth.png" />
+ <Content Include="loginGoogleApps.aspx" />
<Content Include="loginPlusOAuthSampleOP.aspx" />
<Content Include="images\attention.png" />
- <Content Include="images\dotnetopenid_tiny.gif" />
- <Content Include="images\openid_login.gif" />
<Content Include="images\yahoo.png" />
<Content Include="loginPlusOAuth.aspx" />
<Content Include="MembersOnly\DisplayGoogleContacts.aspx" />
<Content Include="MembersOnly\ProfileFieldsDisplay.ascx" />
<Content Include="MembersOnly\Web.config" />
- <Content Include="m\Login.aspx" />
<Content Include="NoIdentityOpenId.aspx" />
</ItemGroup>
<ItemGroup>
@@ -212,7 +220,7 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
diff --git a/samples/OpenIdRelyingPartyWebForms/Site.Master b/samples/OpenIdRelyingPartyWebForms/Site.Master
index cf8c507..a7a3dab 100644
--- a/samples/OpenIdRelyingPartyWebForms/Site.Master
+++ b/samples/OpenIdRelyingPartyWebForms/Site.Master
@@ -21,14 +21,14 @@
<body>
<form id="form1" runat="server">
<span style="float: right">
- <asp:Image runat="server" ID="openIdUsernameImage" ImageUrl="~/images/openid_login.gif"
+ <asp:Image runat="server" ID="openIdUsernameImage" ImageUrl="~/images/openid_login.png"
EnableViewState="false" />
<asp:Label runat="server" ID="friendlyUsername" Text="" EnableViewState="false" />
<asp:LoginStatus ID="LoginStatus1" runat="server" OnLoggedOut="LoginStatus1_LoggedOut" />
</span>
<div>
<a href="http://dotnetopenauth.net">
- <img runat="server" src="~/images/dotnetopenid_tiny.gif" title="Jump to the project web site."
+ <img runat="server" src="~/images/DotNetOpenAuth.png" title="Jump to the project web site."
alt="DotNetOpenAuth" border='0' /></a>
</div>
<div>
diff --git a/samples/OpenIdRelyingPartyWebForms/Web.config b/samples/OpenIdRelyingPartyWebForms/Web.config
index a83430f..5d3a33b 100644
--- a/samples/OpenIdRelyingPartyWebForms/Web.config
+++ b/samples/OpenIdRelyingPartyWebForms/Web.config
@@ -72,9 +72,9 @@
</authentication>
<trace enabled="false" writeToDiagnosticsTrace="true" />
<!-- Trust level discussion:
- Full: everything works
+ Full: everything works (this is required for Google Apps for Domains support)
High: TRACE compilation symbol must NOT be defined
- Medium: doesn't work unless originUrl=".*" or WebPermission.Connect is extended.
+ Medium: doesn't work unless originUrl=".*" or WebPermission.Connect is extended, and Google Apps doesn't work.
Low: doesn't work because WebPermission.Connect is denied.
-->
<trust level="Medium" originUrl=".*"/>
diff --git a/samples/OpenIdRelyingPartyWebForms/ajaxlogin.aspx.designer.cs b/samples/OpenIdRelyingPartyWebForms/ajaxlogin.aspx.designer.cs
index 7e8f83c..3687e1f 100644
--- a/samples/OpenIdRelyingPartyWebForms/ajaxlogin.aspx.designer.cs
+++ b/samples/OpenIdRelyingPartyWebForms/ajaxlogin.aspx.designer.cs
@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4912
//
// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
+// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
diff --git a/samples/OpenIdRelyingPartyWebForms/favicon.ico b/samples/OpenIdRelyingPartyWebForms/favicon.ico
new file mode 100644
index 0000000..e227dbe
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebForms/favicon.ico
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebForms/images/DotNetOpenAuth.png b/samples/OpenIdRelyingPartyWebForms/images/DotNetOpenAuth.png
new file mode 100644
index 0000000..442b986
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebForms/images/DotNetOpenAuth.png
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebForms/images/dotnetopenid_tiny.gif b/samples/OpenIdRelyingPartyWebForms/images/dotnetopenid_tiny.gif
deleted file mode 100644
index c4ed4f5..0000000
--- a/samples/OpenIdRelyingPartyWebForms/images/dotnetopenid_tiny.gif
+++ /dev/null
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebForms/images/openid_login.gif b/samples/OpenIdRelyingPartyWebForms/images/openid_login.gif
deleted file mode 100644
index cde836c..0000000
--- a/samples/OpenIdRelyingPartyWebForms/images/openid_login.gif
+++ /dev/null
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebForms/images/openid_login.png b/samples/OpenIdRelyingPartyWebForms/images/openid_login.png
new file mode 100644
index 0000000..caebd58
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebForms/images/openid_login.png
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebForms/login.aspx b/samples/OpenIdRelyingPartyWebForms/login.aspx
index d0cdb1a..efa2052 100644
--- a/samples/OpenIdRelyingPartyWebForms/login.aspx
+++ b/samples/OpenIdRelyingPartyWebForms/login.aspx
@@ -21,6 +21,7 @@
</asp:CheckBoxList>
<p>Try the PPID identifier functionality against the OpenIDProviderMvc sample.</p>
</fieldset>
+ <p><a href="loginGoogleApps.aspx">Log in using Google Apps for Domains</a>. </p>
<p>
<rp:OpenIdButton runat="server" ImageUrl="~/images/yahoo.png" Text="Login with Yahoo!" ID="yahooLoginButton"
Identifier="https://me.yahoo.com/" OnLoggingIn="OpenIdLogin1_LoggingIn" OnLoggedIn="OpenIdLogin1_LoggedIn" />
diff --git a/samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx b/samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx
new file mode 100644
index 0000000..3f3860e
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx
@@ -0,0 +1,16 @@
+<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="loginGoogleApps.aspx.cs"
+ Inherits="OpenIdRelyingPartyWebForms.loginGoogleApps" ValidateRequest="false"
+ MasterPageFile="~/Site.Master" %>
+
+<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty"
+ TagPrefix="rp" %>
+<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
+ <rp:OpenIdLogin ID="OpenIdLogin1" runat="server" ExampleUrl="yourname@yourdomain.com"
+ TabIndex="1" LabelText="Google Apps email address or domain:"
+ RegisterVisible="False" onloggedin="OpenIdLogin1_LoggedIn" />
+ <asp:Panel runat="server" ID="fullTrustRequired" EnableViewState="false">
+ <b>STOP:</b> Full trust permissions are required for Google Apps support
+ due to certificate chain verification requirements.
+ Modify web.config to allow full trust before trying this sample.
+ </asp:Panel>
+</asp:Content>
diff --git a/samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx.cs b/samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx.cs
new file mode 100644
index 0000000..8c84b40
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx.cs
@@ -0,0 +1,51 @@
+namespace OpenIdRelyingPartyWebForms {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Security;
+ using System.Security.Permissions;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.RelyingParty;
+
+ public partial class loginGoogleApps : System.Web.UI.Page {
+ private static readonly HostMetaDiscoveryService GoogleAppsDiscovery = new HostMetaDiscoveryService {
+ UseGoogleHostedHostMeta = true,
+ };
+
+ private static readonly OpenIdRelyingParty relyingParty;
+
+ static loginGoogleApps() {
+ relyingParty = new OpenIdRelyingParty();
+
+ // We don't necessarily HAVE to clear the other discovery services, but
+ // because host-meta discovery (particularly with Google) can cause ambiguity
+ // in knowing which discovered endpoints are authoritative. Because of the
+ // extra security concerns it's a good idea to have a separate box
+ relyingParty.DiscoveryServices.Clear();
+ relyingParty.DiscoveryServices.Insert(0, GoogleAppsDiscovery); // it should be first if we don't clear the other discovery services
+ }
+
+ protected void Page_Load(object sender, EventArgs e) {
+ this.OpenIdLogin1.RelyingParty = relyingParty;
+ this.OpenIdLogin1.Focus();
+
+ this.fullTrustRequired.Visible = IsPartiallyTrusted();
+ }
+
+ protected void OpenIdLogin1_LoggedIn(object sender, OpenIdEventArgs e) {
+ State.FriendlyLoginName = e.Response.FriendlyIdentifierForDisplay;
+ }
+
+ private static bool IsPartiallyTrusted() {
+ try {
+ new SecurityPermission(PermissionState.Unrestricted).Demand();
+ return false;
+ } catch (SecurityException) {
+ return true;
+ }
+ }
+ }
+}
diff --git a/samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx.designer.cs b/samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx.designer.cs
new file mode 100644
index 0000000..e927f65
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebForms/loginGoogleApps.aspx.designer.cs
@@ -0,0 +1,34 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OpenIdRelyingPartyWebForms {
+
+
+ public partial class loginGoogleApps {
+
+ /// <summary>
+ /// OpenIdLogin1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::DotNetOpenAuth.OpenId.RelyingParty.OpenIdLogin OpenIdLogin1;
+
+ /// <summary>
+ /// fullTrustRequired control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Panel fullTrustRequired;
+ }
+}
diff --git a/samples/OpenIdRelyingPartyWebForms/m/Login.aspx b/samples/OpenIdRelyingPartyWebForms/m/Login.aspx
deleted file mode 100644
index dda8c85..0000000
--- a/samples/OpenIdRelyingPartyWebForms/m/Login.aspx
+++ /dev/null
@@ -1,17 +0,0 @@
-<%@ Page Language="C#" CodeBehind="Login.aspx.cs" Inherits="OpenIdRelyingPartyWebForms.m.Login" %>
-
-<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty"
- TagPrefix="RP" %>
-<%@ Register Assembly="System.Web.Mobile" Namespace="System.Web.UI.MobileControls"
- TagPrefix="MC" %>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-</head>
-<body>
- <MC:Form id="form1" runat="server">
- <RP:OpenIdMobileTextBox ID="openIdTextBox" runat="server" />
- <MC:Command runat="server" ID="loginButton" OnClick="loginButton_Click" Text="Login" />
- </MC:Form>
-</body>
-</html>
diff --git a/samples/OpenIdRelyingPartyWebForms/m/Login.aspx.cs b/samples/OpenIdRelyingPartyWebForms/m/Login.aspx.cs
deleted file mode 100644
index 86cd5c1..0000000
--- a/samples/OpenIdRelyingPartyWebForms/m/Login.aspx.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace OpenIdRelyingPartyWebForms.m {
- using System;
- using System.Web.UI.MobileControls;
-
- public partial class Login : MobilePage {
- protected void Page_Load(object sender, EventArgs e) {
- }
-
- protected void loginButton_Click(object sender, EventArgs e) {
- this.openIdTextBox.LogOn();
- }
- }
-}
diff --git a/samples/OpenIdRelyingPartyWebForms/xrds.aspx b/samples/OpenIdRelyingPartyWebForms/xrds.aspx
index 92983fd..55b5e35 100644
--- a/samples/OpenIdRelyingPartyWebForms/xrds.aspx
+++ b/samples/OpenIdRelyingPartyWebForms/xrds.aspx
@@ -23,7 +23,7 @@ is default.aspx.
</Service>
<Service>
<Type>http://specs.openid.net/extensions/ui/icon</Type>
- <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/images/dotnetopenid_tiny.gif"))%></URI>
+ <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/images/DotNetOpenAuth.png"))%></URI>
</Service>
</XRD>
</xrds:XRDS>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Code/State.vb b/samples/OpenIdRelyingPartyWebFormsVB/Code/State.vb
new file mode 100644
index 0000000..e00cb4f
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Code/State.vb
@@ -0,0 +1,46 @@
+Imports DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy
+Imports DotNetOpenAuth.OpenId.Extensions.SimpleRegistration
+Imports DotNetOpenAuth.OpenId.Extensions.AttributeExchange
+
+Public Class State
+ Public Shared Property ProfileFields() As ClaimsResponse
+ Get
+ Return HttpContext.Current.Session("ProfileFields")
+ End Get
+ Set(ByVal value As ClaimsResponse)
+ HttpContext.Current.Session("ProfileFields") = value
+ End Set
+ End Property
+
+ Public Shared Property FetchResponse() As FetchResponse
+ Get
+ Return HttpContext.Current.Session("FetchResponse")
+ End Get
+ Set(ByVal value As FetchResponse)
+ HttpContext.Current.Session("FetchResponse") = value
+ End Set
+ End Property
+
+ Public Shared Property FriendlyLoginName() As String
+ Get
+ Return HttpContext.Current.Session("FriendlyLoginName")
+ End Get
+ Set(ByVal value As String)
+ HttpContext.Current.Session("FriendlyLoginName") = value
+ End Set
+ End Property
+
+ Public Shared Property PapePolicies() As PolicyResponse
+ Get
+ Return HttpContext.Current.Session("PapePolicies")
+ End Get
+ Set(ByVal value As PolicyResponse)
+ HttpContext.Current.Session("PapePolicies") = value
+ End Set
+ End Property
+
+ Public Shared Sub Clear()
+ FriendlyLoginName = Nothing
+ End Sub
+
+End Class
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Code/TracePageAppender.vb b/samples/OpenIdRelyingPartyWebFormsVB/Code/TracePageAppender.vb
new file mode 100644
index 0000000..dfc2db5
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Code/TracePageAppender.vb
@@ -0,0 +1,10 @@
+Imports System.IO
+
+Public Class TracePageAppender
+ Inherits log4net.Appender.AppenderSkeleton
+
+ Protected Overrides Sub Append(ByVal loggingEvent As log4net.Core.LoggingEvent)
+ Dim sw As StringWriter = New StringWriter(Global_asax.LogMessages)
+ Layout.Format(sw, loggingEvent)
+ End Sub
+End Class \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx
new file mode 100644
index 0000000..53f6dfc
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx
@@ -0,0 +1,18 @@
+<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="OpenIdRelyingPartyWebFormsVB._Default"
+ MasterPageFile="~/Site.Master" %>
+
+<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth" TagPrefix="openid" %>
+<asp:Content runat="server" ContentPlaceHolderID="head">
+ <openid:XrdsPublisher ID="XrdsPublisher1" runat="server" XrdsUrl="~/xrds.aspx" />
+</asp:Content>
+<asp:Content runat="server" ContentPlaceHolderID="main">
+ <h2>
+ Relying Party
+ </h2>
+ <p>
+ Visit the
+ <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/MembersOnly/Default.aspx"
+ Text="Members Only" />
+ area. (This will trigger a login demo).
+ </p>
+</asp:Content>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.designer.vb
new file mode 100644
index 0000000..ce59c43
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.designer.vb
@@ -0,0 +1,26 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.4927
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+
+Partial Public Class _Default
+
+ '''<summary>
+ '''form1 control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents form1 As Global.System.Web.UI.HtmlControls.HtmlForm
+End Class
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.vb b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.vb
new file mode 100644
index 0000000..3e023c0
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Default.aspx.vb
@@ -0,0 +1,8 @@
+Partial Public Class _Default
+ Inherits System.Web.UI.Page
+
+ Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
+
+ End Sub
+
+End Class \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Global.asax b/samples/OpenIdRelyingPartyWebFormsVB/Global.asax
new file mode 100644
index 0000000..92716f1
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Global.asax
@@ -0,0 +1 @@
+<%@ Application Codebehind="Global.asax.vb" Inherits="OpenIdRelyingPartyWebFormsVB.Global_asax" Language="vb" %>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Global.asax.vb b/samples/OpenIdRelyingPartyWebFormsVB/Global.asax.vb
new file mode 100644
index 0000000..60ab0cc
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Global.asax.vb
@@ -0,0 +1,66 @@
+Imports System
+Imports System.Collections.Specialized
+Imports System.Configuration
+Imports System.IO
+Imports System.Text
+Imports System.Web
+Imports DotNetOpenAuth.ApplicationBlock
+Imports DotNetOpenAuth.OAuth
+Imports OpenIdRelyingPartyWebFormsVB
+
+Public Class Global_asax
+ Inherits HttpApplication
+
+ Public Shared Logger As log4net.ILog = log4net.LogManager.GetLogger(GetType(Global_asax))
+
+ Friend Shared LogMessages As StringBuilder = New StringBuilder
+
+ Public Shared Function CollectionToString(ByVal collection As NameValueCollection) As String
+ Dim sw As StringWriter = New StringWriter
+ For Each key As String In collection.Keys
+ sw.WriteLine("{0} = '{1}'", key, collection(key))
+ Next
+ Return sw.ToString
+ End Function
+
+ Protected Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
+ log4net.Config.XmlConfigurator.Configure()
+ Logger.Info("Sample starting...")
+ End Sub
+
+ Protected Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
+ Logger.Info("Sample shutting down...")
+ ' this would be automatic, but in partial trust scenarios it is not.
+ log4net.LogManager.Shutdown()
+ End Sub
+
+ Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
+ ' System.Diagnostics.Debugger.Launch();
+ Logger.DebugFormat("Processing {0} on {1} ", Request.HttpMethod, stripQueryString(Request.Url))
+ If (Request.QueryString.Count > 0) Then
+ Logger.DebugFormat("Querystring follows: " & vbLf & "{0}", CollectionToString(Request.QueryString))
+ End If
+ If (Request.Form.Count > 0) Then
+ Logger.DebugFormat("Posted form follows: " & vbLf & "{0}", CollectionToString(Request.Form))
+ End If
+ End Sub
+
+ Protected Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
+ Logger.DebugFormat("User {0} authenticated.", (Not (HttpContext.Current.User) Is Nothing))
+ 'TODO: Warning!!!, inline IF is not supported ?
+ End Sub
+
+ Protected Sub Application_EndRequest(ByVal sender As Object, ByVal e As EventArgs)
+
+ End Sub
+
+ Protected Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
+ Logger.ErrorFormat("An unhandled exception was raised. Details follow: {0}", HttpContext.Current.Server.GetLastError)
+ End Sub
+
+ Private Shared Function stripQueryString(ByVal uri As Uri) As String
+ Dim builder As UriBuilder = New UriBuilder(uri)
+ builder.Query = Nothing
+ Return builder.ToString
+ End Function
+End Class \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx
new file mode 100644
index 0000000..d0e978b
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx
@@ -0,0 +1,28 @@
+<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Login.aspx.vb" Inherits="OpenIdRelyingPartyWebFormsVB.Login"
+ ValidateRequest="false" MasterPageFile="~/Site.Master" %>
+
+<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty" TagPrefix="rp" %>
+<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
+ <h2>Login Page </h2>
+ <rp:OpenIdLogin ID="OpenIdLogin1" runat="server" CssClass="openid_login" RequestCountry="Request"
+ RequestEmail="Require" RequestGender="Require" RequestPostalCode="Require" RequestTimeZone="Require"
+ RememberMeVisible="True" PolicyUrl="~/PrivacyPolicy.aspx" TabIndex="1" />
+ <fieldset title="Knobs">
+ <asp:CheckBox ID="requireSslCheckBox" runat="server"
+ Text="RequireSsl (high security) mode"
+ oncheckedchanged="requireSslCheckBox_CheckedChanged" /><br />
+ <h4 style="margin-top: 0; margin-bottom: 0">PAPE policies</h4>
+ <asp:CheckBoxList runat="server" ID="papePolicies">
+ <asp:ListItem Text="Request phishing resistant authentication" Value="http://schemas.openid.net/pape/policies/2007/06/phishing-resistant" />
+ <asp:ListItem Text="Request multi-factor authentication" Value="http://schemas.openid.net/pape/policies/2007/06/multi-factor" />
+ <asp:ListItem Text="Request physical multi-factor authentication" Value="http://schemas.openid.net/pape/policies/2007/06/multi-factor-physical" />
+ <asp:ListItem Text="Request PPID identifier" Value="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier" />
+ </asp:CheckBoxList>
+ <p>Try the PPID identifier functionality against the OpenIDProviderMvc sample.</p>
+ </fieldset>
+ <p><a href="loginGoogleApps.aspx">Log in using Google Apps for Domains</a>. </p>
+ <p>
+ <rp:OpenIdButton runat="server" ImageUrl="~/images/yahoo.png" Text="Login with Yahoo!" ID="yahooLoginButton"
+ Identifier="https://me.yahoo.com/" OnLoggingIn="OpenIdLogin1_LoggingIn" OnLoggedIn="OpenIdLogin1_LoggedIn" />
+ </p>
+</asp:Content>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.designer.vb
new file mode 100644
index 0000000..4cf1a96
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.designer.vb
@@ -0,0 +1,53 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.4927
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+
+Partial Public Class Login
+
+ '''<summary>
+ '''OpenIdLogin1 control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents OpenIdLogin1 As Global.DotNetOpenAuth.OpenId.RelyingParty.OpenIdLogin
+
+ '''<summary>
+ '''requireSslCheckBox control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents requireSslCheckBox As Global.System.Web.UI.WebControls.CheckBox
+
+ '''<summary>
+ '''papePolicies control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents papePolicies As Global.System.Web.UI.WebControls.CheckBoxList
+
+ '''<summary>
+ '''yahooLoginButton control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents yahooLoginButton As Global.DotNetOpenAuth.OpenId.RelyingParty.OpenIdButton
+End Class
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.vb b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.vb
new file mode 100644
index 0000000..339f62c
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Login.aspx.vb
@@ -0,0 +1,52 @@
+Imports DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy
+Imports DotNetOpenAuth.OpenId.RelyingParty
+Imports DotNetOpenAuth.OpenId.Extensions.SimpleRegistration
+
+Partial Public Class Login
+ Inherits System.Web.UI.Page
+
+ Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
+ OpenIdLogin1.Focus()
+ End Sub
+
+ Protected Sub requireSslCheckBox_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
+ OpenIdLogin1.RequireSsl = requireSslCheckBox.Checked
+ End Sub
+
+ Protected Sub OpenIdLogin1_LoggingIn(ByVal sender As Object, ByVal e As DotNetOpenAuth.OpenId.RelyingParty.OpenIdEventArgs) Handles OpenIdLogin1.LoggingIn
+ prepareRequest(e.Request)
+ End Sub
+
+ ''' <summary>
+ ''' Fired upon login.
+ ''' </summary>
+ ''' <param name="sender">The source of the event.</param>
+ ''' <param name="e">The <see cref="DotNetOpenAuth.OpenId.RelyingParty.OpenIdEventArgs"/> instance containing the event data.</param>
+ ''' <remarks>
+ ''' Note, that straight after login, forms auth will redirect the user
+ ''' to their original page. So this page may never be rendererd.
+ ''' </remarks>
+ Protected Sub OpenIdLogin1_LoggedIn(ByVal sender As Object, ByVal e As DotNetOpenAuth.OpenId.RelyingParty.OpenIdEventArgs) Handles OpenIdLogin1.LoggedIn
+ State.FriendlyLoginName = e.Response.FriendlyIdentifierForDisplay
+ State.ProfileFields = e.Response.GetExtension(Of ClaimsResponse)()
+ State.PapePolicies = e.Response.GetExtension(Of PolicyResponse)()
+ End Sub
+
+ Private Sub prepareRequest(ByVal request As IAuthenticationRequest)
+ ' Collect the PAPE policies requested by the user.
+ Dim policies As New List(Of String)
+ For Each item As ListItem In Me.papePolicies.Items
+ If item.Selected Then
+ policies.Add(item.Value)
+ End If
+ Next
+ ' Add the PAPE extension if any policy was requested.
+ If (policies.Count > 0) Then
+ Dim pape As New PolicyRequest
+ For Each policy As String In policies
+ pape.PreferredPolicies.Add(policy)
+ Next
+ request.AddExtension(pape)
+ End If
+ End Sub
+End Class \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx
new file mode 100644
index 0000000..7f1fa0e
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx
@@ -0,0 +1,15 @@
+<%@ Page Language="vb" AutoEventWireup="true" CodeBehind="loginProgrammatic.aspx.vb"
+ Inherits="OpenIdRelyingPartyWebFormsVB.LoginProgrammatic" MasterPageFile="~/Site.Master" %>
+<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
+ <h2>Login Page </h2>
+ <asp:Label ID="Label1" runat="server" Text="OpenID Login" />
+ <asp:TextBox ID="openIdBox" runat="server" />
+ <asp:Button ID="loginButton" runat="server" Text="Login" OnClick="loginButton_Click" />
+ <asp:CustomValidator runat="server" ID="openidValidator" ErrorMessage="Invalid OpenID Identifier"
+ ControlToValidate="openIdBox" EnableViewState="false" OnServerValidate="openidValidator_ServerValidate" />
+ <br />
+ <asp:Label ID="loginFailedLabel" runat="server" EnableViewState="False" Text="Login failed"
+ Visible="False" />
+ <asp:Label ID="loginCanceledLabel" runat="server" EnableViewState="False" Text="Login canceled"
+ Visible="False" />
+</asp:Content> \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.designer.vb
new file mode 100644
index 0000000..907fcda
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.designer.vb
@@ -0,0 +1,71 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.4927
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+
+Partial Public Class LoginProgrammatic
+
+ '''<summary>
+ '''Label1 control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents Label1 As Global.System.Web.UI.WebControls.Label
+
+ '''<summary>
+ '''openIdBox control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents openIdBox As Global.System.Web.UI.WebControls.TextBox
+
+ '''<summary>
+ '''loginButton control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents loginButton As Global.System.Web.UI.WebControls.Button
+
+ '''<summary>
+ '''openidValidator control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents openidValidator As Global.System.Web.UI.WebControls.CustomValidator
+
+ '''<summary>
+ '''loginFailedLabel control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents loginFailedLabel As Global.System.Web.UI.WebControls.Label
+
+ '''<summary>
+ '''loginCanceledLabel control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents loginCanceledLabel As Global.System.Web.UI.WebControls.Label
+End Class
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.vb b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.vb
new file mode 100644
index 0000000..6cac182
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/LoginProgrammatic.aspx.vb
@@ -0,0 +1,76 @@
+Imports System.Net
+Imports System.Web.Security
+Imports DotNetOpenAuth.Messaging
+Imports DotNetOpenAuth.OpenId
+Imports DotNetOpenAuth.OpenId.Extensions.SimpleRegistration
+Imports DotNetOpenAuth.OpenId.RelyingParty
+
+Public Class LoginProgrammatic
+ Inherits System.Web.UI.Page
+
+ Private Shared relyingParty As New OpenIdRelyingParty
+
+ Protected Sub openidValidator_ServerValidate(ByVal source As Object, ByVal args As ServerValidateEventArgs)
+ ' This catches common typos that result in an invalid OpenID Identifier.
+ args.IsValid = Identifier.IsValid(args.Value)
+ End Sub
+
+ Protected Sub loginButton_Click(ByVal sender As Object, ByVal e As EventArgs)
+ If Not Me.Page.IsValid Then
+ Return
+ ' don't login if custom validation failed.
+ End If
+ Try
+ Dim request As IAuthenticationRequest = relyingParty.CreateRequest(Me.openIdBox.Text)
+ ' This is where you would add any OpenID extensions you wanted
+ ' to include in the authentication request.
+ request.AddExtension(New ClaimsRequest() With { _
+ .Country = DemandLevel.Request, _
+ .Email = DemandLevel.Request, _
+ .Gender = DemandLevel.Require, _
+ .PostalCode = DemandLevel.Require, _
+ .TimeZone = DemandLevel.Require _
+ })
+ ' Send your visitor to their Provider for authentication.
+ request.RedirectToProvider()
+ Catch ex As ProtocolException
+ ' The user probably entered an Identifier that
+ ' was not a valid OpenID endpoint.
+ Me.openidValidator.Text = ex.Message
+ Me.openidValidator.IsValid = False
+ End Try
+ End Sub
+
+ Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
+ Me.openIdBox.Focus()
+ ' For debugging/testing, we allow remote clearing of all associations...
+ ' NOT a good idea on a production site.
+ If (Request.QueryString("clearAssociations") = "1") Then
+ Application.Remove("DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.ApplicationStore")
+ ' Force a redirect now to prevent the user from logging in while associations
+ ' are constantly being cleared.
+ Dim builder As UriBuilder = New UriBuilder(Request.Url)
+ builder.Query = Nothing
+ Me.Response.Redirect(builder.Uri.AbsoluteUri)
+ End If
+ Dim response As IAuthenticationResponse = relyingParty.GetResponse
+ If response IsNot Nothing Then
+ Select Case response.Status
+ Case AuthenticationStatus.Authenticated
+ ' This is where you would look for any OpenID extension responses included
+ ' in the authentication assertion.
+ Dim claimsResponse As ClaimsResponse = response.GetExtension(Of ClaimsResponse)()
+ State.ProfileFields = claimsResponse
+ ' Store off the "friendly" username to display -- NOT for username lookup
+ State.FriendlyLoginName = response.FriendlyIdentifierForDisplay
+ ' Use FormsAuthentication to tell ASP.NET that the user is now logged in,
+ ' with the OpenID Claimed Identifier as their username.
+ FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, False)
+ Case AuthenticationStatus.Canceled
+ Me.loginCanceledLabel.Visible = True
+ Case AuthenticationStatus.Failed
+ Me.loginFailedLabel.Visible = True
+ End Select
+ End If
+ End Sub
+End Class \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Default.aspx b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Default.aspx
new file mode 100644
index 0000000..441ef84
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Default.aspx
@@ -0,0 +1,34 @@
+<%@ Page Language="VB" AutoEventWireup="true" MasterPageFile="~/Site.Master" %>
+<%@ Import Namespace="OpenIdRelyingPartyWebFormsVB" %>
+<%@ Register Src="~/MembersOnly/ProfileFieldsDisplay.ascx" TagPrefix="cc1" TagName="ProfileFieldsDisplay" %>
+<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
+ <h2>
+ Members Only Area
+ </h2>
+ <p>
+ Congratulations, <b><asp:LoginName ID="LoginName1" runat="server" /></b>.
+ You have completed the OpenID login process.
+ </p>
+
+<% If (State.PapePolicies IsNot Nothing) Then%>
+ <p>A PAPE extension was included in the authentication with this content: </p>
+ <ul>
+ <% If (State.PapePolicies.NistAssuranceLevel.HasValue) Then%>
+ <li>Nist: <%=HttpUtility.HtmlEncode(State.PapePolicies.NistAssuranceLevel.Value.ToString())%></li>
+ <% End If
+ For Each policy As String In State.PapePolicies.ActualPolicies%>
+ <li><%=HttpUtility.HtmlEncode(policy)%></li>
+ <% Next%>
+ </ul>
+<% End If %>
+
+<% If State.ProfileFields IsNot Nothing Then
+ profileFieldsDisplay.ProfileValues = State.ProfileFields%>
+ <p>
+ In addition to authenticating you, your OpenID Provider may
+ have told us something about you using the
+ Simple Registration extension:
+ </p>
+ <cc1:ProfileFieldsDisplay runat="server" ID="profileFieldsDisplay" />
+<% End If%>
+</asp:Content>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/ProfileFieldsDisplay.ascx b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/ProfileFieldsDisplay.ascx
new file mode 100644
index 0000000..f6864e9
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/ProfileFieldsDisplay.ascx
@@ -0,0 +1,91 @@
+<%@ Control Language="VB" AutoEventWireup="true" %>
+<%@ Import Namespace="DotNetOpenAuth.OpenId.Extensions.SimpleRegistration" %>
+
+<script runat="server">
+
+ Private _profileValues As ClaimsResponse
+ Public Property ProfileValues() As ClaimsResponse
+ Get
+ Return _profileValues
+ End Get
+ Set(ByVal value As ClaimsResponse)
+ _profileValues = value
+ End Set
+ End Property
+
+</script>
+
+<table id="profileFieldsTable" runat="server">
+ <tr>
+ <td>
+ Nickname
+ </td>
+ <td>
+ <%=ProfileValues.Nickname %>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Email
+ </td>
+ <td>
+ <%=ProfileValues.Email%>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ FullName
+ </td>
+ <td>
+ <%=ProfileValues.FullName%>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Date of Birth
+ </td>
+ <td>
+ <%=ProfileValues.BirthDate.ToString()%>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Gender
+ </td>
+ <td>
+ <%=ProfileValues.Gender.ToString()%>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Post Code
+ </td>
+ <td>
+ <%=ProfileValues.PostalCode%>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Country
+ </td>
+ <td>
+ <%=ProfileValues.Country%>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Language
+ </td>
+ <td>
+ <%=ProfileValues.Language%>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Timezone
+ </td>
+ <td>
+ <%=ProfileValues.TimeZone%>
+ </td>
+ </tr>
+</table>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Web.config b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Web.config
new file mode 100644
index 0000000..3cfad05
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/MembersOnly/Web.config
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!--
+ Note: As an alternative to hand editing this file you can use the
+ web admin tool to configure settings for your application. Use
+ the Website->Asp.Net Configuration option in Visual Studio.
+ A full list of settings and comments can be found in
+ machine.config.comments usually located in
+ \Windows\Microsoft.Net\Framework\v2.x\Config
+-->
+<configuration>
+ <appSettings/>
+ <connectionStrings/>
+ <system.web>
+ <authorization>
+ <deny users="?"/>
+ </authorization>
+ </system.web>
+</configuration>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.Designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.Designer.vb
new file mode 100644
index 0000000..cf58961
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:4.0.30104.0
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.myapp b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.myapp
new file mode 100644
index 0000000..758895d
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Application.myapp
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <MySubMain>false</MySubMain>
+ <SingleInstance>false</SingleInstance>
+ <ShutdownMode>0</ShutdownMode>
+ <EnableVisualStyles>true</EnableVisualStyles>
+ <AuthenticationMode>0</AuthenticationMode>
+ <ApplicationType>1</ApplicationType>
+ <SaveMySettingsOnExit>true</SaveMySettingsOnExit>
+</MyApplicationData>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/AssemblyInfo.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..813551f
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/AssemblyInfo.vb
@@ -0,0 +1,34 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+<Assembly: AssemblyTitle("OpenIdRelyingPartyWebFormsVB")>
+<Assembly: AssemblyDescription("")>
+<Assembly: AssemblyCompany("")>
+<Assembly: AssemblyProduct("OpenIdRelyingPartyWebFormsVB")>
+<Assembly: AssemblyCopyright("Copyright © 2010")>
+<Assembly: AssemblyTrademark("")>
+
+<Assembly: ComVisible(False)>
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+<Assembly: Guid("334e9cee-0d47-4d70-924b-b5098a3432cb")>
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+' <Assembly: AssemblyVersion("1.0.*")>
+
+<Assembly: AssemblyVersion("1.0.0.0")>
+<Assembly: AssemblyFileVersion("1.0.0.0")>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/MyExtensions/MyWebExtension.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/MyExtensions/MyWebExtension.vb
new file mode 100644
index 0000000..78c7c19
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/MyExtensions/MyWebExtension.vb
@@ -0,0 +1,73 @@
+#If _MyType <> "Empty" Then
+
+Namespace My
+ ''' <summary>
+ ''' Module used to define the properties that are available in the My Namespace for Web projects.
+ ''' </summary>
+ ''' <remarks></remarks>
+ <Global.Microsoft.VisualBasic.HideModuleName()> _
+ Module MyWebExtension
+ Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.ServerComputer)
+ Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.WebUser)
+ Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.AspLog)
+ ''' <summary>
+ ''' Returns information about the host computer.
+ ''' </summary>
+ <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
+ Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.ServerComputer
+ Get
+ Return s_Computer.GetInstance()
+ End Get
+ End Property
+ ''' <summary>
+ ''' Returns information for the current Web user.
+ ''' </summary>
+ <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
+ Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.WebUser
+ Get
+ Return s_User.GetInstance()
+ End Get
+ End Property
+ ''' <summary>
+ ''' Returns Request object.
+ ''' </summary>
+ <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
+ <Global.System.ComponentModel.Design.HelpKeyword("My.Request")> _
+ Friend ReadOnly Property Request() As Global.System.Web.HttpRequest
+ <Global.System.Diagnostics.DebuggerHidden()> _
+ Get
+ Dim CurrentContext As Global.System.Web.HttpContext = Global.System.Web.HttpContext.Current
+ If CurrentContext IsNot Nothing Then
+ Return CurrentContext.Request
+ End If
+ Return Nothing
+ End Get
+ End Property
+ ''' <summary>
+ ''' Returns Response object.
+ ''' </summary>
+ <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
+ <Global.System.ComponentModel.Design.HelpKeyword("My.Response")> _
+ Friend ReadOnly Property Response() As Global.System.Web.HttpResponse
+ <Global.System.Diagnostics.DebuggerHidden()> _
+ Get
+ Dim CurrentContext As Global.System.Web.HttpContext = Global.System.Web.HttpContext.Current
+ If CurrentContext IsNot Nothing Then
+ Return CurrentContext.Response
+ End If
+ Return Nothing
+ End Get
+ End Property
+ ''' <summary>
+ ''' Returns the Asp log object.
+ ''' </summary>
+ <Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
+ Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.AspLog
+ Get
+ Return s_Log.GetInstance()
+ End Get
+ End Property
+ End Module
+End Namespace
+
+#End If \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.Designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..276f520
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.Designer.vb
@@ -0,0 +1,63 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:4.0.30104.0
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''<summary>
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''</summary>
+ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''<summary>
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("OpenIdRelyingPartyWebFormsVB.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''<summary>
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.resx b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.Designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..dddcea9
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:4.0.30104.0
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0"), _
+ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
+ Friend Module MySettingsProperty
+
+ <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
+ Friend ReadOnly Property Settings() As Global.OpenIdRelyingPartyWebFormsVB.My.MySettings
+ Get
+ Return Global.OpenIdRelyingPartyWebFormsVB.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.settings b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/My Project/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/OpenIdRelyingPartyWebFormsVB.vbproj b/samples/OpenIdRelyingPartyWebFormsVB/OpenIdRelyingPartyWebFormsVB.vbproj
new file mode 100644
index 0000000..4cfb5ef
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/OpenIdRelyingPartyWebFormsVB.vbproj
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{F289B925-4307-4BEC-B411-885CE70E3379}</ProjectGuid>
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <RootNamespace>OpenIdRelyingPartyWebFormsVB</RootNamespace>
+ <AssemblyName>OpenIdRelyingPartyWebFormsVB</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <MyType>Custom</MyType>
+ <OptionExplicit>On</OptionExplicit>
+ <OptionCompare>Binary</OptionCompare>
+ <OptionStrict>Off</OptionStrict>
+ <OptionInfer>On</OptionInfer>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>bin\</OutputPath>
+ <DocumentationFile>OpenIdRelyingPartyWebFormsVB.xml</DocumentationFile>
+ <NoWarn>41999,42016,42020,42021,42022,42353,42354,42355</NoWarn>
+ <WarningsAsErrors>42017,42018,42019,42032,42036</WarningsAsErrors>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <DefineDebug>false</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DocumentationFile>OpenIdRelyingPartyWebFormsVB.xml</DocumentationFile>
+ <NoWarn>41999,42016,42020,42021,42022,42353,42354,42355</NoWarn>
+ <WarningsAsErrors>42017,42018,42019,42032,42036</WarningsAsErrors>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Web.Extensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Web" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.EnterpriseServices" />
+ <Reference Include="System.Web.Mobile" />
+ </ItemGroup>
+ <ItemGroup>
+ <Import Include="Microsoft.VisualBasic" />
+ <Import Include="System" />
+ <Import Include="System.Collections" />
+ <Import Include="System.Collections.Generic" />
+ <Import Include="System.Data" />
+ <Import Include="System.Linq" />
+ <Import Include="System.Xml.Linq" />
+ <Import Include="System.Diagnostics" />
+ <Import Include="System.Collections.Specialized" />
+ <Import Include="System.Configuration" />
+ <Import Include="System.Text" />
+ <Import Include="System.Text.RegularExpressions" />
+ <Import Include="System.Web" />
+ <Import Include="System.Web.Caching" />
+ <Import Include="System.Web.SessionState" />
+ <Import Include="System.Web.Security" />
+ <Import Include="System.Web.Profile" />
+ <Import Include="System.Web.UI" />
+ <Import Include="System.Web.UI.WebControls" />
+ <Import Include="System.Web.UI.WebControls.WebParts" />
+ <Import Include="System.Web.UI.HtmlControls" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Default.aspx" />
+ <Content Include="images\openid_login.png" />
+ <Content Include="Login.aspx" />
+ <Content Include="Web.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Code\State.vb" />
+ <Compile Include="Code\TracePageAppender.vb" />
+ <Compile Include="Default.aspx.vb">
+ <SubType>ASPXCodeBehind</SubType>
+ <DependentUpon>Default.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Default.aspx.designer.vb">
+ <DependentUpon>Default.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Global.asax.vb">
+ <DependentUpon>Global.asax</DependentUpon>
+ </Compile>
+ <Compile Include="Login.aspx.designer.vb">
+ <DependentUpon>Login.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Login.aspx.vb">
+ <DependentUpon>Login.aspx</DependentUpon>
+ <SubType>ASPXCodebehind</SubType>
+ </Compile>
+ <Compile Include="LoginProgrammatic.aspx.designer.vb">
+ <DependentUpon>LoginProgrammatic.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="LoginProgrammatic.aspx.vb">
+ <DependentUpon>LoginProgrammatic.aspx</DependentUpon>
+ <SubType>ASPXCodebehind</SubType>
+ </Compile>
+ <Compile Include="My Project\AssemblyInfo.vb" />
+ <Compile Include="My Project\Application.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Application.myapp</DependentUpon>
+ </Compile>
+ <Compile Include="My Project\MyExtensions\MyWebExtension.vb">
+ <VBMyExtensionTemplateID>Microsoft.VisualBasic.Web.MyExtension</VBMyExtensionTemplateID>
+ <VBMyExtensionTemplateVersion>1.0.0.0</VBMyExtensionTemplateVersion>
+ </Compile>
+ <Compile Include="My Project\Resources.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="My Project\Settings.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <Compile Include="TracePage.aspx.designer.vb">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="TracePage.aspx.vb">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ <SubType>ASPXCodebehind</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="My Project\Resources.resx">
+ <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.vb</LastGenOutput>
+ <CustomToolNamespace>My.Resources</CustomToolNamespace>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Global.asax" />
+ <Content Include="LoginProgrammatic.aspx" />
+ <Content Include="MembersOnly\ProfileFieldsDisplay.ascx" />
+ <Content Include="MembersOnly\Web.config" />
+ <None Include="My Project\Application.myapp">
+ <Generator>MyApplicationCodeGenerator</Generator>
+ <LastGenOutput>Application.Designer.vb</LastGenOutput>
+ </None>
+ <None Include="My Project\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <CustomToolNamespace>My</CustomToolNamespace>
+ <LastGenOutput>Settings.Designer.vb</LastGenOutput>
+ </None>
+ <Content Include="favicon.ico" />
+ <Content Include="images\attention.png" />
+ <Content Include="images\DotNetOpenAuth.png" />
+ <Content Include="images\yahoo.png" />
+ <Content Include="MembersOnly\Default.aspx" />
+ <Content Include="PrivacyPolicy.aspx" />
+ <Content Include="Site.Master" />
+ <Content Include="styles.css" />
+ <Content Include="TracePage.aspx" />
+ <Content Include="xrds.aspx" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\DotNetOpenAuth\DotNetOpenAuth.csproj">
+ <Project>{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}</Project>
+ <Name>DotNetOpenAuth</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\DotNetOpenAuth.ApplicationBlock\DotNetOpenAuth.ApplicationBlock.csproj">
+ <Project>{AA78D112-D889-414B-A7D4-467B34C7B663}</Project>
+ <Name>DotNetOpenAuth.ApplicationBlock</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="App_Data\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+ <WebProjectProperties>
+ <UseIIS>False</UseIIS>
+ <AutoAssignPort>True</AutoAssignPort>
+ <DevelopmentServerPort>27433</DevelopmentServerPort>
+ <DevelopmentServerVPath>/</DevelopmentServerVPath>
+ <IISUrl>
+ </IISUrl>
+ <NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
+ <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+ </WebProjectProperties>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+</Project> \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/PrivacyPolicy.aspx b/samples/OpenIdRelyingPartyWebFormsVB/PrivacyPolicy.aspx
new file mode 100644
index 0000000..7b72cd4
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/PrivacyPolicy.aspx
@@ -0,0 +1,7 @@
+<%@ Page Language="VB" AutoEventWireup="true" MasterPageFile="~/Site.Master" %>
+<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
+ <h2>Privacy Policy</h2>
+ <p>
+ Some privacy policy would go here.
+ </p>
+</asp:Content> \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Site.Master b/samples/OpenIdRelyingPartyWebFormsVB/Site.Master
new file mode 100644
index 0000000..7a92712
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Site.Master
@@ -0,0 +1,39 @@
+<%@ Master Language="VB" AutoEventWireup="true" %>
+<%@ Import Namespace="OpenIdRelyingPartyWebFormsVB" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<script runat="server">
+ Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
+ friendlyUsername.Text = State.FriendlyLoginName
+ End Sub
+
+ Protected Sub LoginStatus1_LoggedOut(ByVal sender As Object, ByVal e As EventArgs)
+ State.Clear()
+ End Sub
+</script>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title>OpenID Relying Party, by DotNetOpenAuth</title>
+ <link href="styles.css" rel="stylesheet" type="text/css" />
+ <asp:ContentPlaceHolder ID="head" runat="server" />
+</head>
+<body>
+ <form id="form1" runat="server">
+ <span style="float: right">
+ <asp:Image runat="server" ID="openIdUsernameImage" ImageUrl="~/images/openid_login.png"
+ EnableViewState="false" />
+ <asp:Label runat="server" ID="friendlyUsername" Text="" EnableViewState="false" />
+ <asp:LoginStatus ID="LoginStatus1" runat="server" OnLoggedOut="LoginStatus1_LoggedOut" />
+ </span>
+ <div>
+ <a href="http://dotnetopenauth.net">
+ <img runat="server" src="~/images/DotNetOpenAuth.png" title="Jump to the project web site."
+ alt="DotNetOpenAuth" border='0' /></a>
+ </div>
+ <div>
+ <asp:ContentPlaceHolder ID="Main" runat="server" />
+ </div>
+ </form>
+</body>
+</html>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx
new file mode 100644
index 0000000..8df914b
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx
@@ -0,0 +1,16 @@
+<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="TracePage.aspx.vb" Inherits="OpenIdRelyingPartyWebFormsVB.TracePage" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head id="Head1" runat="server">
+ <title></title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <p align="right">
+ <asp:Button runat="server" Text="Clear log" ID="clearLogButton" OnClick="clearLogButton_Click" />
+ </p>
+ <pre><asp:PlaceHolder runat="server" ID="placeHolder1" /></pre>
+ </form>
+</body>
+</html>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.designer.vb b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.designer.vb
new file mode 100644
index 0000000..9928c68
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.designer.vb
@@ -0,0 +1,53 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:2.0.50727.4927
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+
+Partial Public Class TracePage
+
+ '''<summary>
+ '''Head1 control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents Head1 As Global.System.Web.UI.HtmlControls.HtmlHead
+
+ '''<summary>
+ '''form1 control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents form1 As Global.System.Web.UI.HtmlControls.HtmlForm
+
+ '''<summary>
+ '''clearLogButton control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents clearLogButton As Global.System.Web.UI.WebControls.Button
+
+ '''<summary>
+ '''placeHolder1 control.
+ '''</summary>
+ '''<remarks>
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''</remarks>
+ Protected WithEvents placeHolder1 As Global.System.Web.UI.WebControls.PlaceHolder
+End Class
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.vb b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.vb
new file mode 100644
index 0000000..9a1b8c1
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/TracePage.aspx.vb
@@ -0,0 +1,13 @@
+Public Class TracePage
+ Inherits System.Web.UI.Page
+
+ Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
+ Me.placeHolder1.Controls.Add(New Label() With {.Text = HttpUtility.HtmlEncode(Global_asax.LogMessages.ToString())})
+ End Sub
+
+ Protected Sub clearLogButton_Click(ByVal sender As Object, ByVal e As EventArgs)
+ Global_asax.LogMessages.Length = 0
+ ' clear the page immediately, and allow for F5 without a Postback warning.
+ Me.Response.Redirect(Me.Request.Url.AbsoluteUri)
+ End Sub
+End Class \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/Web.config b/samples/OpenIdRelyingPartyWebFormsVB/Web.config
new file mode 100644
index 0000000..36174a5
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/Web.config
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<configuration>
+ <configSections>
+ <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" />
+ <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/>
+ </configSections>
+
+ <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
+ which is necessary for OpenID urls with unicode characters in the domain/host name.
+ It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
+ <uri>
+ <idn enabled="All"/>
+ <iriParsing enabled="true"/>
+ </uri>
+
+ <system.net>
+ <defaultProxy enabled="true" />
+ <settings>
+ <!-- This setting causes .NET to check certificate revocation lists (CRL)
+ before trusting HTTPS certificates. But this setting tends to not
+ be allowed in shared hosting environments. -->
+ <!--<servicePointManager checkCertificateRevocationList="true"/>-->
+ </settings>
+ </system.net>
+
+ <!-- this is an optional configuration section where aspects of dotnetopenauth can be customized -->
+ <dotNetOpenAuth>
+ <openid>
+ <relyingParty>
+ <security requireSsl="false" />
+ <behaviors>
+ <!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible
+ with OPs that use Attribute Exchange (in various formats). -->
+ <add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" />
+ <!--<add type="DotNetOpenAuth.OpenId.Behaviors.GsaIcamProfile, DotNetOpenAuth" />-->
+ </behaviors>
+ <!-- Uncomment the following to activate the sample custom store. -->
+ <!--<store type="OpenIdRelyingPartyWebFormsVB.CustomStore, OpenIdRelyingPartyWebFormsVB" />-->
+ </relyingParty>
+ </openid>
+ <messaging>
+ <untrustedWebRequest>
+ <whitelistHosts>
+ <!-- since this is a sample, and will often be used with localhost -->
+ <add name="localhost" />
+ </whitelistHosts>
+ </untrustedWebRequest>
+ </messaging>
+ <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. -->
+ <reporting enabled="true" />
+ </dotNetOpenAuth>
+
+ <appSettings>
+ <!-- Fill in your various consumer keys and secrets here to make the sample work. -->
+ <!-- You must get these values by signing up with each individual service provider. -->
+ <!-- Google sign-up: https://www.google.com/accounts/ManageDomains -->
+ <add key="googleConsumerKey" value="demo.dotnetopenauth.net"/>
+ <add key="googleConsumerSecret" value="5Yv1TfKm1551QrXZ9GpqepeD"/>
+ </appSettings>
+
+ <system.web>
+ <!--<sessionState cookieless="true" />-->
+ <compilation debug="true">
+ <assemblies>
+ <remove assembly="DotNetOpenAuth.Contracts"/>
+ </assemblies>
+ </compilation>
+ <customErrors mode="RemoteOnly"/>
+ <authentication mode="Forms">
+ <forms name="OpenIdRelyingPartyVBSession"/> <!-- named cookie prevents conflicts with other samples -->
+ </authentication>
+ <trace enabled="false" writeToDiagnosticsTrace="true" />
+ <!-- Trust level discussion:
+ Full: everything works (this is required for Google Apps for Domains support)
+ High: TRACE compilation symbol must NOT be defined
+ Medium: doesn't work unless originUrl=".*" or WebPermission.Connect is extended, and Google Apps doesn't work.
+ Low: doesn't work because WebPermission.Connect is denied.
+ -->
+ <trust level="Medium" originUrl=".*"/>
+ </system.web>
+
+ <!-- log4net is a 3rd party (free) logger library that DotNetOpenAuth will use if present but does not require. -->
+ <log4net>
+ <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
+ <file value="RelyingParty.log" />
+ <appendToFile value="true" />
+ <rollingStyle value="Size" />
+ <maxSizeRollBackups value="10" />
+ <maximumFileSize value="100KB" />
+ <staticLogFileName value="true" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline" />
+ </layout>
+ </appender>
+ <appender name="TracePageAppender" type="OpenIdRelyingPartyWebFormsVB.TracePageAppender, OpenIdRelyingPartyWebFormsVB">
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline" />
+ </layout>
+ </appender>
+ <!-- Setup the root category, add the appenders and set the default level -->
+ <root>
+ <level value="INFO" />
+ <!--<appender-ref ref="RollingFileAppender" />-->
+ <appender-ref ref="TracePageAppender" />
+ </root>
+ <!-- Specify the level for some specific categories -->
+ <logger name="DotNetOpenAuth">
+ <level value="INFO" />
+ </logger>
+ </log4net>
+
+ <runtime>
+ <legacyHMACWarning enabled="0" />
+ </runtime>
+</configuration>
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/favicon.ico b/samples/OpenIdRelyingPartyWebFormsVB/favicon.ico
new file mode 100644
index 0000000..e227dbe
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/favicon.ico
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/images/DotNetOpenAuth.png b/samples/OpenIdRelyingPartyWebFormsVB/images/DotNetOpenAuth.png
new file mode 100644
index 0000000..442b986
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/images/DotNetOpenAuth.png
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/images/attention.png b/samples/OpenIdRelyingPartyWebFormsVB/images/attention.png
new file mode 100644
index 0000000..8003700
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/images/attention.png
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/images/openid_login.png b/samples/OpenIdRelyingPartyWebFormsVB/images/openid_login.png
new file mode 100644
index 0000000..caebd58
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/images/openid_login.png
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/images/yahoo.png b/samples/OpenIdRelyingPartyWebFormsVB/images/yahoo.png
new file mode 100644
index 0000000..3129217
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/images/yahoo.png
Binary files differ
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/styles.css b/samples/OpenIdRelyingPartyWebFormsVB/styles.css
new file mode 100644
index 0000000..2e4d3db
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/styles.css
@@ -0,0 +1,10 @@
+h2
+{
+ font-style: italic;
+}
+
+body
+{
+ font-family: Cambria, Arial, Times New Roman;
+ font-size: 12pt;
+} \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebFormsVB/xrds.aspx b/samples/OpenIdRelyingPartyWebFormsVB/xrds.aspx
new file mode 100644
index 0000000..130ca30
--- /dev/null
+++ b/samples/OpenIdRelyingPartyWebFormsVB/xrds.aspx
@@ -0,0 +1,29 @@
+<%@ Page Language="VB" AutoEventWireup="true" ContentType="application/xrds+xml" %><?xml version="1.0" encoding="UTF-8"?>
+<%--
+This page is a required for relying party discovery per OpenID 2.0.
+It allows Providers to call back to the relying party site to confirm the
+identity that it is claiming in the realm and return_to URLs.
+This page should be pointed to by the 'realm' home page, which in this sample
+is default.aspx.
+--%>
+<xrds:XRDS
+ xmlns:xrds="xri://$xrds"
+ xmlns:openid="http://openid.net/xmlns/1.0"
+ xmlns="xri://$xrd*($v*2.0)">
+ <XRD>
+ <Service priority="1">
+ <Type>http://specs.openid.net/auth/2.0/return_to</Type>
+ <%-- Every page with an OpenID login should be listed here. --%>
+ <URI priority="1"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/login.aspx"))%></URI>
+ <URI priority="2"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/loginProgrammatic.aspx"))%></URI>
+ <URI priority="3"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/ajaxlogin.aspx"))%></URI>
+ <URI priority="4"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/NoIdentityOpenId.aspx"))%></URI>
+ <URI priority="5"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/loginPlusOAuth.aspx"))%></URI>
+ <URI priority="6"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/loginPlusOAuthSampleOP.aspx"))%></URI>
+ </Service>
+ <Service>
+ <Type>http://specs.openid.net/extensions/ui/icon</Type>
+ <URI><%=New Uri(Request.Url, Response.ApplyAppPathModifier("~/images/DotNetOpenAuth.png"))%></URI>
+ </Service>
+ </XRD>
+</xrds:XRDS>
diff --git a/samples/OpenIdWebRingSsoProvider/App_Data/Users.xml b/samples/OpenIdWebRingSsoProvider/App_Data/Users.xml
new file mode 100644
index 0000000..cffe009
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/App_Data/Users.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<Users>
+ <User>
+ <UserName>bob</UserName>
+ <Password>test</Password>
+ </User>
+ <User>
+ <UserName>bob1</UserName>
+ <Password>test</Password>
+ </User>
+ <User>
+ <UserName>bob2</UserName>
+ <Password>test</Password>
+ </User>
+ <User>
+ <UserName>bob3</UserName>
+ <Password>test</Password>
+ </User>
+ <User>
+ <UserName>bob4</UserName>
+ <Password>test</Password>
+ </User>
+</Users>
diff --git a/samples/OpenIdWebRingSsoProvider/Code/ReadOnlyXmlMembershipProvider.cs b/samples/OpenIdWebRingSsoProvider/Code/ReadOnlyXmlMembershipProvider.cs
new file mode 100644
index 0000000..489d78b
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Code/ReadOnlyXmlMembershipProvider.cs
@@ -0,0 +1,276 @@
+//-----------------------------------------------------------------------
+// <copyright file="ReadOnlyXmlMembershipProvider.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace OpenIdWebRingSsoProvider.Code {
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.Specialized;
+ using System.Configuration.Provider;
+ using System.Security.Permissions;
+ using System.Web;
+ using System.Web.Hosting;
+ using System.Web.Security;
+ using System.Xml;
+
+ public class ReadOnlyXmlMembershipProvider : MembershipProvider {
+ private Dictionary<string, MembershipUser> users;
+ private string xmlFileName;
+
+ // MembershipProvider Properties
+ public override string ApplicationName {
+ get { throw new NotSupportedException(); }
+ set { throw new NotSupportedException(); }
+ }
+
+ public override bool EnablePasswordRetrieval {
+ get { return false; }
+ }
+
+ public override bool EnablePasswordReset {
+ get { return false; }
+ }
+
+ public override int MaxInvalidPasswordAttempts {
+ get { throw new NotSupportedException(); }
+ }
+
+ public override int MinRequiredNonAlphanumericCharacters {
+ get { throw new NotSupportedException(); }
+ }
+
+ public override int MinRequiredPasswordLength {
+ get { throw new NotSupportedException(); }
+ }
+
+ public override int PasswordAttemptWindow {
+ get { throw new NotSupportedException(); }
+ }
+
+ public override MembershipPasswordFormat PasswordFormat {
+ get { throw new NotSupportedException(); }
+ }
+
+ public override string PasswordStrengthRegularExpression {
+ get { throw new NotSupportedException(); }
+ }
+
+ public override bool RequiresQuestionAndAnswer {
+ get { throw new NotSupportedException(); }
+ }
+
+ public override bool RequiresUniqueEmail {
+ get { throw new NotSupportedException(); }
+ }
+
+ // MembershipProvider Methods
+ public override void Initialize(string name, NameValueCollection config) {
+ // Verify that config isn't null
+ if (config == null) {
+ throw new ArgumentNullException("config");
+ }
+
+ // Assign the provider a default name if it doesn't have one
+ if (string.IsNullOrEmpty(name)) {
+ name = "ReadOnlyXmlMembershipProvider";
+ }
+
+ // Add a default "description" attribute to config if the
+ // attribute doesn't exist or is empty
+ if (string.IsNullOrEmpty(config["description"])) {
+ config.Remove("description");
+ config.Add("description", "Read-only XML membership provider");
+ }
+
+ // Call the base class's Initialize method
+ base.Initialize(name, config);
+
+ // Initialize _XmlFileName and make sure the path
+ // is app-relative
+ string path = config["xmlFileName"];
+
+ if (string.IsNullOrEmpty(path)) {
+ path = "~/App_Data/Users.xml";
+ }
+
+ if (!VirtualPathUtility.IsAppRelative(path)) {
+ throw new ArgumentException("xmlFileName must be app-relative");
+ }
+
+ string fullyQualifiedPath = VirtualPathUtility.Combine(
+ VirtualPathUtility.AppendTrailingSlash(HttpRuntime.AppDomainAppVirtualPath),
+ path);
+
+ this.xmlFileName = HostingEnvironment.MapPath(fullyQualifiedPath);
+ config.Remove("xmlFileName");
+
+ // Make sure we have permission to read the XML data source and
+ // throw an exception if we don't
+ FileIOPermission permission = new FileIOPermission(FileIOPermissionAccess.Read, this.xmlFileName);
+ permission.Demand();
+
+ // Throw an exception if unrecognized attributes remain
+ if (config.Count > 0) {
+ string attr = config.GetKey(0);
+ if (!string.IsNullOrEmpty(attr)) {
+ throw new ProviderException("Unrecognized attribute: " + attr);
+ }
+ }
+ }
+
+ public override bool ValidateUser(string username, string password) {
+ // Validate input parameters
+ if (string.IsNullOrEmpty(username) ||
+ string.IsNullOrEmpty(password)) {
+ return false;
+ }
+
+ try {
+ // Make sure the data source has been loaded
+ this.ReadMembershipDataStore();
+
+ // Validate the user name and password
+ MembershipUser user;
+ if (this.users.TryGetValue(username, out user)) {
+ if (user.Comment == password) { // Case-sensitive
+ // NOTE: A read/write membership provider
+ // would update the user's LastLoginDate here.
+ // A fully featured provider would also fire
+ // an AuditMembershipAuthenticationSuccess
+ // Web event
+ return true;
+ }
+ }
+
+ // NOTE: A fully featured membership provider would
+ // fire an AuditMembershipAuthenticationFailure
+ // Web event here
+ return false;
+ } catch (Exception) {
+ return false;
+ }
+ }
+
+ public override MembershipUser GetUser(string username, bool userIsOnline) {
+ // Note: This implementation ignores userIsOnline
+
+ // Validate input parameters
+ if (string.IsNullOrEmpty(username)) {
+ return null;
+ }
+
+ // Make sure the data source has been loaded
+ this.ReadMembershipDataStore();
+
+ // Retrieve the user from the data source
+ MembershipUser user;
+ if (this.users.TryGetValue(username, out user)) {
+ return user;
+ }
+
+ return null;
+ }
+
+ public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords) {
+ // Note: This implementation ignores pageIndex and pageSize,
+ // and it doesn't sort the MembershipUser objects returned
+
+ // Make sure the data source has been loaded
+ this.ReadMembershipDataStore();
+
+ MembershipUserCollection users = new MembershipUserCollection();
+
+ foreach (KeyValuePair<string, MembershipUser> pair in this.users) {
+ users.Add(pair.Value);
+ }
+
+ totalRecords = users.Count;
+ return users;
+ }
+
+ public override int GetNumberOfUsersOnline() {
+ throw new NotSupportedException();
+ }
+
+ public override bool ChangePassword(string username, string oldPassword, string newPassword) {
+ throw new NotSupportedException();
+ }
+
+ public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer) {
+ throw new NotSupportedException();
+ }
+
+ public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) {
+ throw new NotSupportedException();
+ }
+
+ public override bool DeleteUser(string username, bool deleteAllRelatedData) {
+ throw new NotSupportedException();
+ }
+
+ public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords) {
+ throw new NotSupportedException();
+ }
+
+ public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) {
+ throw new NotSupportedException();
+ }
+
+ public override string GetPassword(string username, string answer) {
+ throw new NotSupportedException();
+ }
+
+ public override MembershipUser GetUser(object providerUserKey, bool userIsOnline) {
+ throw new NotSupportedException();
+ }
+
+ public override string GetUserNameByEmail(string email) {
+ throw new NotSupportedException();
+ }
+
+ public override string ResetPassword(string username, string answer) {
+ throw new NotSupportedException();
+ }
+
+ public override bool UnlockUser(string userName) {
+ throw new NotSupportedException();
+ }
+
+ public override void UpdateUser(MembershipUser user) {
+ throw new NotSupportedException();
+ }
+
+ // Helper method
+ private void ReadMembershipDataStore() {
+ lock (this) {
+ if (this.users == null) {
+ this.users = new Dictionary<string, MembershipUser>(16, StringComparer.InvariantCultureIgnoreCase);
+ XmlDocument doc = new XmlDocument();
+ doc.Load(this.xmlFileName);
+ XmlNodeList nodes = doc.GetElementsByTagName("User");
+
+ foreach (XmlNode node in nodes) {
+ MembershipUser user = new MembershipUser(
+ Name, // Provider name
+ node["UserName"].InnerText, // Username
+ null, // providerUserKey
+ null, // Email
+ string.Empty, // passwordQuestion
+ node["Password"].InnerText, // Comment
+ true, // isApproved
+ false, // isLockedOut
+ DateTime.Now, // creationDate
+ DateTime.Now, // lastLoginDate
+ DateTime.Now, // lastActivityDate
+ DateTime.Now, // lastPasswordChangedDate
+ new DateTime(1980, 1, 1)); // lastLockoutDate
+
+ this.users.Add(user.UserName, user);
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OpenIdWebRingSsoProvider/Code/Util.cs b/samples/OpenIdWebRingSsoProvider/Code/Util.cs
new file mode 100644
index 0000000..5a3a2fc
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Code/Util.cs
@@ -0,0 +1,115 @@
+//-----------------------------------------------------------------------
+// <copyright file="Util.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace OpenIdWebRingSsoProvider.Code {
+ using System;
+ using System.Configuration;
+ using System.Web;
+ using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
+ using DotNetOpenAuth.OpenId.Provider;
+
+ public class Util {
+ private const string RolesAttribute = "http://samples.dotnetopenauth.net/sso/roles";
+
+ /// <summary>
+ /// Gets a value indicating whether the authentication system used by the OP requires
+ /// no user interaction (an HTTP header based authentication protocol).
+ /// </summary>
+ internal static bool ImplicitAuth {
+ get {
+ // This should return false if using FormsAuthentication.
+ return bool.Parse(ConfigurationManager.AppSettings["ImplicitAuth"]);
+ }
+ }
+
+ public static string ExtractUserName(Uri url) {
+ return url.Segments[url.Segments.Length - 1];
+ }
+
+ public static string ExtractUserName(Identifier identifier) {
+ return ExtractUserName(new Uri(identifier.ToString()));
+ }
+
+ public static Identifier BuildIdentityUrl() {
+ string username = HttpContext.Current.User.Identity.Name;
+ int slash = username.IndexOf('\\');
+ if (slash >= 0) {
+ username = username.Substring(slash + 1);
+ }
+ return BuildIdentityUrl(username);
+ }
+
+ public static Identifier BuildIdentityUrl(string username) {
+ // This sample Provider has a custom policy for normalizing URIs, which is that the whole
+ // path of the URI be lowercase except for the first letter of the username.
+ username = username.Substring(0, 1).ToUpperInvariant() + username.Substring(1).ToLowerInvariant();
+ return new Uri(HttpContext.Current.Request.Url, HttpContext.Current.Response.ApplyAppPathModifier("~/user.aspx/" + username));
+ }
+
+ internal static void ProcessAuthenticationChallenge(IAuthenticationRequest idrequest) {
+ // Verify that RP discovery is successful.
+ if (idrequest.IsReturnUrlDiscoverable(ProviderEndpoint.Provider) != RelyingPartyDiscoveryResult.Success) {
+ idrequest.IsAuthenticated = false;
+ return;
+ }
+
+ // Verify that the RP is on the whitelist. Realms are case sensitive.
+ string[] whitelist = ConfigurationManager.AppSettings["whitelistedRealms"].Split(';');
+ if (Array.IndexOf(whitelist, idrequest.Realm.ToString()) < 0) {
+ idrequest.IsAuthenticated = false;
+ return;
+ }
+
+ if (idrequest.IsDirectedIdentity) {
+ if (HttpContext.Current.User.Identity.IsAuthenticated) {
+ idrequest.LocalIdentifier = Util.BuildIdentityUrl();
+ idrequest.IsAuthenticated = true;
+ } else {
+ // If the RP demands an immediate answer, or if we're using implicit authentication
+ // and therefore have nothing further to ask the user, just reject the authentication.
+ if (idrequest.Immediate || ImplicitAuth) {
+ idrequest.IsAuthenticated = false;
+ } else {
+ // Send the user to a page to actually log into the OP.
+ if (!HttpContext.Current.Request.Path.EndsWith("Login.aspx", StringComparison.OrdinalIgnoreCase)) {
+ HttpContext.Current.Response.Redirect("~/Login.aspx");
+ }
+ }
+ }
+ } else {
+ string userOwningOpenIdUrl = Util.ExtractUserName(idrequest.LocalIdentifier);
+
+ // NOTE: in a production provider site, you may want to only
+ // respond affirmatively if the user has already authorized this consumer
+ // to know the answer.
+ idrequest.IsAuthenticated = userOwningOpenIdUrl == HttpContext.Current.User.Identity.Name;
+
+ if (!idrequest.IsAuthenticated.Value && !ImplicitAuth && !idrequest.Immediate) {
+ // Send the user to a page to actually log into the OP.
+ if (!HttpContext.Current.Request.Path.EndsWith("Login.aspx", StringComparison.OrdinalIgnoreCase)) {
+ HttpContext.Current.Response.Redirect("~/Login.aspx");
+ }
+ }
+ }
+
+ if (idrequest.IsAuthenticated.Value) {
+ // add extension responses here.
+ var fetchRequest = idrequest.GetExtension<FetchRequest>();
+ if (fetchRequest != null) {
+ var fetchResponse = new FetchResponse();
+ if (fetchRequest.Attributes.Contains(RolesAttribute)) {
+ // Inform the RP what roles this user should fill
+ // These roles would normally come out of the user database
+ // or Windows security groups.
+ fetchResponse.Attributes.Add(RolesAttribute, "Member", "Admin");
+ }
+ idrequest.AddResponseExtension(fetchResponse);
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OpenIdWebRingSsoProvider/Default.aspx b/samples/OpenIdWebRingSsoProvider/Default.aspx
new file mode 100644
index 0000000..9bddc98
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Default.aspx
@@ -0,0 +1,25 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="OpenIdWebRingSsoProvider._Default" %>
+
+<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth" TagPrefix="openid" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+ <openid:XrdsPublisher ID="XrdsPublisher1" runat="server" XrdsUrl="~/op_xrds.aspx" />
+</head>
+<body>
+ <form id="form1" runat="server">
+ <p>
+ This sample is of an OpenID Provider that acts within a controlled set of web
+ sites (perhaps all belonging to the same organization).&nbsp; It authenticates
+ the user in its own way (Windows Auth, username/password, InfoCard, X.509,
+ anything), and then sends an automatically OpenID assertion to a limited set of
+ whitelisted RPs without prompting the user.
+ </p>
+ <p>
+ This particular sample uses Windows Authentication so that when the user visits
+ an RP and the RP sends the user to this OP for authentication, the process is
+ completely implicit -- the user never sees the OP.</p>
+ </form>
+</body>
+</html>
diff --git a/samples/OpenIdWebRingSsoProvider/Default.aspx.cs b/samples/OpenIdWebRingSsoProvider/Default.aspx.cs
new file mode 100644
index 0000000..d7e5310
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Default.aspx.cs
@@ -0,0 +1,22 @@
+namespace OpenIdWebRingSsoProvider {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using DotNetOpenAuth.OpenId.Provider;
+ using OpenIdWebRingSsoProvider.Code;
+
+ public partial class _Default : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ // The user may have just completed a login. If they're logged in, see if we can complete the OpenID login.
+ if (User.Identity.IsAuthenticated && ProviderEndpoint.PendingAuthenticationRequest != null) {
+ Util.ProcessAuthenticationChallenge(ProviderEndpoint.PendingAuthenticationRequest);
+ if (ProviderEndpoint.PendingAuthenticationRequest.IsAuthenticated.HasValue) {
+ ProviderEndpoint.SendResponse();
+ }
+ }
+ }
+ }
+}
diff --git a/samples/OpenIdWebRingSsoProvider/Default.aspx.designer.cs b/samples/OpenIdWebRingSsoProvider/Default.aspx.designer.cs
new file mode 100644
index 0000000..b2f84f7
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Default.aspx.designer.cs
@@ -0,0 +1,34 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OpenIdWebRingSsoProvider {
+
+
+ public partial class _Default {
+
+ /// <summary>
+ /// XrdsPublisher1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::DotNetOpenAuth.XrdsPublisher XrdsPublisher1;
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+ }
+}
diff --git a/samples/OpenIdWebRingSsoProvider/Login.aspx b/samples/OpenIdWebRingSsoProvider/Login.aspx
new file mode 100644
index 0000000..336b8ad
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Login.aspx
@@ -0,0 +1,49 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="OpenIdWebRingSsoProvider.Login" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <p>
+ Usernames are defined in the App_Data\Users.xml file.
+ </p>
+ <div style="display: none" id="loginDiv">
+ <asp:Login runat="server" ID="login1" />
+ </div>
+ <div id="javascriptDisabled">
+ <b>Javascript appears to be disabled in your browser. </b>This page requires Javascript
+ to be enabled to better protect your security.
+ </div>
+ <p>
+ <asp:Button ID="cancelButton" runat="server" onclick="cancelButton_Click"
+ Text="Cancel Login" />
+ </p>
+ <p>Credentials to try (each with their own OpenID)</p>
+ <table>
+ <tr><td>Username</td><td>Password</td></tr>
+ <tr><td>bob</td><td>test</td></tr>
+ <tr><td>bob1</td><td>test</td></tr>
+ <tr><td>bob2</td><td>test</td></tr>
+ <tr><td>bob3</td><td>test</td></tr>
+ <tr><td>bob4</td><td>test</td></tr>
+ </table>
+ <script language="javascript" type="text/javascript">
+ //<![CDATA[
+ // we use HTML to hide the action buttons and Javascript to show them
+ // to protect against click-jacking in an iframe whose javascript is disabled.
+ document.getElementById('loginDiv').style.display = 'block';
+ document.getElementById('javascriptDisabled').style.display = 'none';
+
+ // Frame busting code (to protect us from being hosted in an iframe).
+ // This protects us from click-jacking.
+ if (document.location !== window.top.location) {
+ window.top.location = document.location;
+ }
+ //]]>
+ </script>
+ </form>
+</body>
+</html>
diff --git a/samples/OpenIdWebRingSsoProvider/Login.aspx.cs b/samples/OpenIdWebRingSsoProvider/Login.aspx.cs
new file mode 100644
index 0000000..584cff7
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Login.aspx.cs
@@ -0,0 +1,45 @@
+namespace OpenIdWebRingSsoProvider {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using DotNetOpenAuth.OpenId.Provider;
+ using OpenIdWebRingSsoProvider.Code;
+
+ /// <summary>
+ /// Challenges the user to authenticate to the OpenID SSO Provider.
+ /// </summary>
+ /// <remarks>
+ /// This login page is used only when the Provider is configured for
+ /// FormsAuthentication. The default configuration is to use
+ /// Windows authentication.
+ /// </remarks>
+ public partial class Login : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ // This site doesn't need XSRF protection because only trusted RPs are ever allowed to receive authentication results
+ // and because the login page itself is the only page the user could ever see as an in-between step to logging in,
+ // and a login form isn't vulnerable to XSRF.
+ if (!IsPostBack) {
+ if (ProviderEndpoint.PendingAuthenticationRequest != null) {
+ if (!ProviderEndpoint.PendingAuthenticationRequest.IsDirectedIdentity) {
+ this.login1.UserName = Code.Util.ExtractUserName(
+ ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier);
+ ((TextBox)this.login1.FindControl("UserName")).ReadOnly = true;
+ this.login1.FindControl("Password").Focus();
+ }
+ }
+ this.cancelButton.Visible = ProviderEndpoint.PendingAuthenticationRequest != null;
+ }
+ }
+
+ protected void cancelButton_Click(object sender, EventArgs e) {
+ var req = ProviderEndpoint.PendingAuthenticationRequest;
+ if (req != null) {
+ req.IsAuthenticated = false;
+ ProviderEndpoint.SendResponse();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OpenIdRelyingPartyWebForms/m/Login.aspx.designer.cs b/samples/OpenIdWebRingSsoProvider/Login.aspx.designer.cs
index e55b802..7280ec7 100644
--- a/samples/OpenIdRelyingPartyWebForms/m/Login.aspx.designer.cs
+++ b/samples/OpenIdWebRingSsoProvider/Login.aspx.designer.cs
@@ -1,14 +1,13 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4912
//
// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
+// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
-namespace OpenIdRelyingPartyWebForms.m {
+namespace OpenIdWebRingSsoProvider {
public partial class Login {
@@ -20,24 +19,24 @@ namespace OpenIdRelyingPartyWebForms.m {
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
- protected global::System.Web.UI.MobileControls.Form form1;
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
- /// openIdTextBox control.
+ /// login1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
- protected global::DotNetOpenAuth.OpenId.RelyingParty.OpenIdMobileTextBox openIdTextBox;
+ protected global::System.Web.UI.WebControls.Login login1;
/// <summary>
- /// loginButton control.
+ /// cancelButton control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
- protected global::System.Web.UI.MobileControls.Command loginButton;
+ protected global::System.Web.UI.WebControls.Button cancelButton;
}
}
diff --git a/samples/OpenIdWebRingSsoProvider/OpenIdWebRingSsoProvider.csproj b/samples/OpenIdWebRingSsoProvider/OpenIdWebRingSsoProvider.csproj
new file mode 100644
index 0000000..e2081c5
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/OpenIdWebRingSsoProvider.csproj
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4}</ProjectGuid>
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>OpenIdWebRingSsoProvider</RootNamespace>
+ <AssemblyName>OpenIdWebRingSsoProvider</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Web.DynamicData" />
+ <Reference Include="System.Web.Entity" />
+ <Reference Include="System.Web.Extensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.EnterpriseServices" />
+ <Reference Include="System.Web.Mobile" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Web.ApplicationServices">
+ <RequiredTargetFramework>v4.0</RequiredTargetFramework>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="App_Data\Users.xml" />
+ <Content Include="Default.aspx" />
+ <Content Include="Login.aspx" />
+ <Content Include="op_xrds.aspx" />
+ <Content Include="Server.aspx" />
+ <Content Include="user.aspx" />
+ <Content Include="user_xrds.aspx" />
+ <Content Include="Web.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Code\ReadOnlyXmlMembershipProvider.cs" />
+ <Compile Include="Code\Util.cs" />
+ <Compile Include="Default.aspx.cs">
+ <SubType>ASPXCodeBehind</SubType>
+ <DependentUpon>Default.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Default.aspx.designer.cs">
+ <DependentUpon>Default.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Login.aspx.cs">
+ <DependentUpon>Login.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Login.aspx.designer.cs">
+ <DependentUpon>Login.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Server.aspx.cs">
+ <DependentUpon>Server.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Server.aspx.designer.cs">
+ <DependentUpon>Server.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="user.aspx.cs">
+ <DependentUpon>user.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="user.aspx.designer.cs">
+ <DependentUpon>user.aspx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\DotNetOpenAuth\DotNetOpenAuth.csproj">
+ <Project>{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}</Project>
+ <Name>DotNetOpenAuth</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup />
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+ <WebProjectProperties>
+ <UseIIS>False</UseIIS>
+ <AutoAssignPort>False</AutoAssignPort>
+ <DevelopmentServerPort>39167</DevelopmentServerPort>
+ <DevelopmentServerVPath>/</DevelopmentServerVPath>
+ <IISUrl>
+ </IISUrl>
+ <NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
+ <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+ </WebProjectProperties>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+</Project> \ No newline at end of file
diff --git a/samples/OpenIdWebRingSsoProvider/Properties/AssemblyInfo.cs b/samples/OpenIdWebRingSsoProvider/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..41e7441
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OpenIdWebRingSsoProvider")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft IT")]
+[assembly: AssemblyProduct("OpenIdWebRingSsoProvider")]
+[assembly: AssemblyCopyright("Copyright © Microsoft IT 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/samples/OpenIdWebRingSsoProvider/Server.aspx b/samples/OpenIdWebRingSsoProvider/Server.aspx
new file mode 100644
index 0000000..b6fa69d
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Server.aspx
@@ -0,0 +1,17 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Server.aspx.cs" Inherits="OpenIdWebRingSsoProvider.Server" ValidateRequest="false" %>
+
+<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.Provider"
+ TagPrefix="openid" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+ <openid:ProviderEndpoint runat="server" ID="providerEndpoint1" OnAuthenticationChallenge="providerEndpoint1_AuthenticationChallenge" />
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+ </div>
+ </form>
+</body>
+</html>
diff --git a/samples/OpenIdWebRingSsoProvider/Server.aspx.cs b/samples/OpenIdWebRingSsoProvider/Server.aspx.cs
new file mode 100644
index 0000000..101e608
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Server.aspx.cs
@@ -0,0 +1,19 @@
+namespace OpenIdWebRingSsoProvider {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using DotNetOpenAuth.OpenId.Provider;
+ using OpenIdWebRingSsoProvider.Code;
+
+ public partial class Server : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ }
+
+ protected void providerEndpoint1_AuthenticationChallenge(object sender, AuthenticationChallengeEventArgs e) {
+ Util.ProcessAuthenticationChallenge(e.Request);
+ }
+ }
+}
diff --git a/samples/OpenIdWebRingSsoProvider/Server.aspx.designer.cs b/samples/OpenIdWebRingSsoProvider/Server.aspx.designer.cs
new file mode 100644
index 0000000..e969cb2
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Server.aspx.designer.cs
@@ -0,0 +1,33 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OpenIdWebRingSsoProvider {
+
+
+ public partial class Server {
+
+ /// <summary>
+ /// providerEndpoint1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::DotNetOpenAuth.OpenId.Provider.ProviderEndpoint providerEndpoint1;
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+ }
+}
diff --git a/samples/OpenIdWebRingSsoProvider/Web.config b/samples/OpenIdWebRingSsoProvider/Web.config
new file mode 100644
index 0000000..87fde10
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/Web.config
@@ -0,0 +1,183 @@
+<?xml version="1.0"?>
+<configuration>
+ <configSections>
+ <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false"/>
+ <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/>
+ <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
+ <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
+ <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
+ <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
+ </sectionGroup>
+ </sectionGroup>
+ </sectionGroup>
+ </configSections>
+
+ <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
+ which is necessary for OpenID urls with unicode characters in the domain/host name.
+ It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
+ <uri>
+ <idn enabled="All"/>
+ <iriParsing enabled="true"/>
+ </uri>
+
+ <system.net>
+ <defaultProxy enabled="true" />
+ <settings>
+ <!-- This setting causes .NET to check certificate revocation lists (CRL)
+ before trusting HTTPS certificates. But this setting tends to not
+ be allowed in shared hosting environments. -->
+ <!--<servicePointManager checkCertificateRevocationList="true"/>-->
+ </settings>
+ </system.net>
+
+ <!-- this is an optional configuration section where aspects of DotNetOpenAuth can be customized -->
+ <dotNetOpenAuth>
+ <openid>
+ <provider>
+ <security requireSsl="false" />
+ <behaviors>
+ <!-- Behaviors activate themselves automatically for individual matching requests.
+ The first one in this list to match an incoming request "owns" the request. If no
+ profile matches, the default behavior is assumed. -->
+ <!--<add type="DotNetOpenAuth.OpenId.Behaviors.PpidGeneration, DotNetOpenAuth" />-->
+ </behaviors>
+ </provider>
+ </openid>
+ <messaging>
+ <untrustedWebRequest>
+ <whitelistHosts>
+ <!-- since this is a sample, and will often be used with localhost -->
+ <add name="localhost"/>
+ </whitelistHosts>
+ </untrustedWebRequest>
+ </messaging>
+ <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. -->
+ <reporting enabled="true" />
+ </dotNetOpenAuth>
+
+ <appSettings>
+ <add key="whitelistedRealms" value="http://localhost:39165/;http://othertrustedrealm/"/>
+ <!-- Set ImplicitAuth to true when using Windows auth, or false for FormsAuthentication -->
+ <add key="ImplicitAuth" value="true"/>
+ </appSettings>
+ <connectionStrings/>
+
+ <system.web>
+ <!--
+ Set compilation debug="true" to insert debugging
+ symbols into the compiled page. Because this
+ affects performance, set this value to true only
+ during development.
+ -->
+ <compilation debug="false">
+
+ <assemblies>
+ <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <remove assembly="DotNetOpenAuth.Contracts"/>
+ </assemblies>
+
+ </compilation>
+ <!-- this sample-only provider uses the hard-coded list of users in the App_Data\Users.xml file -->
+ <membership defaultProvider="AspNetReadOnlyXmlMembershipProvider">
+ <providers>
+ <clear/>
+ <add name="AspNetReadOnlyXmlMembershipProvider" type="OpenIdWebRingSsoProvider.Code.ReadOnlyXmlMembershipProvider" description="Read-only XML membership provider" xmlFileName="~/App_Data/Users.xml"/>
+ </providers>
+ </membership>
+ <!--
+ The <authentication> section enables configuration
+ of the security authentication mode used by
+ ASP.NET to identify an incoming user.
+ -->
+ <authentication mode="Windows" />
+ <!--<authentication mode="Forms">
+ --><!-- named cookie prevents conflicts with other samples --><!--
+ <forms name="OpenIDWebRingSsoProvider"/>
+ </authentication>-->
+ <!--
+ The <customErrors> section enables configuration
+ of what to do if/when an unhandled error occurs
+ during the execution of a request. Specifically,
+ it enables developers to configure html error pages
+ to be displayed in place of a error stack trace.
+
+ <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
+ <error statusCode="403" redirect="NoAccess.htm" />
+ <error statusCode="404" redirect="FileNotFound.htm" />
+ </customErrors>
+ -->
+
+ <pages>
+ <controls>
+ <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </controls>
+ </pages>
+
+ <httpHandlers>
+ <remove verb="*" path="*.asmx"/>
+ <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
+ </httpHandlers>
+ <httpModules>
+ <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </httpModules>
+
+ </system.web>
+
+ <system.codedom>
+ <compilers>
+ <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
+ type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <providerOption name="CompilerVersion" value="v3.5"/>
+ <providerOption name="WarnAsError" value="false"/>
+ </compiler>
+ </compilers>
+ </system.codedom>
+
+ <!--
+ The system.webServer section is required for running ASP.NET AJAX under Internet
+ Information Services 7.0. It is not necessary for previous version of IIS.
+ -->
+ <system.webServer>
+ <validation validateIntegratedModeConfiguration="false"/>
+ <modules>
+ <remove name="ScriptModule" />
+ <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </modules>
+ <handlers>
+ <remove name="WebServiceHandlerFactory-Integrated"/>
+ <remove name="ScriptHandlerFactory" />
+ <remove name="ScriptHandlerFactoryAppServices" />
+ <remove name="ScriptResource" />
+ <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
+ type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
+ type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+ </handlers>
+ </system.webServer>
+
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
+ <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
+ <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+
+</configuration>
diff --git a/samples/OpenIdWebRingSsoProvider/op_xrds.aspx b/samples/OpenIdWebRingSsoProvider/op_xrds.aspx
new file mode 100644
index 0000000..afcfc75
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/op_xrds.aspx
@@ -0,0 +1,19 @@
+<%@ Page Language="C#" AutoEventWireup="true" ContentType="application/xrds+xml" %><?xml version="1.0" encoding="UTF-8"?>
+<%--
+This page is a required as part of the service discovery phase of the openid
+protocol (step 1). It simply renders the xml for doing service discovery of
+server.aspx using the xrds mechanism.
+This XRDS doc is discovered via the user.aspx page.
+--%>
+<xrds:XRDS
+ xmlns:xrds="xri://$xrds"
+ xmlns:openid="http://openid.net/xmlns/1.0"
+ xmlns="xri://$xrd*($v*2.0)">
+ <XRD>
+ <Service priority="10">
+ <Type>http://specs.openid.net/auth/2.0/server</Type>
+ <Type>http://openid.net/extensions/sreg/1.1</Type>
+ <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/server.aspx"))%></URI>
+ </Service>
+ </XRD>
+</xrds:XRDS>
diff --git a/samples/OpenIdWebRingSsoProvider/user.aspx b/samples/OpenIdWebRingSsoProvider/user.aspx
new file mode 100644
index 0000000..0cef559
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/user.aspx
@@ -0,0 +1,22 @@
+<%@ Page Language="C#" AutoEventWireup="true" Inherits="OpenIdWebRingSsoProvider.User"
+ CodeBehind="user.aspx.cs" %>
+
+<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.Provider"
+ TagPrefix="openid" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head id="Head1" runat="server">
+ <openid:IdentityEndpoint ID="IdentityEndpoint20" runat="server" ProviderEndpointUrl="~/Server.aspx"
+ XrdsUrl="~/user_xrds.aspx" ProviderVersion="V20" AutoNormalizeRequest="true"
+ OnNormalizeUri="IdentityEndpoint20_NormalizeUri" />
+ <!-- and for backward compatibility with OpenID 1.x RPs... -->
+ <openid:IdentityEndpoint ID="IdentityEndpoint11" runat="server" ProviderEndpointUrl="~/Server.aspx"
+ ProviderVersion="V11" />
+</head>
+<body>
+ <p>
+ OpenID identity page for
+ <asp:Label runat="server" ID="usernameLabel" EnableViewState="false" />
+ </p>
+</body>
+</html>
diff --git a/samples/OpenIdWebRingSsoProvider/user.aspx.cs b/samples/OpenIdWebRingSsoProvider/user.aspx.cs
new file mode 100644
index 0000000..8050367
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/user.aspx.cs
@@ -0,0 +1,23 @@
+namespace OpenIdWebRingSsoProvider {
+ using System;
+ using DotNetOpenAuth.OpenId.Provider;
+ using OpenIdWebRingSsoProvider.Code;
+
+ /// <summary>
+ /// This page is a required as part of the service discovery phase of the openid protocol (step 1).
+ /// </summary>
+ /// <remarks>
+ /// <para>The XRDS (or Yadis) content is also rendered to provide the consumer with an alternative discovery mechanism. The Yadis protocol allows the consumer
+ /// to provide the user with a more flexible range of authentication mechanisms (which ever has been defined in xrds.aspx). See http://en.wikipedia.org/wiki/Yadis.</para>
+ /// </remarks>
+ public partial class User : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ this.usernameLabel.Text = Util.ExtractUserName(Page.Request.Url);
+ }
+
+ protected void IdentityEndpoint20_NormalizeUri(object sender, IdentityEndpointNormalizationEventArgs e) {
+ string username = Util.ExtractUserName(Page.Request.Url);
+ e.NormalizedIdentifier = new Uri(Util.BuildIdentityUrl(username));
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/OpenIdWebRingSsoProvider/user.aspx.designer.cs b/samples/OpenIdWebRingSsoProvider/user.aspx.designer.cs
new file mode 100644
index 0000000..171c898
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/user.aspx.designer.cs
@@ -0,0 +1,52 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OpenIdWebRingSsoProvider {
+
+
+ public partial class User {
+
+ /// <summary>
+ /// Head1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
+
+ /// <summary>
+ /// IdentityEndpoint20 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::DotNetOpenAuth.OpenId.Provider.IdentityEndpoint IdentityEndpoint20;
+
+ /// <summary>
+ /// IdentityEndpoint11 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::DotNetOpenAuth.OpenId.Provider.IdentityEndpoint IdentityEndpoint11;
+
+ /// <summary>
+ /// usernameLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label usernameLabel;
+ }
+}
diff --git a/samples/OpenIdWebRingSsoProvider/user_xrds.aspx b/samples/OpenIdWebRingSsoProvider/user_xrds.aspx
new file mode 100644
index 0000000..275e413
--- /dev/null
+++ b/samples/OpenIdWebRingSsoProvider/user_xrds.aspx
@@ -0,0 +1,24 @@
+<%@ Page Language="C#" AutoEventWireup="true" ContentType="application/xrds+xml" %><?xml version="1.0" encoding="UTF-8"?>
+<%--
+This page is a required as part of the service discovery phase of the openid
+protocol (step 1). It simply renders the xml for doing service discovery of
+server.aspx using the xrds mechanism.
+This XRDS doc is discovered via the user.aspx page.
+--%>
+<xrds:XRDS
+ xmlns:xrds="xri://$xrds"
+ xmlns:openid="http://openid.net/xmlns/1.0"
+ xmlns="xri://$xrd*($v*2.0)">
+ <XRD>
+ <Service priority="10">
+ <Type>http://specs.openid.net/auth/2.0/signon</Type>
+ <Type>http://openid.net/extensions/sreg/1.1</Type>
+ <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/server.aspx"))%></URI>
+ </Service>
+ <Service priority="20">
+ <Type>http://openid.net/signon/1.0</Type>
+ <Type>http://openid.net/extensions/sreg/1.1</Type>
+ <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/server.aspx"))%></URI>
+ </Service>
+ </XRD>
+</xrds:XRDS>
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx b/samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx
new file mode 100644
index 0000000..d3653e7
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx
@@ -0,0 +1,19 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="OpenIdWebRingSsoRelyingParty.Admin.Default" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+ You must be an admin!
+ </div>
+ <p>
+ The roles you're assigned come from the trusted Provider's identity assertion. The
+ sample OP comes hard-wired to assert membership in the Admin and Member roles.
+ </p>
+ </form>
+</body>
+</html>
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx.cs b/samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx.cs
new file mode 100644
index 0000000..94da1f7
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx.cs
@@ -0,0 +1,13 @@
+namespace OpenIdWebRingSsoRelyingParty.Admin {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+
+ public partial class Default : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ }
+ }
+}
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx.designer.cs b/samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx.designer.cs
new file mode 100644
index 0000000..9519fc3
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Admin/Default.aspx.designer.cs
@@ -0,0 +1,25 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OpenIdWebRingSsoRelyingParty.Admin {
+
+
+ public partial class Default {
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+ }
+}
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Admin/Web.config b/samples/OpenIdWebRingSsoRelyingParty/Admin/Web.config
new file mode 100644
index 0000000..52a5faf
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Admin/Web.config
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<configuration>
+ <system.web>
+ <authorization>
+ <allow roles="Admin"/>
+ <deny users="*"/>
+ </authorization>
+ </system.web>
+</configuration>
diff --git a/samples/OpenIdWebRingSsoRelyingParty/AuthTicketRoles.cs b/samples/OpenIdWebRingSsoRelyingParty/AuthTicketRoles.cs
new file mode 100644
index 0000000..06783bd
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/AuthTicketRoles.cs
@@ -0,0 +1,57 @@
+//-----------------------------------------------------------------------
+// <copyright file="AuthTicketRoles.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace OpenIdWebRingSsoRelyingParty {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Security.Principal;
+ using System.Web;
+ using System.Web.Security;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OAuth;
+ using DotNetOpenAuth.OAuth.ChannelElements;
+ using DotNetOpenAuth.OAuth.Messages;
+
+ /// <summary>
+ /// An authentication module that utilizes the forms auth ticket cookie
+ /// as a cache for the users' roles, since those roles are determined by
+ /// the OpenID Provider and we don't have a local user-roles cache at this
+ /// RP since those relationships are always managed by the Provider.
+ /// </summary>
+ public class AuthTicketRoles : IHttpModule {
+ #region IHttpModule Members
+
+ /// <summary>
+ /// Initializes a module and prepares it to handle requests.
+ /// </summary>
+ /// <param name="context">An <see cref="T:System.Web.HttpApplication"/> that provides access to the methods, properties, and events common to all application objects within an ASP.NET application</param>
+ public void Init(HttpApplication context) {
+ context.AuthenticateRequest += this.application_AuthenticateRequest;
+ }
+
+ /// <summary>
+ /// Disposes of the resources (other than memory) used by the module that implements <see cref="T:System.Web.IHttpModule"/>.
+ /// </summary>
+ public void Dispose() {
+ }
+
+ #endregion
+
+ private void application_AuthenticateRequest(object sender, EventArgs e) {
+ if (HttpContext.Current.User != null) {
+ var cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
+ if (cookie != null) {
+ var ticket = FormsAuthentication.Decrypt(cookie.Value);
+ if (!string.IsNullOrEmpty(ticket.UserData)) {
+ string[] roles = ticket.UserData.Split(';');
+ HttpContext.Current.User = new GenericPrincipal(HttpContext.Current.User.Identity, roles);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Default.aspx b/samples/OpenIdWebRingSsoRelyingParty/Default.aspx
new file mode 100644
index 0000000..00efb08
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Default.aspx
@@ -0,0 +1,29 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="OpenIdWebRingSsoRelyingParty._Default" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title>Sample SSO relying party</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+ We&#39;ve recognized you (via the SSO OP) as:
+ <asp:LoginName ID="LoginName1" runat="server" />
+ <p>Try visiting the <a href="Admin/Default.aspx">Admin area</a></p>
+ </div>
+ <p>This sample is of an OpenID Relying Party that acts within a controlled set of
+ web sites (perhaps all belonging to the same organization).&nbsp; This
+ particular RP is configured to require authentication for all web pages, and to
+ always use just one (trusted) OP (the OpenIdWebRingSsoProvider) without ever
+ prompting the user.</p>
+ <p>Although the sample OP uses Windows Authentication, and so this RP could easily
+ do the same, the idea is that the OP and RP may exist on different network
+ topologies, or the OP may be the only site with access to the user credential
+ database, or any number of other scenarios where the RP doesn&#39;t have the freedom
+ to authenticate the user the way the OP has, yet this set of web sites want to
+ have the users only authenticate themselves to one site with one set of
+ credentials.</p>
+ </form>
+</body>
+</html>
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Default.aspx.cs b/samples/OpenIdWebRingSsoRelyingParty/Default.aspx.cs
new file mode 100644
index 0000000..9e6009e
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Default.aspx.cs
@@ -0,0 +1,18 @@
+namespace OpenIdWebRingSsoRelyingParty {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+
+ public partial class _Default : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ if (Array.IndexOf(Request.AcceptTypes, "application/xrds+xml") >= 0) {
+ Server.Transfer("xrds.aspx");
+ } else if (!User.Identity.IsAuthenticated) {
+ Response.Redirect("Login.aspx");
+ }
+ }
+ }
+}
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Default.aspx.designer.cs b/samples/OpenIdWebRingSsoRelyingParty/Default.aspx.designer.cs
new file mode 100644
index 0000000..49d071e
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Default.aspx.designer.cs
@@ -0,0 +1,34 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OpenIdWebRingSsoRelyingParty {
+
+
+ public partial class _Default {
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ /// <summary>
+ /// LoginName1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.LoginName LoginName1;
+ }
+}
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Login.aspx b/samples/OpenIdWebRingSsoRelyingParty/Login.aspx
new file mode 100644
index 0000000..2e7df2e
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Login.aspx
@@ -0,0 +1,26 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="OpenIdWebRingSsoRelyingParty.Login" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
+ <asp:View ID="View1" runat="server">
+ <div>
+ Sorry. We couldn't log you in.
+ </div>
+ <asp:Label runat="server" ID="errorLabel" />
+ <p>
+ <asp:Button ID="retryButton" runat="server" Text="Try Again" OnClick="retryButton_Click" />
+ </p>
+ </asp:View>
+ <asp:View ID="View2" runat="server">
+ You don't have permission to visit <%=HttpUtility.HtmlEncode(Request.QueryString["ReturnUrl"]) %>.
+ </asp:View>
+ </asp:MultiView>
+ </form>
+</body>
+</html>
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.cs b/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.cs
new file mode 100644
index 0000000..7f7f91e
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.cs
@@ -0,0 +1,96 @@
+namespace OpenIdWebRingSsoRelyingParty {
+ using System;
+ using System.Collections.Generic;
+ using System.Configuration;
+ using System.Linq;
+ using System.Web;
+ using System.Web.Security;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
+ using DotNetOpenAuth.OpenId.RelyingParty;
+
+ public partial class Login : System.Web.UI.Page {
+ private const string RolesAttribute = "http://samples.dotnetopenauth.net/sso/roles";
+
+ private static OpenIdRelyingParty relyingParty = new OpenIdRelyingParty();
+
+ static Login() {
+ // Configure the RP to only allow assertions from our trusted OP endpoint.
+ relyingParty.EndpointFilter = ep => ep.Uri.AbsoluteUri == ConfigurationManager.AppSettings["SsoProviderOPEndpoint"];
+ }
+
+ protected void Page_Load(object sender, EventArgs e) {
+ UriBuilder returnToBuilder = new UriBuilder(Request.Url);
+ returnToBuilder.Path = "/login.aspx";
+ returnToBuilder.Query = null;
+ returnToBuilder.Fragment = null;
+ Uri returnTo = returnToBuilder.Uri;
+ returnToBuilder.Path = "/";
+ Realm realm = returnToBuilder.Uri;
+
+ var response = relyingParty.GetResponse();
+ if (response == null) {
+ if (Request.QueryString["ReturnUrl"] != null && User.Identity.IsAuthenticated) {
+ // The user must have been directed here because he has insufficient
+ // permissions to access something.
+ this.MultiView1.ActiveViewIndex = 1;
+ } else {
+ // Because this is a sample of a controlled SSO environment,
+ // we don't ask the user which Provider to use... we just send
+ // them straight off to the one Provider we trust.
+ var request = relyingParty.CreateRequest(
+ ConfigurationManager.AppSettings["SsoProviderOPIdentifier"],
+ realm,
+ returnTo);
+ var fetchRequest = new FetchRequest();
+ fetchRequest.Attributes.AddOptional(RolesAttribute);
+ request.AddExtension(fetchRequest);
+ request.RedirectToProvider();
+ }
+ } else {
+ switch (response.Status) {
+ case AuthenticationStatus.Canceled:
+ this.errorLabel.Text = "Login canceled.";
+ break;
+ case AuthenticationStatus.Failed:
+ this.errorLabel.Text = HttpUtility.HtmlEncode(response.Exception.Message);
+ break;
+ case AuthenticationStatus.Authenticated:
+ IList<string> roles = null;
+ var fetchResponse = response.GetExtension<FetchResponse>();
+ if (fetchResponse != null) {
+ if (fetchResponse.Attributes.Contains(RolesAttribute)) {
+ roles = fetchResponse.Attributes[RolesAttribute].Values;
+ }
+ }
+ if (roles == null) {
+ roles = new List<string>(0);
+ }
+
+ // Apply the roles to this auth ticket
+ const int TimeoutInMinutes = 100; // TODO: look up the right value from the web.config file
+ var ticket = new FormsAuthenticationTicket(
+ 2,
+ response.ClaimedIdentifier,
+ DateTime.Now,
+ DateTime.Now.AddMinutes(TimeoutInMinutes),
+ false, // non-persistent, since login is automatic and we wanted updated roles
+ string.Join(";", roles.ToArray()));
+
+ HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
+ Response.SetCookie(cookie);
+ Response.Redirect(Request.QueryString["ReturnUrl"] ?? FormsAuthentication.DefaultUrl);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ protected void retryButton_Click(object sender, EventArgs e) {
+ Response.Redirect("/login.aspx");
+ }
+ }
+}
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.designer.cs b/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.designer.cs
new file mode 100644
index 0000000..7ed2669
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Login.aspx.designer.cs
@@ -0,0 +1,70 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OpenIdWebRingSsoRelyingParty {
+
+
+ public partial class Login {
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ /// <summary>
+ /// MultiView1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.MultiView MultiView1;
+
+ /// <summary>
+ /// View1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.View View1;
+
+ /// <summary>
+ /// errorLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label errorLabel;
+
+ /// <summary>
+ /// retryButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button retryButton;
+
+ /// <summary>
+ /// View2 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.View View2;
+ }
+}
diff --git a/samples/OpenIdWebRingSsoRelyingParty/OpenIdWebRingSsoRelyingParty.csproj b/samples/OpenIdWebRingSsoRelyingParty/OpenIdWebRingSsoRelyingParty.csproj
new file mode 100644
index 0000000..524ede2
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/OpenIdWebRingSsoRelyingParty.csproj
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{B64A1E7E-6A15-4B91-AF13-7D48F7DA5942}</ProjectGuid>
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>OpenIdWebRingSsoRelyingParty</RootNamespace>
+ <AssemblyName>OpenIdWebRingSsoRelyingParty</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Web.Extensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.EnterpriseServices" />
+ <Reference Include="System.Web.Mobile" />
+ <Reference Include="System.Xml.Linq" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Default.aspx" />
+ <Content Include="Login.aspx" />
+ <Content Include="Web.config" />
+ <Content Include="xrds.aspx" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Admin\Default.aspx.cs">
+ <DependentUpon>Default.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Admin\Default.aspx.designer.cs">
+ <DependentUpon>Default.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Default.aspx.cs">
+ <SubType>ASPXCodeBehind</SubType>
+ <DependentUpon>Default.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Default.aspx.designer.cs">
+ <DependentUpon>Default.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Login.aspx.cs">
+ <DependentUpon>Login.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Login.aspx.designer.cs">
+ <DependentUpon>Login.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="AuthTicketRoles.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\DotNetOpenAuth\DotNetOpenAuth.csproj">
+ <Project>{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}</Project>
+ <Name>DotNetOpenAuth</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Admin\Default.aspx" />
+ <Content Include="Admin\Web.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="App_Data\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+ <WebProjectProperties>
+ <UseIIS>False</UseIIS>
+ <AutoAssignPort>False</AutoAssignPort>
+ <DevelopmentServerPort>39165</DevelopmentServerPort>
+ <DevelopmentServerVPath>/</DevelopmentServerVPath>
+ <IISUrl>
+ </IISUrl>
+ <NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
+ <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+ </WebProjectProperties>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+</Project> \ No newline at end of file
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Properties/AssemblyInfo.cs b/samples/OpenIdWebRingSsoRelyingParty/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..eaf99ae
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OpenIdWebRingSsoRelyingParty")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft IT")]
+[assembly: AssemblyProduct("OpenIdWebRingSsoRelyingParty")]
+[assembly: AssemblyCopyright("Copyright © Microsoft IT 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/samples/OpenIdWebRingSsoRelyingParty/Web.config b/samples/OpenIdWebRingSsoRelyingParty/Web.config
new file mode 100644
index 0000000..3f50723
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/Web.config
@@ -0,0 +1,195 @@
+<?xml version="1.0"?>
+
+<configuration>
+ <configSections>
+ <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" />
+ <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/>
+ <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
+ <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
+ <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
+ <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
+ </sectionGroup>
+ </sectionGroup>
+ </sectionGroup>
+ </configSections>
+
+ <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
+ which is necessary for OpenID urls with unicode characters in the domain/host name.
+ It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
+ <uri>
+ <idn enabled="All"/>
+ <iriParsing enabled="true"/>
+ </uri>
+
+ <system.net>
+ <defaultProxy enabled="true" />
+ <settings>
+ <!-- This setting causes .NET to check certificate revocation lists (CRL)
+ before trusting HTTPS certificates. But this setting tends to not
+ be allowed in shared hosting environments. -->
+ <!--<servicePointManager checkCertificateRevocationList="true"/>-->
+ </settings>
+ </system.net>
+
+ <!-- this is an optional configuration section where aspects of dotnetopenauth can be customized -->
+ <dotNetOpenAuth>
+ <openid>
+ <relyingParty>
+ <security requireSsl="false" />
+ <behaviors>
+ <!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible
+ with OPs that use Attribute Exchange (in various formats). -->
+ <add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" />
+ <!--<add type="DotNetOpenAuth.OpenId.Behaviors.GsaIcamProfile, DotNetOpenAuth" />-->
+ </behaviors>
+ <!-- Uncomment the following to activate the sample custom store. -->
+ <!--<store type="OpenIdRelyingPartyWebForms.CustomStore, OpenIdRelyingPartyWebForms" />-->
+ </relyingParty>
+ </openid>
+ <messaging>
+ <untrustedWebRequest>
+ <whitelistHosts>
+ <!-- since this is a sample, and will often be used with localhost -->
+ <add name="localhost" />
+ </whitelistHosts>
+ </untrustedWebRequest>
+ </messaging>
+ <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. -->
+ <reporting enabled="true" />
+ </dotNetOpenAuth>
+
+ <appSettings>
+ <add key="SsoProviderOPIdentifier" value="http://localhost:39167/" />
+ <add key="SsoProviderOPEndpoint" value="http://localhost:39167/server.aspx" />
+ </appSettings>
+ <connectionStrings/>
+
+ <system.web>
+ <!--
+ Set compilation debug="true" to insert debugging
+ symbols into the compiled page. Because this
+ affects performance, set this value to true only
+ during development.
+ -->
+ <compilation debug="false">
+
+ <assemblies>
+ <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <remove assembly="DotNetOpenAuth.Contracts"/>
+ </assemblies>
+
+ </compilation>
+ <!--
+ The <authentication> section enables configuration
+ of the security authentication mode used by
+ ASP.NET to identify an incoming user.
+ -->
+ <authentication mode="Forms">
+ <forms name="OpenIdWebRingSsoRelyingParty" />
+ </authentication>
+ <authorization>
+ <deny users="?"/>
+ </authorization>
+ <!--
+ The <customErrors> section enables configuration
+ of what to do if/when an unhandled error occurs
+ during the execution of a request. Specifically,
+ it enables developers to configure html error pages
+ to be displayed in place of a error stack trace.
+
+ <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
+ <error statusCode="403" redirect="NoAccess.htm" />
+ <error statusCode="404" redirect="FileNotFound.htm" />
+ </customErrors>
+ -->
+
+ <pages>
+ <controls>
+ <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </controls>
+ </pages>
+
+ <httpHandlers>
+ <remove verb="*" path="*.asmx"/>
+ <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
+ </httpHandlers>
+ <httpModules>
+ <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="AuthTicketRoles" type="OpenIdWebRingSsoRelyingParty.AuthTicketRoles, OpenIdWebRingSsoRelyingParty"/>
+ </httpModules>
+
+ </system.web>
+
+ <system.codedom>
+ <compilers>
+ <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
+ type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <providerOption name="CompilerVersion" value="v3.5"/>
+ <providerOption name="WarnAsError" value="false"/>
+ </compiler>
+ </compilers>
+ </system.codedom>
+
+ <!--
+ The system.webServer section is required for running ASP.NET AJAX under Internet
+ Information Services 7.0. It is not necessary for previous version of IIS.
+ -->
+ <system.webServer>
+ <validation validateIntegratedModeConfiguration="false"/>
+ <modules>
+ <remove name="ScriptModule" />
+ <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </modules>
+ <handlers>
+ <remove name="WebServiceHandlerFactory-Integrated"/>
+ <remove name="ScriptHandlerFactory" />
+ <remove name="ScriptHandlerFactoryAppServices" />
+ <remove name="ScriptResource" />
+ <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
+ type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
+ type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+ </handlers>
+ </system.webServer>
+
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
+ <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
+ <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+
+ <location path="xrds.aspx">
+ <system.web>
+ <authorization>
+ <allow users="*"/>
+ </authorization>
+ </system.web>
+ </location>
+
+ <location path="default.aspx">
+ <system.web>
+ <authorization>
+ <allow users="*"/>
+ </authorization>
+ </system.web>
+ </location>
+</configuration>
diff --git a/samples/OpenIdWebRingSsoRelyingParty/xrds.aspx b/samples/OpenIdWebRingSsoRelyingParty/xrds.aspx
new file mode 100644
index 0000000..b45d063
--- /dev/null
+++ b/samples/OpenIdWebRingSsoRelyingParty/xrds.aspx
@@ -0,0 +1,20 @@
+<%@ Page Language="C#" AutoEventWireup="true" ContentType="application/xrds+xml" %><?xml version="1.0" encoding="UTF-8"?>
+<%--
+This page is a required for relying party discovery per OpenID 2.0.
+It allows Providers to call back to the relying party site to confirm the
+identity that it is claiming in the realm and return_to URLs.
+This page should be pointed to by the 'realm' home page, which in this sample
+is default.aspx.
+--%>
+<xrds:XRDS
+ xmlns:xrds="xri://$xrds"
+ xmlns:openid="http://openid.net/xmlns/1.0"
+ xmlns="xri://$xrd*($v*2.0)">
+ <XRD>
+ <Service priority="1">
+ <Type>http://specs.openid.net/auth/2.0/return_to</Type>
+ <%-- Every page with an OpenID login should be listed here. --%>
+ <URI priority="1"><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/login.aspx"))%></URI>
+ </Service>
+ </XRD>
+</xrds:XRDS>
diff --git a/samples/Samples.proj b/samples/Samples.proj
new file mode 100644
index 0000000..d076695
--- /dev/null
+++ b/samples/Samples.proj
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!-- Properties that must be set for these targets to function:
+ $(BranchName): The name of the branch being built. Used to determine the web subdirectory for publishing.
+
+ For creating web sites:
+ $(PublishSamplesWebSiteName): The name of the web site under which the sample web applications will be created/deleted.
+
+ For creating or publishing to web sites:
+ $(SampleWebRoot): the full physical path to where samples should be copied to, excluding $(BranchName)
+ -->
+ <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/>
+
+ <ItemGroup>
+ <SampleProjects Include="**\*.csproj;**\*.vbproj" />
+ <SampleSites Include="InfoCardRelyingParty" />
+
+ <ProjectsToClean Include="@(SampleProjects)" />
+ <ProjectsToClean Include="$(SolutionPath)">
+ <Targets>@(SampleSites->'%(Identity):Clean')</Targets>
+ </ProjectsToClean>
+ </ItemGroup>
+
+ <Target Name="Build" DependsOnTargets="SkipVerification">
+ <MSBuild Projects="@(SampleProjects)" BuildInParallel="$(BuildInParallel)" />
+ <MSBuild Projects="$(SolutionPath)" Targets="@(SampleSites)" BuildInParallel="$(BuildInParallel)" />
+ </Target>
+
+ <Target Name="Prepare">
+ <Error Text="The BranchName property must be set." Condition=" '$(BranchName)' == '' " />
+ <Error Text="The SampleWebRoot property must be set." Condition=" '$(SampleWebRoot)' == '' " />
+ <PropertyGroup>
+ <PublishSamplesWebSiteVirtualPath>/$(BranchName)</PublishSamplesWebSiteVirtualPath>
+ </PropertyGroup>
+ <ItemGroup>
+ <_SampleWebConfigs Include="$(ProjectRoot)samples\*\web.config" />
+ <PublishableWebSamples Include="@(_SampleWebConfigs->'%(RootDir)%(Directory)')" />
+ </ItemGroup>
+
+ <!-- Trim the trailing slash on the web sample paths so we can just get the leaf directory name. -->
+ <Trim
+ Inputs="@(PublishableWebSamples)"
+ EndCharacters="\">
+ <Output TaskParameter="Outputs" ItemName="_PublishableWebSamplesNoTrailingSlash" />
+ </Trim>
+
+ <ItemGroup>
+ <PublishableWebSamplesVirtualPaths Include="@(_PublishableWebSamplesNoTrailingSlash->'$(PublishSamplesWebSiteVirtualPath)/%(Filename)')" />
+ <PublishableWebSamplesPhysicalPaths Include="@(_PublishableWebSamplesNoTrailingSlash->'$(SampleWebRoot)\$(BranchName)\%(Filename)')" />
+ </ItemGroup>
+ </Target>
+
+ <Target Name="PrepareForPublish" DependsOnTargets="Prepare;Build">
+ <ItemGroup>
+ <SampleSources Include="$(ProjectRoot)samples\**\*" />
+ <SampleSources>
+ <PublishedLocation>$(SampleWebRoot)\$(BranchName)\%(RecursiveDir)%(Filename)%(Extension)</PublishedLocation>
+ </SampleSources>
+ </ItemGroup>
+
+ <FilterItems
+ InputItems="@(SampleSources)"
+ StartsWithAny="@(PublishableWebSamples)">
+ <Output TaskParameter="FilteredItems" ItemName="PublishableWebSampleSources" />
+ </FilterItems>
+
+ <ItemGroup>
+ <PublishableWebSampleTargets Include="@(PublishableWebSampleSources->'%(PublishedLocation)')" />
+ </ItemGroup>
+ </Target>
+
+ <Target Name="Publish"
+ DependsOnTargets="PrepareForPublish"
+ Inputs="@(PublishableWebSampleSources)"
+ Outputs="@(PublishableWebSampleTargets)"
+ Condition=" '$(SampleWebRoot)' != '' ">
+ <RemoveDir Directories="$(SampleWebRoot)\$(BranchName)" />
+ <MakeDir Directories="$(SampleWebRoot)\$(BranchName)" />
+ <Copy SourceFiles="@(PublishableWebSampleSources)" DestinationFiles="@(PublishableWebSampleTargets)" SkipUnchangedFiles="true" />
+ </Target>
+
+ <Target Name="Unpublish"
+ DependsOnTargets="DeleteSitesOnIis"
+ Condition=" '$(SampleWebRoot)' != '' ">
+ </Target>
+
+ <Target Name="CreateSitesOnIis" DependsOnTargets="Prepare">
+ <Error Text="The PublishSamplesWebSiteName property must be set." Condition=" '$(PublishSamplesWebSiteName)' == '' "/>
+ <Error Text="The SampleWebRoot property must be set." Condition=" '$(SampleWebRoot)' == '' " />
+ <CreateWebApplication
+ WebSiteName="$(PublishSamplesWebSiteName)"
+ PhysicalPaths="@(PublishableWebSamplesPhysicalPaths)"
+ VirtualPaths="@(PublishableWebSamplesVirtualPaths)"
+ />
+ </Target>
+
+ <Target Name="DeleteSitesOnIis" DependsOnTargets="Prepare">
+ <Error Text="The PublishSamplesWebSiteName property must be set." Condition=" '$(PublishSamplesWebSiteName)' == '' "/>
+ <DeleteWebApplication
+ WebSiteName="$(PublishSamplesWebSiteName)"
+ VirtualPaths="@(PublishableWebSamplesVirtualPaths)"
+ />
+ </Target>
+
+ <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/>
+</Project>
diff --git a/samples/Samples.sln b/samples/Samples.sln
index b586268..0a138cc 100644
--- a/samples/Samples.sln
+++ b/samples/Samples.sln
@@ -1,6 +1,6 @@

-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.ApplicationBlock", "DotNetOpenAuth.ApplicationBlock\DotNetOpenAuth.ApplicationBlock.csproj", "{AA78D112-D889-414B-A7D4-467B34C7B663}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdProviderWebForms", "OpenIdProviderWebForms\OpenIdProviderWebForms.csproj", "{2A59DE0A-B76A-4B42-9A33-04D34548353D}"
@@ -13,9 +13,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OAuth", "OAuth", "{812D828E
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "InfoCard", "InfoCard", "{9145144C-1192-41C9-9A6D-D8F6BFE350F2}"
EndProject
-Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "InfoCardRelyingParty", "InfoCardRelyingParty", "{BE7016A8-D1B9-471A-AA53-A3D0CB800D35}"
+Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "InfoCardRelyingParty", "InfoCardRelyingParty\", "{BE7016A8-D1B9-471A-AA53-A3D0CB800D35}"
ProjectSection(WebsiteProperties) = preProject
- TargetFramework = "3.5"
+ TargetFrameworkMoniker = ".NETFramework,Version%3Dv3.5"
Debug.AspNetCompiler.VirtualPath = "/InfoCardRelyingParty"
Debug.AspNetCompiler.PhysicalPath = "InfoCardRelyingParty\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\InfoCardRelyingParty\"
@@ -33,9 +33,9 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "InfoCardRelyingParty", "Inf
VWDPort = "4490"
EndProjectSection
EndProject
-Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "OAuthConsumer", "OAuthConsumer", "{5100F73C-3082-4B81-95DD-F443F90B8EA7}"
+Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "OAuthConsumer", "OAuthConsumer\", "{5100F73C-3082-4B81-95DD-F443F90B8EA7}"
ProjectSection(WebsiteProperties) = preProject
- TargetFramework = "3.5"
+ TargetFrameworkMoniker = ".NETFramework,Version%3Dv3.5"
Debug.AspNetCompiler.VirtualPath = "/OAuthConsumer"
Debug.AspNetCompiler.PhysicalPath = "OAuthConsumer\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\OAuthConsumer\"
@@ -53,9 +53,9 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "OAuthConsumer", "OAuthConsu
VWDPort = "10335"
EndProjectSection
EndProject
-Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "OAuthServiceProvider", "OAuthServiceProvider", "{DD52C0C8-F986-495A-AAA1-090CFE2F801F}"
+Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "OAuthServiceProvider", "OAuthServiceProvider\", "{DD52C0C8-F986-495A-AAA1-090CFE2F801F}"
ProjectSection(WebsiteProperties) = preProject
- TargetFramework = "3.5"
+ TargetFrameworkMoniker = ".NETFramework,Version%3Dv3.5"
Debug.AspNetCompiler.VirtualPath = "/OAuthServiceProvider"
Debug.AspNetCompiler.PhysicalPath = "OAuthServiceProvider\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\OAuthServiceProvider\"
@@ -80,9 +80,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdRelyingPartyMvc", "Op
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdRelyingPartyWebForms", "OpenIdRelyingPartyWebForms\OpenIdRelyingPartyWebForms.csproj", "{1E8AEA89-BF69-47A1-B290-E8B0FE588700}"
EndProject
-Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "OpenIdRelyingPartyClassicAsp", "OpenIdRelyingPartyClassicAsp", "{9F9A83C3-55FC-42F1-A6B6-15A52BD01FC0}"
+Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "OpenIdRelyingPartyClassicAsp", "OpenIdRelyingPartyClassicAsp\", "{9F9A83C3-55FC-42F1-A6B6-15A52BD01FC0}"
ProjectSection(WebsiteProperties) = preProject
- TargetFramework = "2.0"
+ TargetFrameworkMoniker = ".NETFramework,Version%3Dv3.5"
Debug.AspNetCompiler.VirtualPath = "/OpenIdRelyingPartyClassicAsp"
Debug.AspNetCompiler.PhysicalPath = "OpenIdRelyingPartyClassicAsp\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\OpenIdRelyingPartyClassicAsp\"
@@ -100,6 +100,14 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "OpenIdRelyingPartyClassicAs
VWDPort = "10318"
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdWebRingSsoProvider", "OpenIdWebRingSsoProvider\OpenIdWebRingSsoProvider.csproj", "{0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdWebRingSsoRelyingParty", "OpenIdWebRingSsoRelyingParty\OpenIdWebRingSsoRelyingParty.csproj", "{B64A1E7E-6A15-4B91-AF13-7D48F7DA5942}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIdOfflineProvider", "OpenIdOfflineProvider\OpenIdOfflineProvider.csproj", "{5C65603B-235F-47E6-B536-06385C60DE7F}"
+EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "OpenIdRelyingPartyWebFormsVB", "OpenIdRelyingPartyWebFormsVB\OpenIdRelyingPartyWebFormsVB.vbproj", "{F289B925-4307-4BEC-B411-885CE70E3379}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CodeAnalysis|Any CPU = CodeAnalysis|Any CPU
@@ -167,6 +175,30 @@ Global
{9F9A83C3-55FC-42F1-A6B6-15A52BD01FC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F9A83C3-55FC-42F1-A6B6-15A52BD01FC0}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{9F9A83C3-55FC-42F1-A6B6-15A52BD01FC0}.Release|Any CPU.Build.0 = Debug|Any CPU
+ {0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4}.CodeAnalysis|Any CPU.ActiveCfg = Release|Any CPU
+ {0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4}.CodeAnalysis|Any CPU.Build.0 = Release|Any CPU
+ {0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B64A1E7E-6A15-4B91-AF13-7D48F7DA5942}.CodeAnalysis|Any CPU.ActiveCfg = Release|Any CPU
+ {B64A1E7E-6A15-4B91-AF13-7D48F7DA5942}.CodeAnalysis|Any CPU.Build.0 = Release|Any CPU
+ {B64A1E7E-6A15-4B91-AF13-7D48F7DA5942}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B64A1E7E-6A15-4B91-AF13-7D48F7DA5942}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B64A1E7E-6A15-4B91-AF13-7D48F7DA5942}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B64A1E7E-6A15-4B91-AF13-7D48F7DA5942}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5C65603B-235F-47E6-B536-06385C60DE7F}.CodeAnalysis|Any CPU.ActiveCfg = Release|Any CPU
+ {5C65603B-235F-47E6-B536-06385C60DE7F}.CodeAnalysis|Any CPU.Build.0 = Release|Any CPU
+ {5C65603B-235F-47E6-B536-06385C60DE7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5C65603B-235F-47E6-B536-06385C60DE7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5C65603B-235F-47E6-B536-06385C60DE7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5C65603B-235F-47E6-B536-06385C60DE7F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F289B925-4307-4BEC-B411-885CE70E3379}.CodeAnalysis|Any CPU.ActiveCfg = Release|Any CPU
+ {F289B925-4307-4BEC-B411-885CE70E3379}.CodeAnalysis|Any CPU.Build.0 = Release|Any CPU
+ {F289B925-4307-4BEC-B411-885CE70E3379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F289B925-4307-4BEC-B411-885CE70E3379}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F289B925-4307-4BEC-B411-885CE70E3379}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F289B925-4307-4BEC-B411-885CE70E3379}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -177,6 +209,10 @@ Global
{07B193F1-68AD-4E9C-98AF-BEFB5E9403CB} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82}
{1E8AEA89-BF69-47A1-B290-E8B0FE588700} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82}
{9F9A83C3-55FC-42F1-A6B6-15A52BD01FC0} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82}
+ {0B4EB2A8-283D-48FB-BCD0-85B8DFFE05E4} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82}
+ {B64A1E7E-6A15-4B91-AF13-7D48F7DA5942} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82}
+ {5C65603B-235F-47E6-B536-06385C60DE7F} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82}
+ {F289B925-4307-4BEC-B411-885CE70E3379} = {A4059F7E-8E6F-4FA2-A1D5-1B9B46C93F82}
{5100F73C-3082-4B81-95DD-F443F90B8EA7} = {812D828E-C91A-45AB-BAE9-3FC6D9560F9F}
{DD52C0C8-F986-495A-AAA1-090CFE2F801F} = {812D828E-C91A-45AB-BAE9-3FC6D9560F9F}
{6EC36418-DBC5-4AD1-A402-413604AA7A08} = {812D828E-C91A-45AB-BAE9-3FC6D9560F9F}
diff --git a/samples/tools.proj b/samples/tools.proj
new file mode 100644
index 0000000..74f6457
--- /dev/null
+++ b/samples/tools.proj
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/>
+
+ <Target Name="Layout">
+ <PropertyGroup>
+ <ToolsDirectoryNoSlash>$(DropsRoot)$(ProductName)-Tools-$(BuildVersion)</ToolsDirectoryNoSlash>
+ <ToolsDirectory>$(ToolsDirectoryNoSlash)\</ToolsDirectory>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <ToolProjects Include="$(ProjectRoot)Samples\OpenIdOfflineProvider\OpenIdOfflineProvider.csproj">
+ <Targets>Sign</Targets>
+ </ToolProjects>
+ </ItemGroup>
+
+ <MSBuild Projects="@(ToolProjects)" Targets="%(ToolProjects.Targets)" BuildInParallel="$(BuildInParallel)">
+ <Output TaskParameter="TargetOutputs" ItemName="OfflineProvider"/>
+ </MSBuild>
+
+ <ItemGroup>
+ <!-- Remove the un-unified assembly. -->
+ <OfflineProvider Remove="$(OutputPath)$(SignedSubPath)$(ProductName).dll" />
+ <!-- add the PDBs -->
+ <OfflineProvider Include="@(OfflineProvider->'%(SymbolPath)')" />
+ <OfflineProviderTargets Include="
+ @(OfflineProvider->'$(ToolsDirectory)%(CultureDir)%(FileName)%(Extension)')"/>
+
+ <AllToolSources Include="@(OfflineProvider)" />
+ <AllToolTargets Include="@(OfflineProviderTargets)" />
+ </ItemGroup>
+
+ <MakeDir Directories="@(ToolsDirectory)" />
+ <Copy SourceFiles="@(AllToolSources)" DestinationFiles="@(AllToolTargets)" SkipUnchangedFiles="true" />
+
+ <!-- remove files that shouldn't be in the directory (perhaps from a previous version). -->
+ <Purge Directories="$(ToolsDirectory)" IntendedFiles="@(AllToolTargets)" />
+ </Target>
+
+ <Target Name="Build" DependsOnTargets="Layout">
+ <PropertyGroup>
+ <ToolsZip>$(ToolsDirectoryNoSlash).zip</ToolsZip>
+ </PropertyGroup>
+
+ <Zip ZipFileName="$(ToolsZip)"
+ Files="@(AllToolTargets)"
+ WorkingDirectory="$(ToolsDirectory)"
+ ZipLevel="$(ZipLevel)" />
+ </Target>
+
+ <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/>
+</Project> \ No newline at end of file