diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2011-06-20 21:26:56 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2011-06-20 21:26:56 -0700 |
commit | 507e88d5c3e8263da48a0b9e695a35bc051f6b56 (patch) | |
tree | d5753afe4d0f5be1c652032a5af2751b0de77064 /samples/OAuthAuthorizationServer/Code | |
parent | 1f77a2b10ed11ac084d1def41b3c891178b0520b (diff) | |
download | DotNetOpenAuth-507e88d5c3e8263da48a0b9e695a35bc051f6b56.zip DotNetOpenAuth-507e88d5c3e8263da48a0b9e695a35bc051f6b56.tar.gz DotNetOpenAuth-507e88d5c3e8263da48a0b9e695a35bc051f6b56.tar.bz2 |
We have an implicit grant javascript client that can obtain an access token.
It doesn't know how to use it yet though.
Diffstat (limited to 'samples/OAuthAuthorizationServer/Code')
-rw-r--r-- | samples/OAuthAuthorizationServer/Code/Client.cs | 14 | ||||
-rw-r--r-- | samples/OAuthAuthorizationServer/Code/DataClasses.dbml | 4 | ||||
-rw-r--r-- | samples/OAuthAuthorizationServer/Code/DataClasses.designer.cs | 4 |
3 files changed, 17 insertions, 5 deletions
diff --git a/samples/OAuthAuthorizationServer/Code/Client.cs b/samples/OAuthAuthorizationServer/Code/Client.cs index 62bc193..b32bb15 100644 --- a/samples/OAuthAuthorizationServer/Code/Client.cs +++ b/samples/OAuthAuthorizationServer/Code/Client.cs @@ -37,7 +37,19 @@ /// <c>true</c> if the callback URL is allowable for this client; otherwise, <c>false</c>. /// </returns> bool IConsumerDescription.IsCallbackAllowed(Uri callback) { - return string.IsNullOrEmpty(this.Callback) || callback == new Uri(this.Callback); + if (string.IsNullOrEmpty(this.Callback)) { + // No callback rules have been set up for this client. + return true; + } + + // In this sample, it's enough of a callback URL match if the scheme and host match. + // In a production app, it is advisable to require a match on the path as well. + Uri acceptableCallbackPattern = new Uri(this.Callback); + if (String.Equals(acceptableCallbackPattern.GetLeftPart(UriPartial.Authority), callback.GetLeftPart(UriPartial.Authority), StringComparison.Ordinal)) { + return true; + } + + return false; } #endregion diff --git a/samples/OAuthAuthorizationServer/Code/DataClasses.dbml b/samples/OAuthAuthorizationServer/Code/DataClasses.dbml index 0ef987d..5536b6e 100644 --- a/samples/OAuthAuthorizationServer/Code/DataClasses.dbml +++ b/samples/OAuthAuthorizationServer/Code/DataClasses.dbml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?><Database Name="Database" EntityNamespace="OAuthAuthorizationServer.Code" Class="DataClassesDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007"> - <Connection Mode="WebSettings" ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DatabaseABC.mdf;Integrated Security=True;User Instance=True" SettingsObjectName="System.Configuration.ConfigurationManager.ConnectionStrings" SettingsPropertyName="DatabaseConnectionString" Provider="System.Data.SqlClient" /> + <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"> <Column Name="UserId" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> @@ -12,7 +12,7 @@ <Type Name="Client"> <Column Name="ClientId" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> <Column Name="ClientIdentifier" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" /> - <Column Name="ClientSecret" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" /> + <Column Name="ClientSecret" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" /> <Column Name="Callback" Type="System.String" CanBeNull="true" /> <Column Name="Name" Type="System.String" CanBeNull="false" /> <Association Name="Client_ClientAuthorization" Member="ClientAuthorizations" Storage="_OAuthTokens" ThisKey="ClientId" OtherKey="ClientId" Type="ClientAuthorization" /> diff --git a/samples/OAuthAuthorizationServer/Code/DataClasses.designer.cs b/samples/OAuthAuthorizationServer/Code/DataClasses.designer.cs index c8d1b19..5035753 100644 --- a/samples/OAuthAuthorizationServer/Code/DataClasses.designer.cs +++ b/samples/OAuthAuthorizationServer/Code/DataClasses.designer.cs @@ -2,7 +2,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. -// Runtime Version:4.0.30319.225 +// Runtime Version:4.0.30319.235 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -336,7 +336,7 @@ namespace OAuthAuthorizationServer.Code } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientSecret", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientSecret", DbType="NVarChar(50)")] public string ClientSecret { get |