diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-10 21:17:28 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-10 21:17:28 -0800 |
commit | 175bd8ea3e95649b4be51dce17ae175db3400c3c (patch) | |
tree | 22f8ea3120e80d47afbbe0c3f6e82a6b3712e3ef | |
parent | 5ac3804dcd815e6b2aeba79c7faecdcd3649d73d (diff) | |
download | DotNetOpenAuth-175bd8ea3e95649b4be51dce17ae175db3400c3c.zip DotNetOpenAuth-175bd8ea3e95649b4be51dce17ae175db3400c3c.tar.gz DotNetOpenAuth-175bd8ea3e95649b4be51dce17ae175db3400c3c.tar.bz2 |
Added scope to issued OAuth tokens.
3 files changed, 33 insertions, 2 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/Code/OAuthTokenManager.cs b/projecttemplates/WebFormsRelyingParty/Code/OAuthTokenManager.cs index d9c04bd..79a0b7e 100644 --- a/projecttemplates/WebFormsRelyingParty/Code/OAuthTokenManager.cs +++ b/projecttemplates/WebFormsRelyingParty/Code/OAuthTokenManager.cs @@ -71,6 +71,10 @@ namespace WebFormsRelyingParty.Code { Token = response.Token, TokenSecret = response.TokenSecret, }; + string scope; + if (request.ExtraData.TryGetValue("scope", out scope)) { + token.Scope = scope; + } Global.DataContext.AddToIssuedToken(token); Global.DataContext.SaveChanges(); } @@ -108,6 +112,7 @@ namespace WebFormsRelyingParty.Code { ExpirationDate = null, // currently, our access tokens don't expire CreatedOn = DateTime.Now, User = requestTokenEntity.User, + Scope = requestTokenEntity.Scope, }; Global.DataContext.DeleteObject(requestTokenEntity); diff --git a/projecttemplates/WebFormsRelyingParty/Model.Designer.cs b/projecttemplates/WebFormsRelyingParty/Model.Designer.cs index 85bd476..5105374 100644 --- a/projecttemplates/WebFormsRelyingParty/Model.Designer.cs +++ b/projecttemplates/WebFormsRelyingParty/Model.Designer.cs @@ -15,7 +15,7 @@ [assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DatabaseModel", "FK_IssuedToken_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(WebFormsRelyingParty.User), "IssuedTokens", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(WebFormsRelyingParty.IssuedToken))] // Original file name: -// Generation date: 11/10/2009 8:48:49 PM +// Generation date: 11/10/2009 9:17:16 PM namespace WebFormsRelyingParty { @@ -922,6 +922,29 @@ namespace WebFormsRelyingParty partial void OnCreatedOnChanging(global::System.DateTime value); partial void OnCreatedOnChanged(); /// <summary> + /// There are no comments for Property Scope in the schema. + /// </summary> + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public string Scope + { + get + { + return this._Scope; + } + set + { + this.OnScopeChanging(value); + this.ReportPropertyChanging("Scope"); + this._Scope = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); + this.ReportPropertyChanged("Scope"); + this.OnScopeChanged(); + } + } + private string _Scope; + partial void OnScopeChanging(string value); + partial void OnScopeChanged(); + /// <summary> /// There are no comments for Consumer in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_Consumer", "Consumer")] diff --git a/projecttemplates/WebFormsRelyingParty/Model.edmx b/projecttemplates/WebFormsRelyingParty/Model.edmx index bae6c17..e9e9669 100644 --- a/projecttemplates/WebFormsRelyingParty/Model.edmx +++ b/projecttemplates/WebFormsRelyingParty/Model.edmx @@ -70,6 +70,7 @@ <Property Name="ConsumerVersion" Type="varchar" MaxLength="10" /> <Property Name="ExpirationDate" Type="datetime" /> <Property Name="IsAccessToken" Type="bit" Nullable="false" /> + <Property Name="Scope" Type="nvarchar" MaxLength="255" /> </EntityType> <EntityType Name="Role"> <Key> @@ -248,7 +249,8 @@ <Property Name="TokenSecret" Type="String" Nullable="false" /> <Property Name="CreatedOn" Type="DateTime" Nullable="false" /> <NavigationProperty Name="Consumer" Relationship="DatabaseModel.FK_IssuedToken_Consumer" FromRole="IssuedTokens" ToRole="Consumer" /> - <NavigationProperty Name="User" Relationship="DatabaseModel.FK_IssuedToken_User" FromRole="IssuedTokens" ToRole="User" /></EntityType> + <NavigationProperty Name="User" Relationship="DatabaseModel.FK_IssuedToken_User" FromRole="IssuedTokens" ToRole="User" /> + <Property Name="Scope" Type="String" Nullable="true" /></EntityType> <Association Name="FK_IssuedToken_Consumer"> <End Type="DatabaseModel.Consumer" Role="Consumer" Multiplicity="1" /> <End Type="DatabaseModel.IssuedToken" Role="IssuedTokens" Multiplicity="*" /></Association> @@ -320,6 +322,7 @@ <EntitySetMapping Name="IssuedToken"> <EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.IssuedToken)"> <MappingFragment StoreEntitySet="IssuedToken"> + <ScalarProperty Name="Scope" ColumnName="Scope" /> <ScalarProperty Name="CreatedOn" ColumnName="CreatedOn" /> <ScalarProperty Name="TokenSecret" ColumnName="TokenSecret" /> <ScalarProperty Name="Token" ColumnName="Token" /> |