diff options
Diffstat (limited to 'projecttemplates/RelyingPartyLogic')
-rw-r--r-- | projecttemplates/RelyingPartyLogic/CreateDatabase.sql | 82 | ||||
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Model.Client.cs | 29 | ||||
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Model.ClientAuthorization.cs (renamed from projecttemplates/RelyingPartyLogic/Model.IssuedToken.cs) | 6 | ||||
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Model.Consumer.cs | 51 | ||||
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Model.Designer.cs | 1057 | ||||
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Model.IssuedAccessToken.cs | 74 | ||||
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Model.IssuedRequestToken.cs | 63 | ||||
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Model.edmx | 290 | ||||
-rw-r--r-- | projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs | 2 | ||||
-rw-r--r-- | projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj | 6 |
10 files changed, 592 insertions, 1068 deletions
diff --git a/projecttemplates/RelyingPartyLogic/CreateDatabase.sql b/projecttemplates/RelyingPartyLogic/CreateDatabase.sql index bbc5e07..99df5e5 100644 --- a/projecttemplates/RelyingPartyLogic/CreateDatabase.sql +++ b/projecttemplates/RelyingPartyLogic/CreateDatabase.sql @@ -182,7 +182,7 @@ ALTER TABLE [dbo].[AuthenticationToken] GO -PRINT N'Creating [dbo].[Consumer]...'; +PRINT N'Creating [dbo].[Client]...'; GO @@ -190,15 +190,12 @@ SET ANSI_NULLS, QUOTED_IDENTIFIER ON; GO -CREATE TABLE [dbo].[Consumer] ( - [ConsumerId] INT IDENTITY (1, 1) NOT NULL, - [ConsumerKey] NVARCHAR (255) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL, - [ConsumerSecret] NVARCHAR (255) COLLATE SQL_Latin1_General_CP1_CS_AS NULL, - [X509Certificate] IMAGE NULL, - [Callback] NVARCHAR (2048) NULL, - [VerificationCodeFormat] INT NOT NULL, - [VerificationCodeLength] INT NOT NULL, - [Name] NVARCHAR (50) NULL +CREATE TABLE [dbo].[Client] ( + [ClientId] INT IDENTITY (1, 1) NOT NULL, + [ClientIdentifier] VARCHAR (255) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL, + [ClientSecret] VARCHAR (255) COLLATE SQL_Latin1_General_CP1_CS_AS NULL, + [Callback] VARCHAR (2048) NULL, + [Name] NVARCHAR (50) NULL ); @@ -211,21 +208,22 @@ PRINT N'Creating PK_Consumer...'; GO -ALTER TABLE [dbo].[Consumer] - ADD CONSTRAINT [PK_Consumer] PRIMARY KEY CLUSTERED ([ConsumerId] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF); +ALTER TABLE [dbo].[Client] + ADD CONSTRAINT [PK_Consumer] PRIMARY KEY CLUSTERED ([ClientId] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF); GO -PRINT N'Creating [dbo].[Consumer].[IX_Consumer]...'; +PRINT N'Creating [dbo].[Client].[IX_Consumer]...'; GO CREATE UNIQUE NONCLUSTERED INDEX [IX_Consumer] - ON [dbo].[Consumer]([ConsumerKey] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF, ONLINE = OFF, MAXDOP = 0); + ON [dbo].[Client]([ClientIdentifier] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF, ONLINE = OFF, MAXDOP = 0) + ON [PRIMARY]; GO -PRINT N'Creating [dbo].[IssuedToken]...'; +PRINT N'Creating [dbo].[ClientAuthorization]...'; GO @@ -233,19 +231,13 @@ SET ANSI_NULLS, QUOTED_IDENTIFIER ON; GO -CREATE TABLE [dbo].[IssuedToken] ( - [IssuedTokenId] INT IDENTITY (1, 1) NOT NULL, - [ConsumerId] INT NOT NULL, - [UserId] INT NULL, - [Token] NVARCHAR (255) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL, - [TokenSecret] NVARCHAR (255) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL, - [CreatedOn] DATETIME NOT NULL, - [Callback] NVARCHAR (2048) NULL, - [VerificationCode] NVARCHAR (255) COLLATE SQL_Latin1_General_CP1_CS_AS NULL, - [ConsumerVersion] VARCHAR (10) NULL, - [ExpirationDate] DATETIME NULL, - [IsAccessToken] BIT NOT NULL, - [Scope] NVARCHAR (255) NULL +CREATE TABLE [dbo].[ClientAuthorization] ( + [AuthorizationId] INT IDENTITY (1, 1) NOT NULL, + [ClientId] INT NOT NULL, + [UserId] INT NOT NULL, + [CreatedOn] DATETIME NOT NULL, + [ExpirationDate] DATETIME NULL, + [Scope] VARCHAR (2048) NULL ); @@ -258,17 +250,8 @@ PRINT N'Creating PK_IssuedToken...'; GO -ALTER TABLE [dbo].[IssuedToken] - ADD CONSTRAINT [PK_IssuedToken] PRIMARY KEY CLUSTERED ([IssuedTokenId] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF); - - -GO -PRINT N'Creating [dbo].[IssuedToken].[IX_IssuedToken]...'; - - -GO -CREATE UNIQUE NONCLUSTERED INDEX [IX_IssuedToken] - ON [dbo].[IssuedToken]([Token] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF, ONLINE = OFF, MAXDOP = 0); +ALTER TABLE [dbo].[ClientAuthorization] + ADD CONSTRAINT [PK_IssuedToken] PRIMARY KEY CLUSTERED ([AuthorizationId] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF); GO @@ -497,20 +480,11 @@ PRINT N'Creating DF_IssuedToken_CreatedOn...'; GO -ALTER TABLE [dbo].[IssuedToken] +ALTER TABLE [dbo].[ClientAuthorization] ADD CONSTRAINT [DF_IssuedToken_CreatedOn] DEFAULT (getutcdate()) FOR [CreatedOn]; GO -PRINT N'Creating DF_IssuedToken_IsAccessToken...'; - - -GO -ALTER TABLE [dbo].[IssuedToken] - ADD CONSTRAINT [DF_IssuedToken_IsAccessToken] DEFAULT ((0)) FOR [IsAccessToken]; - - -GO PRINT N'Creating DF_Nonce_Issued...'; @@ -551,8 +525,8 @@ PRINT N'Creating FK_IssuedToken_Consumer...'; GO -ALTER TABLE [dbo].[IssuedToken] WITH NOCHECK - ADD CONSTRAINT [FK_IssuedToken_Consumer] FOREIGN KEY ([ConsumerId]) REFERENCES [dbo].[Consumer] ([ConsumerId]) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE [dbo].[ClientAuthorization] WITH NOCHECK + ADD CONSTRAINT [FK_IssuedToken_Consumer] FOREIGN KEY ([ClientId]) REFERENCES [dbo].[Client] ([ClientId]) ON DELETE CASCADE ON UPDATE CASCADE; GO @@ -560,7 +534,7 @@ PRINT N'Creating FK_IssuedToken_User...'; GO -ALTER TABLE [dbo].[IssuedToken] WITH NOCHECK +ALTER TABLE [dbo].[ClientAuthorization] WITH NOCHECK ADD CONSTRAINT [FK_IssuedToken_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([UserId]) ON DELETE CASCADE ON UPDATE CASCADE; @@ -699,9 +673,9 @@ USE [$(DatabaseName)]; GO ALTER TABLE [dbo].[AuthenticationToken] WITH CHECK CHECK CONSTRAINT [FK_AuthenticationToken_User]; -ALTER TABLE [dbo].[IssuedToken] WITH CHECK CHECK CONSTRAINT [FK_IssuedToken_Consumer]; +ALTER TABLE [dbo].[ClientAuthorization] WITH CHECK CHECK CONSTRAINT [FK_IssuedToken_Consumer]; -ALTER TABLE [dbo].[IssuedToken] WITH CHECK CHECK CONSTRAINT [FK_IssuedToken_User]; +ALTER TABLE [dbo].[ClientAuthorization] WITH CHECK CHECK CONSTRAINT [FK_IssuedToken_User]; ALTER TABLE [dbo].[UserRole] WITH CHECK CHECK CONSTRAINT [FK_UserRole_Role]; diff --git a/projecttemplates/RelyingPartyLogic/Model.Client.cs b/projecttemplates/RelyingPartyLogic/Model.Client.cs new file mode 100644 index 0000000..9426408 --- /dev/null +++ b/projecttemplates/RelyingPartyLogic/Model.Client.cs @@ -0,0 +1,29 @@ +//----------------------------------------------------------------------- +// <copyright file="Model.Client.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace RelyingPartyLogic { + using System; + + using DotNetOpenAuth.OAuth2; + + public partial class Client : IConsumerDescription { + public Uri Callback { + get { return this.CallbackAsString != null ? new Uri(this.CallbackAsString) : null; } + set { this.CallbackAsString = value != null ? value.AbsoluteUri : null; } + } + + #region IConsumerDescription Members + + /// <summary> + /// Gets the client secret. + /// </summary> + string IConsumerDescription.Secret { + get { return this.ClientSecret; } + } + + #endregion + } +} diff --git a/projecttemplates/RelyingPartyLogic/Model.IssuedToken.cs b/projecttemplates/RelyingPartyLogic/Model.ClientAuthorization.cs index 5e10178..3d7646a 100644 --- a/projecttemplates/RelyingPartyLogic/Model.IssuedToken.cs +++ b/projecttemplates/RelyingPartyLogic/Model.ClientAuthorization.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="Model.IssuedToken.cs" company="Andrew Arnott"> +// <copyright file="Model.ClientAuthorization.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -11,11 +11,11 @@ namespace RelyingPartyLogic { using System.Web; using DotNetOpenAuth.OAuth.ChannelElements; - public partial class IssuedToken { + public partial class ClientAuthorization { /// <summary> /// Initializes a new instance of the <see cref="IssuedToken"/> class. /// </summary> - public IssuedToken() { + public ClientAuthorization() { this.CreatedOnUtc = DateTime.UtcNow; } diff --git a/projecttemplates/RelyingPartyLogic/Model.Consumer.cs b/projecttemplates/RelyingPartyLogic/Model.Consumer.cs deleted file mode 100644 index 258a248..0000000 --- a/projecttemplates/RelyingPartyLogic/Model.Consumer.cs +++ /dev/null @@ -1,51 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="Model.Consumer.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace RelyingPartyLogic { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Security.Cryptography.X509Certificates; - using System.Web; - using DotNetOpenAuth.OAuth; - using DotNetOpenAuth.OAuth.ChannelElements; - - public partial class Consumer : IConsumerDescription, DotNetOpenAuth.OAuth2.IConsumerDescription { - public VerificationCodeFormat VerificationCodeFormat { - get { return (VerificationCodeFormat)this.VerificationCodeFormatAsInt; } - set { this.VerificationCodeFormatAsInt = (int)value; } - } - - public X509Certificate2 Certificate { - get { return this.X509CertificateAsBinary != null ? new X509Certificate2(this.X509CertificateAsBinary) : null; } - set { this.X509CertificateAsBinary = value != null ? value.RawData : null; } - } - - public Uri Callback { - get { return this.CallbackAsString != null ? new Uri(this.CallbackAsString) : null; } - set { this.CallbackAsString = value != null ? value.AbsoluteUri : null; } - } - - string IConsumerDescription.Secret { - get { return this.ConsumerSecret; } - } - - string IConsumerDescription.Key { - get { return this.ConsumerKey; } - } - - #region IConsumerDescription Members - - /// <summary> - /// Gets the consumer secret. - /// </summary> - string DotNetOpenAuth.OAuth2.IConsumerDescription.Secret { - get { return this.ConsumerSecret; } - } - - #endregion - } -} diff --git a/projecttemplates/RelyingPartyLogic/Model.Designer.cs b/projecttemplates/RelyingPartyLogic/Model.Designer.cs index a1a5348..564bde5 100644 --- a/projecttemplates/RelyingPartyLogic/Model.Designer.cs +++ b/projecttemplates/RelyingPartyLogic/Model.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. -// Runtime Version:4.0.30104.0 +// Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -11,11 +11,11 @@ [assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()] [assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DatabaseModel", "UserRole", "Role", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(RelyingPartyLogic.Role), "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(RelyingPartyLogic.User))] [assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DatabaseModel", "FK_AuthenticationToken_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(RelyingPartyLogic.User), "AuthenticationToken", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(RelyingPartyLogic.AuthenticationToken))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DatabaseModel", "FK_IssuedToken_Consumer1", "Consumer", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(RelyingPartyLogic.Consumer), "IssuedToken", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(RelyingPartyLogic.IssuedToken))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DatabaseModel", "FK_IssuedToken_User1", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(RelyingPartyLogic.User), "IssuedToken", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(RelyingPartyLogic.IssuedToken))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DatabaseModel", "FK_IssuedToken_Consumer", "Client", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(RelyingPartyLogic.Client), "ClientAuthorization", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(RelyingPartyLogic.ClientAuthorization))] +[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DatabaseModel", "FK_IssuedToken_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(RelyingPartyLogic.User), "ClientAuthorization", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(RelyingPartyLogic.ClientAuthorization))] // Original file name: -// Generation date: 1/7/2010 8:42:18 PM +// Generation date: 7/14/2010 7:00:56 AM namespace RelyingPartyLogic { @@ -101,73 +101,73 @@ namespace RelyingPartyLogic [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] private global::System.Data.Objects.ObjectQuery<AuthenticationToken> _AuthenticationTokens; /// <summary> - /// There are no comments for Consumers in the schema. + /// There are no comments for Nonces in the schema. /// </summary> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public global::System.Data.Objects.ObjectQuery<Consumer> Consumers + public global::System.Data.Objects.ObjectQuery<Nonce> Nonces { get { - if ((this._Consumers == null)) + if ((this._Nonces == null)) { - this._Consumers = base.CreateQuery<Consumer>("[Consumers]"); + this._Nonces = base.CreateQuery<Nonce>("[Nonces]"); } - return this._Consumers; + return this._Nonces; } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private global::System.Data.Objects.ObjectQuery<Consumer> _Consumers; + private global::System.Data.Objects.ObjectQuery<Nonce> _Nonces; /// <summary> - /// There are no comments for IssuedTokens in the schema. + /// There are no comments for OpenIdAssociations in the schema. /// </summary> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public global::System.Data.Objects.ObjectQuery<IssuedToken> IssuedTokens + public global::System.Data.Objects.ObjectQuery<OpenIdAssociation> OpenIdAssociations { get { - if ((this._IssuedTokens == null)) + if ((this._OpenIdAssociations == null)) { - this._IssuedTokens = base.CreateQuery<IssuedToken>("[IssuedTokens]"); + this._OpenIdAssociations = base.CreateQuery<OpenIdAssociation>("[OpenIdAssociations]"); } - return this._IssuedTokens; + return this._OpenIdAssociations; } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private global::System.Data.Objects.ObjectQuery<IssuedToken> _IssuedTokens; + private global::System.Data.Objects.ObjectQuery<OpenIdAssociation> _OpenIdAssociations; /// <summary> - /// There are no comments for Nonces in the schema. + /// There are no comments for Clients in the schema. /// </summary> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public global::System.Data.Objects.ObjectQuery<Nonce> Nonces + public global::System.Data.Objects.ObjectQuery<Client> Clients { get { - if ((this._Nonces == null)) + if ((this._Clients == null)) { - this._Nonces = base.CreateQuery<Nonce>("[Nonces]"); + this._Clients = base.CreateQuery<Client>("[Clients]"); } - return this._Nonces; + return this._Clients; } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private global::System.Data.Objects.ObjectQuery<Nonce> _Nonces; + private global::System.Data.Objects.ObjectQuery<Client> _Clients; /// <summary> - /// There are no comments for OpenIdAssociations in the schema. + /// There are no comments for ClientAuthorizations in the schema. /// </summary> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public global::System.Data.Objects.ObjectQuery<OpenIdAssociation> OpenIdAssociations + public global::System.Data.Objects.ObjectQuery<ClientAuthorization> ClientAuthorizations { get { - if ((this._OpenIdAssociations == null)) + if ((this._ClientAuthorizations == null)) { - this._OpenIdAssociations = base.CreateQuery<OpenIdAssociation>("[OpenIdAssociations]"); + this._ClientAuthorizations = base.CreateQuery<ClientAuthorization>("[ClientAuthorizations]"); } - return this._OpenIdAssociations; + return this._ClientAuthorizations; } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private global::System.Data.Objects.ObjectQuery<OpenIdAssociation> _OpenIdAssociations; + private global::System.Data.Objects.ObjectQuery<ClientAuthorization> _ClientAuthorizations; /// <summary> /// There are no comments for Roles in the schema. /// </summary> @@ -193,36 +193,36 @@ namespace RelyingPartyLogic base.AddObject("AuthenticationTokens", authenticationToken); } /// <summary> - /// There are no comments for Consumers in the schema. + /// There are no comments for Nonces in the schema. /// </summary> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public void AddToConsumers(Consumer consumer) + public void AddToNonces(Nonce nonce) { - base.AddObject("Consumers", consumer); + base.AddObject("Nonces", nonce); } /// <summary> - /// There are no comments for IssuedTokens in the schema. + /// There are no comments for OpenIdAssociations in the schema. /// </summary> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public void AddToIssuedTokens(IssuedToken issuedToken) + public void AddToOpenIdAssociations(OpenIdAssociation openIdAssociation) { - base.AddObject("IssuedTokens", issuedToken); + base.AddObject("OpenIdAssociations", openIdAssociation); } /// <summary> - /// There are no comments for Nonces in the schema. + /// There are no comments for Clients in the schema. /// </summary> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public void AddToNonces(Nonce nonce) + public void AddToClients(Client client) { - base.AddObject("Nonces", nonce); + base.AddObject("Clients", client); } /// <summary> - /// There are no comments for OpenIdAssociations in the schema. + /// There are no comments for ClientAuthorizations in the schema. /// </summary> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public void AddToOpenIdAssociations(OpenIdAssociation openIdAssociation) + public void AddToClientAuthorizations(ClientAuthorization clientAuthorization) { - base.AddObject("OpenIdAssociations", openIdAssociation); + base.AddObject("ClientAuthorizations", clientAuthorization); } } /// <summary> @@ -791,609 +791,501 @@ namespace RelyingPartyLogic } } /// <summary> - /// There are no comments for IssuedTokens in the schema. + /// There are no comments for ClientAuthorizations in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_User1", "IssuedToken")] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_User", "ClientAuthorization")] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] [global::System.Xml.Serialization.XmlIgnoreAttribute()] [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection<IssuedToken> IssuedTokens + public global::System.Data.Objects.DataClasses.EntityCollection<ClientAuthorization> ClientAuthorizations { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_User1", "IssuedToken"); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<ClientAuthorization>("DatabaseModel.FK_IssuedToken_User", "ClientAuthorization"); } set { if ((value != null)) { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_User1", "IssuedToken", value); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<ClientAuthorization>("DatabaseModel.FK_IssuedToken_User", "ClientAuthorization", value); } } } } /// <summary> - /// There are no comments for DatabaseModel.Consumer in the schema. + /// There are no comments for DatabaseModel.Nonce in the schema. /// </summary> /// <KeyProperties> - /// ConsumerId + /// NonceId /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="Consumer")] + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="Nonce")] [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] [global::System.Serializable()] - public partial class Consumer : global::System.Data.Objects.DataClasses.EntityObject + public partial class Nonce : global::System.Data.Objects.DataClasses.EntityObject { /// <summary> - /// Create a new Consumer object. + /// Create a new Nonce object. /// </summary> - /// <param name="consumerKey">Initial value of ConsumerKey.</param> - /// <param name="verificationCodeLength">Initial value of VerificationCodeLength.</param> - /// <param name="consumerId">Initial value of ConsumerId.</param> + /// <param name="nonceId">Initial value of NonceId.</param> + /// <param name="context">Initial value of Context.</param> + /// <param name="code">Initial value of Code.</param> + /// <param name="issuedUtc">Initial value of IssuedUtc.</param> + /// <param name="expiresUtc">Initial value of ExpiresUtc.</param> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public static Consumer CreateConsumer(string consumerKey, int verificationCodeLength, int consumerId) + public static Nonce CreateNonce(int nonceId, string context, string code, global::System.DateTime issuedUtc, global::System.DateTime expiresUtc) { - Consumer consumer = new Consumer(); - consumer.ConsumerKey = consumerKey; - consumer.VerificationCodeLength = verificationCodeLength; - consumer.ConsumerId = consumerId; - return consumer; + Nonce nonce = new Nonce(); + nonce.NonceId = nonceId; + nonce.Context = context; + nonce.Code = code; + nonce.IssuedUtc = issuedUtc; + nonce.ExpiresUtc = expiresUtc; + return nonce; } /// <summary> - /// There are no comments for property ConsumerKey in the schema. + /// There are no comments for property NonceId in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string ConsumerKey + public int NonceId { get { - return this._ConsumerKey; + return this._NonceId; } set { - this.OnConsumerKeyChanging(value); - this.ReportPropertyChanging("ConsumerKey"); - this._ConsumerKey = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("ConsumerKey"); - this.OnConsumerKeyChanged(); + this.OnNonceIdChanging(value); + this.ReportPropertyChanging("NonceId"); + this._NonceId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("NonceId"); + this.OnNonceIdChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _ConsumerKey; + private int _NonceId; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnConsumerKeyChanging(string value); + partial void OnNonceIdChanging(int value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnConsumerKeyChanged(); + partial void OnNonceIdChanged(); /// <summary> - /// There are no comments for property ConsumerSecret in the schema. + /// Gets or sets the Provider Endpoint URL the nonce came from. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string ConsumerSecret + public string Context { get { - return this._ConsumerSecret; + return this._Context; } set { - this.OnConsumerSecretChanging(value); - this.ReportPropertyChanging("ConsumerSecret"); - this._ConsumerSecret = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ConsumerSecret"); - this.OnConsumerSecretChanged(); + this.OnContextChanging(value); + this.ReportPropertyChanging("Context"); + this._Context = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); + this.ReportPropertyChanged("Context"); + this.OnContextChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _ConsumerSecret; + private string _Context; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnConsumerSecretChanging(string value); + partial void OnContextChanging(string value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnConsumerSecretChanged(); + partial void OnContextChanged(); /// <summary> - /// There are no comments for property X509CertificateAsBinary in the schema. + /// There are no comments for property Code in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private byte[] X509CertificateAsBinary + public string Code { get { - return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._X509CertificateAsBinary); + return this._Code; } set { - this.OnX509CertificateAsBinaryChanging(value); - this.ReportPropertyChanging("X509CertificateAsBinary"); - this._X509CertificateAsBinary = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("X509CertificateAsBinary"); - this.OnX509CertificateAsBinaryChanged(); + this.OnCodeChanging(value); + this.ReportPropertyChanging("Code"); + this._Code = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); + this.ReportPropertyChanged("Code"); + this.OnCodeChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private byte[] _X509CertificateAsBinary; + private string _Code; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnX509CertificateAsBinaryChanging(byte[] value); + partial void OnCodeChanging(string value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnX509CertificateAsBinaryChanged(); + partial void OnCodeChanged(); /// <summary> - /// There are no comments for property CallbackAsString in the schema. + /// There are no comments for property IssuedUtc in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string CallbackAsString + public global::System.DateTime IssuedUtc { get { - return this._CallbackAsString; + return this._IssuedUtc; } set { - this.OnCallbackAsStringChanging(value); - this.ReportPropertyChanging("CallbackAsString"); - this._CallbackAsString = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("CallbackAsString"); - this.OnCallbackAsStringChanged(); + this.OnIssuedUtcChanging(value); + this.ReportPropertyChanging("IssuedUtc"); + this._IssuedUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("IssuedUtc"); + this.OnIssuedUtcChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _CallbackAsString; + private global::System.DateTime _IssuedUtc; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnCallbackAsStringChanging(string value); + partial void OnIssuedUtcChanging(global::System.DateTime value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnCallbackAsStringChanged(); + partial void OnIssuedUtcChanged(); /// <summary> - /// There are no comments for property VerificationCodeFormatAsInt in the schema. + /// There are no comments for property ExpiresUtc in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private int VerificationCodeFormatAsInt + public global::System.DateTime ExpiresUtc { get { - return this._VerificationCodeFormatAsInt; + return this._ExpiresUtc; } set { - this.OnVerificationCodeFormatAsIntChanging(value); - this.ReportPropertyChanging("VerificationCodeFormatAsInt"); - this._VerificationCodeFormatAsInt = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("VerificationCodeFormatAsInt"); - this.OnVerificationCodeFormatAsIntChanged(); + this.OnExpiresUtcChanging(value); + this.ReportPropertyChanging("ExpiresUtc"); + this._ExpiresUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("ExpiresUtc"); + this.OnExpiresUtcChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private int _VerificationCodeFormatAsInt; + private global::System.DateTime _ExpiresUtc; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnVerificationCodeFormatAsIntChanging(int value); + partial void OnExpiresUtcChanging(global::System.DateTime value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnVerificationCodeFormatAsIntChanged(); + partial void OnExpiresUtcChanged(); + } + /// <summary> + /// There are no comments for DatabaseModel.OpenIdAssociation in the schema. + /// </summary> + /// <KeyProperties> + /// AssociationId + /// </KeyProperties> + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="OpenIdAssociation")] + [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] + [global::System.Serializable()] + public partial class OpenIdAssociation : global::System.Data.Objects.DataClasses.EntityObject + { /// <summary> - /// There are no comments for property VerificationCodeLength in the schema. + /// Create a new OpenIdAssociation object. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] + /// <param name="associationId">Initial value of AssociationId.</param> + /// <param name="distinguishingFactor">Initial value of DistinguishingFactor.</param> + /// <param name="associationHandle">Initial value of AssociationHandle.</param> + /// <param name="expirationUtc">Initial value of ExpirationUtc.</param> + /// <param name="privateData">Initial value of PrivateData.</param> + /// <param name="privateDataLength">Initial value of PrivateDataLength.</param> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public int VerificationCodeLength + public static OpenIdAssociation CreateOpenIdAssociation(int associationId, string distinguishingFactor, string associationHandle, global::System.DateTime expirationUtc, byte[] privateData, int privateDataLength) { - get - { - return this._VerificationCodeLength; - } - set - { - this.OnVerificationCodeLengthChanging(value); - this.ReportPropertyChanging("VerificationCodeLength"); - this._VerificationCodeLength = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("VerificationCodeLength"); - this.OnVerificationCodeLengthChanged(); - } + OpenIdAssociation openIdAssociation = new OpenIdAssociation(); + openIdAssociation.AssociationId = associationId; + openIdAssociation.DistinguishingFactor = distinguishingFactor; + openIdAssociation.AssociationHandle = associationHandle; + openIdAssociation.ExpirationUtc = expirationUtc; + openIdAssociation.PrivateData = privateData; + openIdAssociation.PrivateDataLength = privateDataLength; + return openIdAssociation; } - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private int _VerificationCodeLength; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnVerificationCodeLengthChanging(int value); - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnVerificationCodeLengthChanged(); /// <summary> - /// There are no comments for property ConsumerId in the schema. + /// There are no comments for property AssociationId in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public int ConsumerId + public int AssociationId { get { - return this._ConsumerId; + return this._AssociationId; } - private set + set { - this.OnConsumerIdChanging(value); - this.ReportPropertyChanging("ConsumerId"); - this._ConsumerId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("ConsumerId"); - this.OnConsumerIdChanged(); + this.OnAssociationIdChanging(value); + this.ReportPropertyChanging("AssociationId"); + this._AssociationId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("AssociationId"); + this.OnAssociationIdChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private int _ConsumerId; + private int _AssociationId; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnConsumerIdChanging(int value); + partial void OnAssociationIdChanging(int value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnConsumerIdChanged(); + partial void OnAssociationIdChanged(); /// <summary> - /// There are no comments for property Name in the schema. + /// Gets or sets the Provider Endpoint URL the association is with. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string Name + public string DistinguishingFactor { get { - return this._Name; + return this._DistinguishingFactor; } set { - this.OnNameChanging(value); - this.ReportPropertyChanging("Name"); - this._Name = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Name"); - this.OnNameChanged(); + this.OnDistinguishingFactorChanging(value); + this.ReportPropertyChanging("DistinguishingFactor"); + this._DistinguishingFactor = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); + this.ReportPropertyChanged("DistinguishingFactor"); + this.OnDistinguishingFactorChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _Name; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnNameChanging(string value); + private string _DistinguishingFactor; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnNameChanged(); - /// <summary> - /// There are no comments for IssuedTokens in the schema. - /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_Consumer1", "IssuedToken")] + partial void OnDistinguishingFactorChanging(string value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection<IssuedToken> IssuedTokens - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_Consumer1", "IssuedToken"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_Consumer1", "IssuedToken", value); - } - } - } - } - /// <summary> - /// There are no comments for DatabaseModel.IssuedToken in the schema. - /// </summary> - /// <KeyProperties> - /// IssuedTokenId - /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="IssuedToken")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - [global::System.Runtime.Serialization.KnownTypeAttribute(typeof(global::RelyingPartyLogic.IssuedRequestToken))] - [global::System.Runtime.Serialization.KnownTypeAttribute(typeof(global::RelyingPartyLogic.IssuedAccessToken))] - public abstract partial class IssuedToken : global::System.Data.Objects.DataClasses.EntityObject - { + partial void OnDistinguishingFactorChanged(); /// <summary> - /// There are no comments for property Token in the schema. + /// There are no comments for property AssociationHandle in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string Token + public string AssociationHandle { get { - return this._Token; + return this._AssociationHandle; } set { - this.OnTokenChanging(value); - this.ReportPropertyChanging("Token"); - this._Token = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("Token"); - this.OnTokenChanged(); + this.OnAssociationHandleChanging(value); + this.ReportPropertyChanging("AssociationHandle"); + this._AssociationHandle = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); + this.ReportPropertyChanged("AssociationHandle"); + this.OnAssociationHandleChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _Token; + private string _AssociationHandle; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnTokenChanging(string value); + partial void OnAssociationHandleChanging(string value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnTokenChanged(); + partial void OnAssociationHandleChanged(); /// <summary> - /// There are no comments for property TokenSecret in the schema. + /// There are no comments for property ExpirationUtc in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string TokenSecret + public global::System.DateTime ExpirationUtc { get { - return this._TokenSecret; + return this._ExpirationUtc; } set { - this.OnTokenSecretChanging(value); - this.ReportPropertyChanging("TokenSecret"); - this._TokenSecret = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("TokenSecret"); - this.OnTokenSecretChanged(); + this.OnExpirationUtcChanging(value); + this.ReportPropertyChanging("ExpirationUtc"); + this._ExpirationUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("ExpirationUtc"); + this.OnExpirationUtcChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _TokenSecret; + private global::System.DateTime _ExpirationUtc; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnTokenSecretChanging(string value); + partial void OnExpirationUtcChanging(global::System.DateTime value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnTokenSecretChanged(); + partial void OnExpirationUtcChanged(); /// <summary> - /// There are no comments for property CreatedOnUtc in the schema. + /// There are no comments for property PrivateData in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public global::System.DateTime CreatedOnUtc + public byte[] PrivateData { get { - return this._CreatedOnUtc; + return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._PrivateData); } - internal set + set { - this.OnCreatedOnUtcChanging(value); - this.ReportPropertyChanging("CreatedOnUtc"); - this._CreatedOnUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("CreatedOnUtc"); - this.OnCreatedOnUtcChanged(); + this.OnPrivateDataChanging(value); + this.ReportPropertyChanging("PrivateData"); + this._PrivateData = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); + this.ReportPropertyChanged("PrivateData"); + this.OnPrivateDataChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private global::System.DateTime _CreatedOnUtc; + private byte[] _PrivateData; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnCreatedOnUtcChanging(global::System.DateTime value); + partial void OnPrivateDataChanging(byte[] value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnCreatedOnUtcChanged(); + partial void OnPrivateDataChanged(); /// <summary> - /// There are no comments for property Scope in the schema. + /// There are no comments for property PrivateDataLength in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string Scope + public int PrivateDataLength { get { - return this._Scope; + return this._PrivateDataLength; } set { - this.OnScopeChanging(value); - this.ReportPropertyChanging("Scope"); - this._Scope = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Scope"); - this.OnScopeChanged(); + this.OnPrivateDataLengthChanging(value); + this.ReportPropertyChanging("PrivateDataLength"); + this._PrivateDataLength = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("PrivateDataLength"); + this.OnPrivateDataLengthChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _Scope; + private int _PrivateDataLength; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnScopeChanging(string value); + partial void OnPrivateDataLengthChanging(int value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnScopeChanged(); + partial void OnPrivateDataLengthChanged(); + } + /// <summary> + /// There are no comments for DatabaseModel.Client in the schema. + /// </summary> + /// <KeyProperties> + /// ClientId + /// </KeyProperties> + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="Client")] + [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] + [global::System.Serializable()] + public partial class Client : global::System.Data.Objects.DataClasses.EntityObject + { /// <summary> - /// There are no comments for property IssuedTokenId in the schema. + /// Create a new Client object. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] + /// <param name="clientId">Initial value of ClientId.</param> + /// <param name="clientIdentifier">Initial value of ClientIdentifier.</param> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public int IssuedTokenId + public static Client CreateClient(int clientId, string clientIdentifier) { - get - { - return this._IssuedTokenId; - } - internal set - { - this.OnIssuedTokenIdChanging(value); - this.ReportPropertyChanging("IssuedTokenId"); - this._IssuedTokenId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("IssuedTokenId"); - this.OnIssuedTokenIdChanged(); - } + Client client = new Client(); + client.ClientId = clientId; + client.ClientIdentifier = clientIdentifier; + return client; } - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private int _IssuedTokenId; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnIssuedTokenIdChanging(int value); - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnIssuedTokenIdChanged(); /// <summary> - /// There are no comments for Consumer in the schema. + /// There are no comments for property ClientId in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_Consumer1", "Consumer")] - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] - public Consumer Consumer - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer1", "Consumer").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer1", "Consumer").Value = value; - } - } - /// <summary> - /// There are no comments for Consumer in the schema. - /// </summary> - [global::System.ComponentModel.BrowsableAttribute(false)] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference<Consumer> ConsumerReference + public int ClientId { get { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer1", "Consumer"); + return this._ClientId; } set { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer1", "Consumer", value); - } + this.OnClientIdChanging(value); + this.ReportPropertyChanging("ClientId"); + this._ClientId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("ClientId"); + this.OnClientIdChanged(); } } - /// <summary> - /// There are no comments for User in the schema. - /// </summary> - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_User1", "User")] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public User User - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_IssuedToken_User1", "User").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_IssuedToken_User1", "User").Value = value; - } - } - /// <summary> - /// There are no comments for User in the schema. - /// </summary> - [global::System.ComponentModel.BrowsableAttribute(false)] + private int _ClientId; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference<User> UserReference - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_IssuedToken_User1", "User"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<User>("DatabaseModel.FK_IssuedToken_User1", "User", value); - } - } - } - } - /// <summary> - /// There are no comments for DatabaseModel.IssuedRequestToken in the schema. - /// </summary> - /// <KeyProperties> - /// IssuedTokenId - /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="IssuedRequestToken")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class IssuedRequestToken : IssuedToken - { - /// <summary> - /// Create a new IssuedRequestToken object. - /// </summary> - /// <param name="token">Initial value of Token.</param> - /// <param name="tokenSecret">Initial value of TokenSecret.</param> - /// <param name="createdOnUtc">Initial value of CreatedOnUtc.</param> - /// <param name="issuedTokenId">Initial value of IssuedTokenId.</param> + partial void OnClientIdChanging(int value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public static IssuedRequestToken CreateIssuedRequestToken(string token, string tokenSecret, global::System.DateTime createdOnUtc, int issuedTokenId) - { - IssuedRequestToken issuedRequestToken = new IssuedRequestToken(); - issuedRequestToken.Token = token; - issuedRequestToken.TokenSecret = tokenSecret; - issuedRequestToken.CreatedOnUtc = createdOnUtc; - issuedRequestToken.IssuedTokenId = issuedTokenId; - return issuedRequestToken; - } + partial void OnClientIdChanged(); /// <summary> - /// There are no comments for property ConsumerVersionAsString in the schema. + /// There are no comments for property ClientIdentifier in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string ConsumerVersionAsString + public string ClientIdentifier { get { - return this._ConsumerVersionAsString; + return this._ClientIdentifier; } set { - this.OnConsumerVersionAsStringChanging(value); - this.ReportPropertyChanging("ConsumerVersionAsString"); - this._ConsumerVersionAsString = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("ConsumerVersionAsString"); - this.OnConsumerVersionAsStringChanged(); + this.OnClientIdentifierChanging(value); + this.ReportPropertyChanging("ClientIdentifier"); + this._ClientIdentifier = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); + this.ReportPropertyChanged("ClientIdentifier"); + this.OnClientIdentifierChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _ConsumerVersionAsString; + private string _ClientIdentifier; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnConsumerVersionAsStringChanging(string value); + partial void OnClientIdentifierChanging(string value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnConsumerVersionAsStringChanged(); + partial void OnClientIdentifierChanged(); /// <summary> - /// There are no comments for property VerificationCode in the schema. + /// There are no comments for property ClientSecret in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string VerificationCode + public string ClientSecret { get { - return this._VerificationCode; + return this._ClientSecret; } set { - this.OnVerificationCodeChanging(value); - this.ReportPropertyChanging("VerificationCode"); - this._VerificationCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("VerificationCode"); - this.OnVerificationCodeChanged(); + this.OnClientSecretChanging(value); + this.ReportPropertyChanging("ClientSecret"); + this._ClientSecret = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); + this.ReportPropertyChanged("ClientSecret"); + this.OnClientSecretChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _VerificationCode; + private string _ClientSecret; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnVerificationCodeChanging(string value); + partial void OnClientSecretChanging(string value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnVerificationCodeChanged(); + partial void OnClientSecretChanged(); /// <summary> /// There are no comments for property CallbackAsString in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string CallbackAsString + public string CallbackAsString { get { @@ -1414,422 +1306,265 @@ namespace RelyingPartyLogic partial void OnCallbackAsStringChanging(string value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] partial void OnCallbackAsStringChanged(); - } - /// <summary> - /// There are no comments for DatabaseModel.IssuedAccessToken in the schema. - /// </summary> - /// <KeyProperties> - /// IssuedTokenId - /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="IssuedAccessToken")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class IssuedAccessToken : IssuedToken - { - /// <summary> - /// Create a new IssuedAccessToken object. - /// </summary> - /// <param name="token">Initial value of Token.</param> - /// <param name="tokenSecret">Initial value of TokenSecret.</param> - /// <param name="createdOnUtc">Initial value of CreatedOnUtc.</param> - /// <param name="issuedTokenId">Initial value of IssuedTokenId.</param> - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public static IssuedAccessToken CreateIssuedAccessToken(string token, string tokenSecret, global::System.DateTime createdOnUtc, int issuedTokenId) - { - IssuedAccessToken issuedAccessToken = new IssuedAccessToken(); - issuedAccessToken.Token = token; - issuedAccessToken.TokenSecret = tokenSecret; - issuedAccessToken.CreatedOnUtc = createdOnUtc; - issuedAccessToken.IssuedTokenId = issuedTokenId; - return issuedAccessToken; - } /// <summary> - /// There are no comments for property ExpirationDateUtc in the schema. + /// There are no comments for property Name in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public global::System.Nullable<global::System.DateTime> ExpirationDateUtc + public string Name { get { - return this._ExpirationDateUtc; + return this._Name; } set { - this.OnExpirationDateUtcChanging(value); - this.ReportPropertyChanging("ExpirationDateUtc"); - this._ExpirationDateUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("ExpirationDateUtc"); - this.OnExpirationDateUtcChanged(); + this.OnNameChanging(value); + this.ReportPropertyChanging("Name"); + this._Name = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); + this.ReportPropertyChanged("Name"); + this.OnNameChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private global::System.Nullable<global::System.DateTime> _ExpirationDateUtc; + private string _Name; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnExpirationDateUtcChanging(global::System.Nullable<global::System.DateTime> value); + partial void OnNameChanging(string value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnExpirationDateUtcChanged(); - } - /// <summary> - /// There are no comments for DatabaseModel.Nonce in the schema. - /// </summary> - /// <KeyProperties> - /// NonceId - /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="Nonce")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class Nonce : global::System.Data.Objects.DataClasses.EntityObject - { + partial void OnNameChanged(); /// <summary> - /// Create a new Nonce object. + /// There are no comments for ClientAuthorizations in the schema. /// </summary> - /// <param name="nonceId">Initial value of NonceId.</param> - /// <param name="context">Initial value of Context.</param> - /// <param name="code">Initial value of Code.</param> - /// <param name="issuedUtc">Initial value of IssuedUtc.</param> - /// <param name="expiresUtc">Initial value of ExpiresUtc.</param> + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_Consumer", "ClientAuthorization")] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public static Nonce CreateNonce(int nonceId, string context, string code, global::System.DateTime issuedUtc, global::System.DateTime expiresUtc) - { - Nonce nonce = new Nonce(); - nonce.NonceId = nonceId; - nonce.Context = context; - nonce.Code = code; - nonce.IssuedUtc = issuedUtc; - nonce.ExpiresUtc = expiresUtc; - return nonce; - } - /// <summary> - /// There are no comments for property NonceId in the schema. - /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [global::System.Xml.Serialization.XmlIgnoreAttribute()] + [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public int NonceId + public global::System.Data.Objects.DataClasses.EntityCollection<ClientAuthorization> ClientAuthorizations { get { - return this._NonceId; + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<ClientAuthorization>("DatabaseModel.FK_IssuedToken_Consumer", "ClientAuthorization"); } set { - this.OnNonceIdChanging(value); - this.ReportPropertyChanging("NonceId"); - this._NonceId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("NonceId"); - this.OnNonceIdChanged(); + if ((value != null)) + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<ClientAuthorization>("DatabaseModel.FK_IssuedToken_Consumer", "ClientAuthorization", value); + } } } - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private int _NonceId; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnNonceIdChanging(int value); - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnNonceIdChanged(); + } + /// <summary> + /// There are no comments for DatabaseModel.ClientAuthorization in the schema. + /// </summary> + /// <KeyProperties> + /// AuthorizationId + /// </KeyProperties> + [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="ClientAuthorization")] + [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] + [global::System.Serializable()] + public partial class ClientAuthorization : global::System.Data.Objects.DataClasses.EntityObject + { /// <summary> - /// Gets or sets the Provider Endpoint URL the nonce came from. + /// Create a new ClientAuthorization object. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] + /// <param name="authorizationId">Initial value of AuthorizationId.</param> + /// <param name="createdOnUtc">Initial value of CreatedOnUtc.</param> [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string Context + public static ClientAuthorization CreateClientAuthorization(int authorizationId, global::System.DateTime createdOnUtc) { - get - { - return this._Context; - } - set - { - this.OnContextChanging(value); - this.ReportPropertyChanging("Context"); - this._Context = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("Context"); - this.OnContextChanged(); - } + ClientAuthorization clientAuthorization = new ClientAuthorization(); + clientAuthorization.AuthorizationId = authorizationId; + clientAuthorization.CreatedOnUtc = createdOnUtc; + return clientAuthorization; } - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _Context; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnContextChanging(string value); - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnContextChanged(); /// <summary> - /// There are no comments for property Code in the schema. + /// There are no comments for property AuthorizationId in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string Code + public int AuthorizationId { get { - return this._Code; + return this._AuthorizationId; } set { - this.OnCodeChanging(value); - this.ReportPropertyChanging("Code"); - this._Code = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("Code"); - this.OnCodeChanged(); + this.OnAuthorizationIdChanging(value); + this.ReportPropertyChanging("AuthorizationId"); + this._AuthorizationId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("AuthorizationId"); + this.OnAuthorizationIdChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _Code; + private int _AuthorizationId; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnCodeChanging(string value); + partial void OnAuthorizationIdChanging(int value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnCodeChanged(); + partial void OnAuthorizationIdChanged(); /// <summary> - /// There are no comments for property IssuedUtc in the schema. + /// There are no comments for property CreatedOnUtc in the schema. /// </summary> [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public global::System.DateTime IssuedUtc + public global::System.DateTime CreatedOnUtc { get { - return this._IssuedUtc; + return this._CreatedOnUtc; } set { - this.OnIssuedUtcChanging(value); - this.ReportPropertyChanging("IssuedUtc"); - this._IssuedUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("IssuedUtc"); - this.OnIssuedUtcChanged(); + this.OnCreatedOnUtcChanging(value); + this.ReportPropertyChanging("CreatedOnUtc"); + this._CreatedOnUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("CreatedOnUtc"); + this.OnCreatedOnUtcChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private global::System.DateTime _IssuedUtc; + private global::System.DateTime _CreatedOnUtc; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnIssuedUtcChanging(global::System.DateTime value); + partial void OnCreatedOnUtcChanging(global::System.DateTime value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnIssuedUtcChanged(); + partial void OnCreatedOnUtcChanged(); /// <summary> - /// There are no comments for property ExpiresUtc in the schema. + /// There are no comments for property ExpirationDate in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public global::System.DateTime ExpiresUtc + public global::System.Nullable<global::System.DateTime> ExpirationDate { get { - return this._ExpiresUtc; + return this._ExpirationDate; } set { - this.OnExpiresUtcChanging(value); - this.ReportPropertyChanging("ExpiresUtc"); - this._ExpiresUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("ExpiresUtc"); - this.OnExpiresUtcChanged(); + this.OnExpirationDateChanging(value); + this.ReportPropertyChanging("ExpirationDate"); + this._ExpirationDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); + this.ReportPropertyChanged("ExpirationDate"); + this.OnExpirationDateChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private global::System.DateTime _ExpiresUtc; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnExpiresUtcChanging(global::System.DateTime value); + private global::System.Nullable<global::System.DateTime> _ExpirationDate; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnExpiresUtcChanged(); - } - /// <summary> - /// There are no comments for DatabaseModel.OpenIdAssociation in the schema. - /// </summary> - /// <KeyProperties> - /// AssociationId - /// </KeyProperties> - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="OpenIdAssociation")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class OpenIdAssociation : global::System.Data.Objects.DataClasses.EntityObject - { - /// <summary> - /// Create a new OpenIdAssociation object. - /// </summary> - /// <param name="associationId">Initial value of AssociationId.</param> - /// <param name="distinguishingFactor">Initial value of DistinguishingFactor.</param> - /// <param name="associationHandle">Initial value of AssociationHandle.</param> - /// <param name="expirationUtc">Initial value of ExpirationUtc.</param> - /// <param name="privateData">Initial value of PrivateData.</param> - /// <param name="privateDataLength">Initial value of PrivateDataLength.</param> + partial void OnExpirationDateChanging(global::System.Nullable<global::System.DateTime> value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public static OpenIdAssociation CreateOpenIdAssociation(int associationId, string distinguishingFactor, string associationHandle, global::System.DateTime expirationUtc, byte[] privateData, int privateDataLength) - { - OpenIdAssociation openIdAssociation = new OpenIdAssociation(); - openIdAssociation.AssociationId = associationId; - openIdAssociation.DistinguishingFactor = distinguishingFactor; - openIdAssociation.AssociationHandle = associationHandle; - openIdAssociation.ExpirationUtc = expirationUtc; - openIdAssociation.PrivateData = privateData; - openIdAssociation.PrivateDataLength = privateDataLength; - return openIdAssociation; - } + partial void OnExpirationDateChanged(); /// <summary> - /// There are no comments for property AssociationId in the schema. + /// There are no comments for property Scope in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public int AssociationId + public string Scope { get { - return this._AssociationId; + return this._Scope; } set { - this.OnAssociationIdChanging(value); - this.ReportPropertyChanging("AssociationId"); - this._AssociationId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("AssociationId"); - this.OnAssociationIdChanged(); + this.OnScopeChanging(value); + this.ReportPropertyChanging("Scope"); + this._Scope = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); + this.ReportPropertyChanged("Scope"); + this.OnScopeChanged(); } } [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private int _AssociationId; + private string _Scope; [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnAssociationIdChanging(int value); + partial void OnScopeChanging(string value); [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnAssociationIdChanged(); + partial void OnScopeChanged(); /// <summary> - /// Gets or sets the Provider Endpoint URL the association is with. + /// There are no comments for Client in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string DistinguishingFactor - { - get - { - return this._DistinguishingFactor; - } - set - { - this.OnDistinguishingFactorChanging(value); - this.ReportPropertyChanging("DistinguishingFactor"); - this._DistinguishingFactor = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("DistinguishingFactor"); - this.OnDistinguishingFactorChanged(); - } - } + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_Consumer", "Client")] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _DistinguishingFactor; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnDistinguishingFactorChanging(string value); - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnDistinguishingFactorChanged(); - /// <summary> - /// There are no comments for property AssociationHandle in the schema. - /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] + [global::System.Xml.Serialization.XmlIgnoreAttribute()] + [global::System.Xml.Serialization.SoapIgnoreAttribute()] [global::System.Runtime.Serialization.DataMemberAttribute()] - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public string AssociationHandle + public Client Client { get { - return this._AssociationHandle; + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Client>("DatabaseModel.FK_IssuedToken_Consumer", "Client").Value; } set { - this.OnAssociationHandleChanging(value); - this.ReportPropertyChanging("AssociationHandle"); - this._AssociationHandle = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("AssociationHandle"); - this.OnAssociationHandleChanged(); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Client>("DatabaseModel.FK_IssuedToken_Consumer", "Client").Value = value; } } - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private string _AssociationHandle; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnAssociationHandleChanging(string value); - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnAssociationHandleChanged(); /// <summary> - /// There are no comments for property ExpirationUtc in the schema. + /// There are no comments for Client in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] + [global::System.ComponentModel.BrowsableAttribute(false)] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public global::System.DateTime ExpirationUtc + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Data.Objects.DataClasses.EntityReference<Client> ClientReference { get { - return this._ExpirationUtc; + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Client>("DatabaseModel.FK_IssuedToken_Consumer", "Client"); } set { - this.OnExpirationUtcChanging(value); - this.ReportPropertyChanging("ExpirationUtc"); - this._ExpirationUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("ExpirationUtc"); - this.OnExpirationUtcChanged(); + if ((value != null)) + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Client>("DatabaseModel.FK_IssuedToken_Consumer", "Client", value); + } } } - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private global::System.DateTime _ExpirationUtc; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnExpirationUtcChanging(global::System.DateTime value); - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnExpirationUtcChanged(); /// <summary> - /// There are no comments for property PrivateData in the schema. + /// There are no comments for User in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] + [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_User", "User")] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public byte[] PrivateData + [global::System.Xml.Serialization.XmlIgnoreAttribute()] + [global::System.Xml.Serialization.SoapIgnoreAttribute()] + [global::System.Runtime.Serialization.DataMemberAttribute()] + public User User { get { - return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._PrivateData); + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_IssuedToken_User", "User").Value; } set { - this.OnPrivateDataChanging(value); - this.ReportPropertyChanging("PrivateData"); - this._PrivateData = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("PrivateData"); - this.OnPrivateDataChanged(); + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_IssuedToken_User", "User").Value = value; } } - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private byte[] _PrivateData; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnPrivateDataChanging(byte[] value); - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnPrivateDataChanged(); /// <summary> - /// There are no comments for property PrivateDataLength in the schema. + /// There are no comments for User in the schema. /// </summary> - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] + [global::System.ComponentModel.BrowsableAttribute(false)] [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - public int PrivateDataLength + [global::System.Runtime.Serialization.DataMemberAttribute()] + public global::System.Data.Objects.DataClasses.EntityReference<User> UserReference { get { - return this._PrivateDataLength; + return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_IssuedToken_User", "User"); } set { - this.OnPrivateDataLengthChanging(value); - this.ReportPropertyChanging("PrivateDataLength"); - this._PrivateDataLength = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("PrivateDataLength"); - this.OnPrivateDataLengthChanged(); + if ((value != null)) + { + ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<User>("DatabaseModel.FK_IssuedToken_User", "User", value); + } } } - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - private int _PrivateDataLength; - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnPrivateDataLengthChanging(int value); - [global::System.CodeDom.Compiler.GeneratedCode("System.Data.Entity.Design.EntityClassGenerator", "4.0.0.0")] - partial void OnPrivateDataLengthChanged(); } } diff --git a/projecttemplates/RelyingPartyLogic/Model.IssuedAccessToken.cs b/projecttemplates/RelyingPartyLogic/Model.IssuedAccessToken.cs deleted file mode 100644 index 25d983b..0000000 --- a/projecttemplates/RelyingPartyLogic/Model.IssuedAccessToken.cs +++ /dev/null @@ -1,74 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="Model.IssuedAccessToken.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace RelyingPartyLogic { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Web; - using DotNetOpenAuth.OAuth.ChannelElements; - - public partial class IssuedAccessToken : IServiceProviderAccessToken { - /// <summary> - /// Gets the roles that the OAuth principal should belong to. - /// </summary> - /// <value> - /// The roles that the user belongs to, or a subset of these according to the rights - /// granted when the user authorized the request token. - /// </value> - string[] IServiceProviderAccessToken.Roles { - get { - List<string> roles = new List<string>(); - - // Include the roles the user who authorized this OAuth token has. - roles.AddRange(this.User.Roles.Select(r => r.Name)); - - // Always add an extra role to indicate this is an OAuth-authorized request. - // This allows us to deny access to account management pages to OAuth requests. - roles.Add("delegated"); - - return roles.ToArray(); - } - } - - /// <summary> - /// Gets the username of the principal that will be impersonated by this access token. - /// </summary> - /// <value> - /// The name of the user who authorized the OAuth request token originally. - /// </value> - string IServiceProviderAccessToken.Username { - get { - // We don't really have the concept of a single username, but we - // can use any of the authentication tokens instead since that - // is what the rest of the web site expects. - if (!this.UserReference.IsLoaded) { - this.UserReference.Load(); - } - if (!this.User.AuthenticationTokens.IsLoaded) { - this.User.AuthenticationTokens.Load(); - } - return this.User.AuthenticationTokens.First().ClaimedIdentifier; - } - } - - /// <summary> - /// Gets the expiration date (local time) for the access token. - /// </summary> - /// <value> - /// The expiration date, or <c>null</c> if there is no expiration date. - /// </value> - DateTime? IServiceProviderAccessToken.ExpirationDate { - get { return this.ExpirationDateUtc.HasValue ? (DateTime?)this.ExpirationDateUtc.Value.ToLocalTime() : null; } - } - - partial void OnExpirationDateUtcChanging(DateTime? value) { - if (value.HasValue) { - Utilities.VerifyThrowNotLocalTime(value.Value); - } - } - } -} diff --git a/projecttemplates/RelyingPartyLogic/Model.IssuedRequestToken.cs b/projecttemplates/RelyingPartyLogic/Model.IssuedRequestToken.cs deleted file mode 100644 index 1e96eb7..0000000 --- a/projecttemplates/RelyingPartyLogic/Model.IssuedRequestToken.cs +++ /dev/null @@ -1,63 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="Model.IssuedRequestToken.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace RelyingPartyLogic { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Web; - using DotNetOpenAuth.OAuth.ChannelElements; - - public partial class IssuedRequestToken : IServiceProviderRequestToken { - /// <summary> - /// Gets or sets the callback associated specifically with this token, if any. - /// </summary> - /// <value> - /// The callback URI; or <c>null</c> if no callback was specifically assigned to this token. - /// </value> - public Uri Callback { - get { return this.CallbackAsString != null ? new Uri(this.CallbackAsString) : null; } - set { this.CallbackAsString = value != null ? value.AbsoluteUri : null; } - } - - /// <summary> - /// Gets or sets the version of the Consumer that requested this token. - /// </summary> - /// <remarks> - /// This property is used to determine whether a <see cref="VerificationCode"/> must be - /// generated when the user authorizes the Consumer or not. - /// </remarks> - Version IServiceProviderRequestToken.ConsumerVersion { - get { return this.ConsumerVersionAsString != null ? new Version(this.ConsumerVersionAsString) : null; } - set { this.ConsumerVersionAsString = value != null ? value.ToString() : null; } - } - - /// <summary> - /// Gets the consumer key that requested this token. - /// </summary> - string IServiceProviderRequestToken.ConsumerKey { - get { return this.Consumer.ConsumerKey; } - } - - /// <summary> - /// Gets the (local) date that this request token was first created on. - /// </summary> - DateTime IServiceProviderRequestToken.CreatedOn { - get { return this.CreatedOnUtc.ToLocalTime(); } - } - - /// <summary> - /// Authorizes this request token to allow exchange for an access token. - /// </summary> - /// <remarks> - /// Call this method when the user has completed web-based authorization. - /// </remarks> - public void Authorize() { - this.User = Database.LoggedInUser; - Database.DataContext.SaveChanges(); - } - } -} diff --git a/projecttemplates/RelyingPartyLogic/Model.edmx b/projecttemplates/RelyingPartyLogic/Model.edmx index 9d7ec7b..2123935 100644 --- a/projecttemplates/RelyingPartyLogic/Model.edmx +++ b/projecttemplates/RelyingPartyLogic/Model.edmx @@ -4,27 +4,27 @@ <edmx:Runtime> <!-- SSDL content --> <edmx:StorageModels> - <Schema Namespace="DatabaseModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl"> + <Schema Namespace="DatabaseModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl"> <EntityContainer Name="DatabaseModelStoreContainer"> - <EntitySet Name="AuthenticationToken" EntityType="DatabaseModel.Store.AuthenticationToken" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> - <EntitySet Name="Consumer" EntityType="DatabaseModel.Store.Consumer" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> - <EntitySet Name="IssuedToken" EntityType="DatabaseModel.Store.IssuedToken" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> - <EntitySet Name="Nonce" EntityType="DatabaseModel.Store.Nonce" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> - <EntitySet Name="OpenIDAssociation" EntityType="DatabaseModel.Store.OpenIDAssociation" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> - <EntitySet Name="Role" EntityType="DatabaseModel.Store.Role" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> - <EntitySet Name="User" EntityType="DatabaseModel.Store.User" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> - <EntitySet Name="UserRole" EntityType="DatabaseModel.Store.UserRole" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" /> + <EntitySet Name="AuthenticationToken" EntityType="DatabaseModel.Store.AuthenticationToken" store:Type="Tables" Schema="dbo" /> + <EntitySet Name="Client" EntityType="DatabaseModel.Store.Client" store:Type="Tables" Schema="dbo" /> + <EntitySet Name="ClientAuthorization" EntityType="DatabaseModel.Store.ClientAuthorization" store:Type="Tables" Schema="dbo" /> + <EntitySet Name="Nonce" EntityType="DatabaseModel.Store.Nonce" store:Type="Tables" Schema="dbo" /> + <EntitySet Name="OpenIDAssociation" EntityType="DatabaseModel.Store.OpenIDAssociation" store:Type="Tables" Schema="dbo" /> + <EntitySet Name="Role" EntityType="DatabaseModel.Store.Role" store:Type="Tables" Schema="dbo" /> + <EntitySet Name="User" EntityType="DatabaseModel.Store.User" store:Type="Tables" Schema="dbo" /> + <EntitySet Name="UserRole" EntityType="DatabaseModel.Store.UserRole" store:Type="Tables" Schema="dbo" /> <AssociationSet Name="FK_AuthenticationToken_User" Association="DatabaseModel.Store.FK_AuthenticationToken_User"> <End Role="User" EntitySet="User" /> <End Role="AuthenticationToken" EntitySet="AuthenticationToken" /> </AssociationSet> <AssociationSet Name="FK_IssuedToken_Consumer" Association="DatabaseModel.Store.FK_IssuedToken_Consumer"> - <End Role="Consumer" EntitySet="Consumer" /> - <End Role="IssuedToken" EntitySet="IssuedToken" /> + <End Role="Client" EntitySet="Client" /> + <End Role="ClientAuthorization" EntitySet="ClientAuthorization" /> </AssociationSet> <AssociationSet Name="FK_IssuedToken_User" Association="DatabaseModel.Store.FK_IssuedToken_User"> <End Role="User" EntitySet="User" /> - <End Role="IssuedToken" EntitySet="IssuedToken" /> + <End Role="ClientAuthorization" EntitySet="ClientAuthorization" /> </AssociationSet> <AssociationSet Name="FK_UserRole_Role" Association="DatabaseModel.Store.FK_UserRole_Role"> <End Role="Role" EntitySet="Role" /> @@ -47,35 +47,26 @@ <Property Name="LastUsed" Type="datetime" Nullable="false" /> <Property Name="UsageCount" Type="int" Nullable="false" /> </EntityType> - <EntityType Name="Consumer"> + <EntityType Name="Client"> <Key> - <PropertyRef Name="ConsumerId" /> + <PropertyRef Name="ClientId" /> </Key> - <Property Name="ConsumerId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> - <Property Name="ConsumerKey" Type="nvarchar" Nullable="false" MaxLength="255" /> - <Property Name="ConsumerSecret" Type="nvarchar" MaxLength="255" /> - <Property Name="X509Certificate" Type="image" /> - <Property Name="Callback" Type="nvarchar" MaxLength="2048" /> - <Property Name="VerificationCodeFormat" Type="int" Nullable="false" /> - <Property Name="VerificationCodeLength" Type="int" Nullable="false" /> + <Property Name="ClientId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> + <Property Name="ClientIdentifier" Type="varchar" Nullable="false" MaxLength="255" /> + <Property Name="ClientSecret" Type="varchar" MaxLength="255" /> + <Property Name="Callback" Type="varchar" MaxLength="2048" /> <Property Name="Name" Type="nvarchar" MaxLength="50" /> </EntityType> - <EntityType Name="IssuedToken"> + <EntityType Name="ClientAuthorization"> <Key> - <PropertyRef Name="IssuedTokenId" /> + <PropertyRef Name="AuthorizationId" /> </Key> - <Property Name="IssuedTokenId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> - <Property Name="ConsumerId" Type="int" Nullable="false" /> - <Property Name="UserId" Type="int" /> - <Property Name="Token" Type="nvarchar" Nullable="false" MaxLength="255" /> - <Property Name="TokenSecret" Type="nvarchar" Nullable="false" MaxLength="255" /> + <Property Name="AuthorizationId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /> + <Property Name="ClientId" Type="int" Nullable="false" /> + <Property Name="UserId" Type="int" Nullable="false" /> <Property Name="CreatedOn" Type="datetime" Nullable="false" /> - <Property Name="Callback" Type="nvarchar" MaxLength="2048" /> - <Property Name="VerificationCode" Type="nvarchar" MaxLength="255" /> - <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" /> + <Property Name="Scope" Type="varchar" MaxLength="2048" /> </EntityType> <EntityType Name="Nonce"> <Key> @@ -95,7 +86,7 @@ <Property Name="DistinguishingFactor" Type="varchar" Nullable="false" MaxLength="255" /> <Property Name="AssociationHandle" Type="varchar" Nullable="false" MaxLength="255" /> <Property Name="Expiration" Type="datetime" Nullable="false" /> - <Property Name="PrivateData" Type="binary" Nullable="false" MaxLength="32" /> + <Property Name="PrivateData" Type="binary" Nullable="false" MaxLength="64" /> <Property Name="PrivateDataLength" Type="int" Nullable="false" /> </EntityType> <EntityType Name="Role"> @@ -139,29 +130,29 @@ </ReferentialConstraint> </Association> <Association Name="FK_IssuedToken_Consumer"> - <End Role="Consumer" Type="DatabaseModel.Store.Consumer" Multiplicity="1"> + <End Role="Client" Type="DatabaseModel.Store.Client" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> - <End Role="IssuedToken" Type="DatabaseModel.Store.IssuedToken" Multiplicity="*" /> + <End Role="ClientAuthorization" Type="DatabaseModel.Store.ClientAuthorization" Multiplicity="*" /> <ReferentialConstraint> - <Principal Role="Consumer"> - <PropertyRef Name="ConsumerId" /> + <Principal Role="Client"> + <PropertyRef Name="ClientId" /> </Principal> - <Dependent Role="IssuedToken"> - <PropertyRef Name="ConsumerId" /> + <Dependent Role="ClientAuthorization"> + <PropertyRef Name="ClientId" /> </Dependent> </ReferentialConstraint> </Association> <Association Name="FK_IssuedToken_User"> - <End Role="User" Type="DatabaseModel.Store.User" Multiplicity="0..1"> + <End Role="User" Type="DatabaseModel.Store.User" Multiplicity="1"> <OnDelete Action="Cascade" /> </End> - <End Role="IssuedToken" Type="DatabaseModel.Store.IssuedToken" Multiplicity="*" /> + <End Role="ClientAuthorization" Type="DatabaseModel.Store.ClientAuthorization" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="User"> <PropertyRef Name="UserId" /> </Principal> - <Dependent Role="IssuedToken"> + <Dependent Role="ClientAuthorization"> <PropertyRef Name="UserId" /> </Dependent> </ReferentialConstraint> @@ -208,20 +199,23 @@ <End Role="User" EntitySet="Users" /> </AssociationSet> <EntitySet Name="AuthenticationTokens" EntityType="DatabaseModel.AuthenticationToken" /> - <EntitySet Name="Consumers" EntityType="DatabaseModel.Consumer" /> - <EntitySet Name="IssuedTokens" EntityType="DatabaseModel.IssuedToken" /> <AssociationSet Name="FK_AuthenticationToken_User" Association="DatabaseModel.FK_AuthenticationToken_User"> <End Role="User" EntitySet="Users" /> <End Role="AuthenticationToken" EntitySet="AuthenticationTokens" /></AssociationSet> - <AssociationSet Name="FK_IssuedToken_Consumer1" Association="DatabaseModel.FK_IssuedToken_Consumer1"> - <End Role="Consumer" EntitySet="Consumers" /> - <End Role="IssuedToken" EntitySet="IssuedTokens" /></AssociationSet> - <AssociationSet Name="FK_IssuedToken_User1" Association="DatabaseModel.FK_IssuedToken_User1"> - <End Role="User" EntitySet="Users" /> - <End Role="IssuedToken" EntitySet="IssuedTokens" /></AssociationSet> <EntitySet Name="Nonces" EntityType="DatabaseModel.Nonce" /> <EntitySet Name="OpenIdAssociations" EntityType="DatabaseModel.OpenIdAssociation" /> - <FunctionImport Name="ClearExpiredNonces" /></EntityContainer> + <FunctionImport Name="ClearExpiredNonces" /> + <EntitySet Name="Clients" EntityType="DatabaseModel.Client" /> + <EntitySet Name="ClientAuthorizations" EntityType="DatabaseModel.ClientAuthorization" /> + <AssociationSet Name="FK_IssuedToken_Consumer" Association="DatabaseModel.FK_IssuedToken_Consumer"> + <End Role="Client" EntitySet="Clients" /> + <End Role="ClientAuthorization" EntitySet="ClientAuthorizations" /> + </AssociationSet> + <AssociationSet Name="FK_IssuedToken_User" Association="DatabaseModel.FK_IssuedToken_User"> + <End Role="User" EntitySet="Users" /> + <End Role="ClientAuthorization" EntitySet="ClientAuthorizations" /> + </AssociationSet> + </EntityContainer> <EntityType Name="AuthenticationToken" Abstract="false"> <Key> <PropertyRef Name="AuthenticationTokenId" /></Key> @@ -253,48 +247,14 @@ <Property Name="CreatedOnUtc" Type="DateTime" Nullable="false" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /> <Property Name="UserId" Type="Int32" Nullable="false" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /> <NavigationProperty Name="AuthenticationTokens" Relationship="DatabaseModel.FK_AuthenticationToken_User" FromRole="User" ToRole="AuthenticationToken" /> - <NavigationProperty Name="IssuedTokens" Relationship="DatabaseModel.FK_IssuedToken_User1" FromRole="User" ToRole="IssuedToken" /></EntityType> + <NavigationProperty Name="ClientAuthorizations" Relationship="DatabaseModel.FK_IssuedToken_User" FromRole="User" ToRole="ClientAuthorization" /></EntityType> <Association Name="UserRole"> <End Role="Role" Type="DatabaseModel.Role" Multiplicity="*" /> <End Role="User" Type="DatabaseModel.User" Multiplicity="*" /> </Association> - <EntityType Name="Consumer"> - <Key> - <PropertyRef Name="ConsumerId" /></Key> - <Property Name="ConsumerKey" Type="String" Nullable="false" /> - <Property Name="ConsumerSecret" Type="String" Nullable="true" /> - <Property Name="X509CertificateAsBinary" Type="Binary" Nullable="true" a:SetterAccess="Private" a:GetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /> - <Property Name="CallbackAsString" Type="String" Nullable="true" /> - <Property Name="VerificationCodeFormatAsInt" Type="Int32" Nullable="false" a:GetterAccess="Private" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /> - <Property Name="VerificationCodeLength" Type="Int32" Nullable="false" /> - <Property Name="ConsumerId" Type="Int32" Nullable="false" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /> - <Property Name="Name" Type="String" Nullable="true" /> - <NavigationProperty Name="IssuedTokens" Relationship="DatabaseModel.FK_IssuedToken_Consumer1" FromRole="Consumer" ToRole="IssuedToken" /></EntityType> - <EntityType Name="IssuedToken" Abstract="true"> - <Key> - <PropertyRef Name="IssuedTokenId" /></Key> - <Property Name="Token" Type="String" Nullable="false" /> - <Property Name="TokenSecret" Type="String" Nullable="false" /> - <Property Name="CreatedOnUtc" Type="DateTime" Nullable="false" a:SetterAccess="Internal" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /> - <Property Name="Scope" Type="String" Nullable="true" /> - <Property Name="IssuedTokenId" Type="Int32" Nullable="false" a:SetterAccess="Internal" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /> - <NavigationProperty Name="Consumer" Relationship="DatabaseModel.FK_IssuedToken_Consumer1" FromRole="IssuedToken" ToRole="Consumer" /> - <NavigationProperty Name="User" Relationship="DatabaseModel.FK_IssuedToken_User1" FromRole="IssuedToken" ToRole="User" /></EntityType> - <EntityType Name="IssuedRequestToken" BaseType="DatabaseModel.IssuedToken"> - <Property Name="ConsumerVersionAsString" Type="String" Nullable="false" a:GetterAccess="Private" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /> - <Property Name="VerificationCode" Type="String" Nullable="true" /> - <Property Name="CallbackAsString" Type="String" Nullable="true" a:GetterAccess="Private" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /></EntityType> - <EntityType Name="IssuedAccessToken" BaseType="DatabaseModel.IssuedToken"> - <Property Name="ExpirationDateUtc" Type="DateTime" Nullable="true" /></EntityType> <Association Name="FK_AuthenticationToken_User"> <End Type="DatabaseModel.User" Role="User" Multiplicity="1" /> <End Type="DatabaseModel.AuthenticationToken" Role="AuthenticationToken" Multiplicity="*" /></Association> - <Association Name="FK_IssuedToken_Consumer1"> - <End Type="DatabaseModel.Consumer" Role="Consumer" Multiplicity="1" /> - <End Type="DatabaseModel.IssuedToken" Role="IssuedToken" Multiplicity="*" /></Association> - <Association Name="FK_IssuedToken_User1"> - <End Type="DatabaseModel.User" Role="User" Multiplicity="0..1" /> - <End Type="DatabaseModel.IssuedToken" Role="IssuedToken" Multiplicity="*" /></Association> <EntityType Name="Nonce" a:TypeAccess="Public" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration"> <Key> <PropertyRef Name="NonceId" /></Key> @@ -315,7 +275,37 @@ <Property Name="AssociationHandle" Type="String" Nullable="false" /> <Property Name="ExpirationUtc" Type="DateTime" Nullable="false" /> <Property Name="PrivateData" Type="Binary" Nullable="false" /> - <Property Name="PrivateDataLength" Type="Int32" Nullable="false" /></EntityType></Schema> + <Property Name="PrivateDataLength" Type="Int32" Nullable="false" /></EntityType> + <EntityType Name="Client"> + <Key> + <PropertyRef Name="ClientId" /> + </Key> + <Property Type="Int32" Name="ClientId" Nullable="false" a:StoreGeneratedPattern="Identity" xmlns:a="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> + <Property Type="String" Name="ClientIdentifier" Nullable="false" MaxLength="255" FixedLength="false" Unicode="true" /> + <Property Type="String" Name="ClientSecret" MaxLength="255" FixedLength="false" Unicode="true" /> + <Property Type="String" Name="CallbackAsString" MaxLength="2048" FixedLength="false" Unicode="true" /> + <Property Type="String" Name="Name" MaxLength="50" FixedLength="false" Unicode="true" /> + <NavigationProperty Name="ClientAuthorizations" Relationship="DatabaseModel.FK_IssuedToken_Consumer" FromRole="Client" ToRole="ClientAuthorization" /> + </EntityType> + <EntityType Name="ClientAuthorization"> + <Key> + <PropertyRef Name="AuthorizationId" /> + </Key> + <Property Type="Int32" Name="AuthorizationId" Nullable="false" a:StoreGeneratedPattern="Identity" xmlns:a="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /> + <Property Type="DateTime" Name="CreatedOnUtc" Nullable="false" /> + <Property Type="DateTime" Name="ExpirationDate" /> + <Property Type="String" Name="Scope" MaxLength="2048" FixedLength="false" Unicode="false" /> + <NavigationProperty Name="Client" Relationship="DatabaseModel.FK_IssuedToken_Consumer" FromRole="ClientAuthorization" ToRole="Client" /> + <NavigationProperty Name="User" Relationship="DatabaseModel.FK_IssuedToken_User" FromRole="ClientAuthorization" ToRole="User" /> + </EntityType> + <Association Name="FK_IssuedToken_Consumer"> + <End Type="DatabaseModel.Client" Role="Client" Multiplicity="1" /> + <End Type="DatabaseModel.ClientAuthorization" Role="ClientAuthorization" Multiplicity="*" /> + </Association> + <Association Name="FK_IssuedToken_User"> + <End Type="DatabaseModel.User" Role="User" Multiplicity="1" /> + <End Type="DatabaseModel.ClientAuthorization" Role="ClientAuthorization" Multiplicity="*" /> + </Association></Schema> </edmx:ConceptualModels> <!-- C-S mapping content --> <edmx:Mappings> @@ -358,54 +348,11 @@ </MappingFragment> </EntityTypeMapping> </EntitySetMapping> - <EntitySetMapping Name="Consumers"> - <EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.Consumer)"> - <MappingFragment StoreEntitySet="Consumer"> - <ScalarProperty Name="Name" ColumnName="Name" /> - <ScalarProperty Name="ConsumerId" ColumnName="ConsumerId" /> - <ScalarProperty Name="VerificationCodeLength" ColumnName="VerificationCodeLength" /> - <ScalarProperty Name="VerificationCodeFormatAsInt" ColumnName="VerificationCodeFormat" /> - <ScalarProperty Name="CallbackAsString" ColumnName="Callback" /> - <ScalarProperty Name="X509CertificateAsBinary" ColumnName="X509Certificate" /> - <ScalarProperty Name="ConsumerSecret" ColumnName="ConsumerSecret" /> - <ScalarProperty Name="ConsumerKey" ColumnName="ConsumerKey" /></MappingFragment></EntityTypeMapping></EntitySetMapping> - <EntitySetMapping Name="IssuedTokens"> - <EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.IssuedToken)"> - <MappingFragment StoreEntitySet="IssuedToken"> - <ScalarProperty Name="IssuedTokenId" ColumnName="IssuedTokenId" /> - <ScalarProperty Name="Scope" ColumnName="Scope" /> - <ScalarProperty Name="CreatedOnUtc" ColumnName="CreatedOn" /> - <ScalarProperty Name="TokenSecret" ColumnName="TokenSecret" /> - <ScalarProperty Name="Token" ColumnName="Token" /> - </MappingFragment></EntityTypeMapping> - <EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.IssuedRequestToken)"> - <MappingFragment StoreEntitySet="IssuedToken"> - <ScalarProperty Name="IssuedTokenId" ColumnName="IssuedTokenId" /> - <ScalarProperty Name="CallbackAsString" ColumnName="Callback" /> - <ScalarProperty Name="ConsumerVersionAsString" ColumnName="ConsumerVersion" /> - <ScalarProperty Name="VerificationCode" ColumnName="VerificationCode" /> - <Condition ColumnName="IsAccessToken" Value="0" /></MappingFragment></EntityTypeMapping> - <EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.IssuedAccessToken)"> - <MappingFragment StoreEntitySet="IssuedToken"> - <ScalarProperty Name="IssuedTokenId" ColumnName="IssuedTokenId" /> - <ScalarProperty Name="ExpirationDateUtc" ColumnName="ExpirationDate" /> - <Condition ColumnName="IsAccessToken" Value="1" /></MappingFragment></EntityTypeMapping></EntitySetMapping> <AssociationSetMapping Name="FK_AuthenticationToken_User" TypeName="DatabaseModel.FK_AuthenticationToken_User" StoreEntitySet="AuthenticationToken"> <EndProperty Name="AuthenticationToken"> <ScalarProperty Name="AuthenticationTokenId" ColumnName="AuthenticationTokenId" /></EndProperty> <EndProperty Name="User"> <ScalarProperty Name="UserId" ColumnName="UserId" /></EndProperty></AssociationSetMapping> - <AssociationSetMapping Name="FK_IssuedToken_Consumer1" TypeName="DatabaseModel.FK_IssuedToken_Consumer1" StoreEntitySet="IssuedToken"> - <EndProperty Name="IssuedToken"> - <ScalarProperty Name="IssuedTokenId" ColumnName="IssuedTokenId" /></EndProperty> - <EndProperty Name="Consumer"> - <ScalarProperty Name="ConsumerId" ColumnName="ConsumerId" /></EndProperty></AssociationSetMapping> - <AssociationSetMapping Name="FK_IssuedToken_User1" TypeName="DatabaseModel.FK_IssuedToken_User1" StoreEntitySet="IssuedToken"> - <EndProperty Name="IssuedToken"> - <ScalarProperty Name="IssuedTokenId" ColumnName="IssuedTokenId" /></EndProperty> - <EndProperty Name="User"> - <ScalarProperty Name="UserId" ColumnName="UserId" /></EndProperty> - <Condition ColumnName="UserId" IsNull="false" /></AssociationSetMapping> <EntitySetMapping Name="Nonces"> <EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.Nonce)"> <MappingFragment StoreEntitySet="Nonce"> @@ -423,7 +370,44 @@ <ScalarProperty Name="AssociationHandle" ColumnName="AssociationHandle" /> <ScalarProperty Name="DistinguishingFactor" ColumnName="DistinguishingFactor" /> <ScalarProperty Name="AssociationId" ColumnName="AssociationId" /></MappingFragment></EntityTypeMapping></EntitySetMapping> - <FunctionImportMapping FunctionImportName="ClearExpiredNonces" FunctionName="DatabaseModel.Store.ClearExpiredNonces" /></EntityContainerMapping> + <FunctionImportMapping FunctionImportName="ClearExpiredNonces" FunctionName="DatabaseModel.Store.ClearExpiredNonces" /> + <EntitySetMapping Name="Clients"> + <EntityTypeMapping TypeName="DatabaseModel.Client"> + <MappingFragment StoreEntitySet="Client"> + <ScalarProperty Name="Name" ColumnName="Name" /> + <ScalarProperty Name="CallbackAsString" ColumnName="Callback" /> + <ScalarProperty Name="ClientSecret" ColumnName="ClientSecret" /> + <ScalarProperty Name="ClientIdentifier" ColumnName="ClientIdentifier" /> + <ScalarProperty Name="ClientId" ColumnName="ClientId" /> + </MappingFragment> + </EntityTypeMapping> + </EntitySetMapping> + <EntitySetMapping Name="ClientAuthorizations"> + <EntityTypeMapping TypeName="DatabaseModel.ClientAuthorization"> + <MappingFragment StoreEntitySet="ClientAuthorization"> + <ScalarProperty Name="Scope" ColumnName="Scope" /> + <ScalarProperty Name="ExpirationDate" ColumnName="ExpirationDate" /> + <ScalarProperty Name="CreatedOnUtc" ColumnName="CreatedOn" /> + <ScalarProperty Name="AuthorizationId" ColumnName="AuthorizationId" /> + </MappingFragment> + </EntityTypeMapping> + </EntitySetMapping> + <AssociationSetMapping Name="FK_IssuedToken_Consumer" TypeName="DatabaseModel.FK_IssuedToken_Consumer" StoreEntitySet="ClientAuthorization"> + <EndProperty Name="ClientAuthorization"> + <ScalarProperty Name="AuthorizationId" ColumnName="AuthorizationId" /> + </EndProperty> + <EndProperty Name="Client"> + <ScalarProperty Name="ClientId" ColumnName="ClientId" /> + </EndProperty> + </AssociationSetMapping> + <AssociationSetMapping Name="FK_IssuedToken_User" TypeName="DatabaseModel.FK_IssuedToken_User" StoreEntitySet="ClientAuthorization"> + <EndProperty Name="ClientAuthorization"> + <ScalarProperty Name="AuthorizationId" ColumnName="AuthorizationId" /> + </EndProperty> + <EndProperty Name="User"> + <ScalarProperty Name="UserId" ColumnName="UserId" /> + </EndProperty> + </AssociationSetMapping></EntityContainerMapping> </Mapping> </edmx:Mappings> </edmx:Runtime> @@ -437,11 +421,13 @@ <edmx:Options> <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2007/06/edmx"> <DesignerProperty Name="ValidateOnBuild" Value="true" /> + <DesignerProperty Name="EnablePluralization" Value="True" /> + <DesignerProperty Name="IncludeForeignKeysInModel" Value="False" /> </DesignerInfoPropertySet> </edmx:Options> <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> - <Diagram Name="Model" ZoomLevel="56" xmlns="http://schemas.microsoft.com/ado/2007/06/edmx"> + <Diagram Name="Model" ZoomLevel="101" xmlns="http://schemas.microsoft.com/ado/2007/06/edmx"> <EntityTypeShape EntityType="DatabaseModel.AuthenticationToken" Width="1.875" PointX="5.25" PointY="0.75" Height="2.5571907552083339" IsExpanded="true" /> <EntityTypeShape EntityType="DatabaseModel.Role" Width="1.5" PointX="0.75" PointY="1.25" Height="1.59568359375" IsExpanded="true" /> <EntityTypeShape EntityType="DatabaseModel.User" Width="1.75" PointX="2.875" PointY="0.5" Height="3.1340950520833339" IsExpanded="true" /> @@ -451,30 +437,20 @@ <InheritanceConnector EntityType="DatabaseModel.AuthenticationToken"> <ConnectorPoint PointX="6.5625" PointY="3.375" /> <ConnectorPoint PointX="6.5625" PointY="2.9129850260416665" /></InheritanceConnector> - <EntityTypeShape EntityType="DatabaseModel.Consumer" Width="2.125" PointX="0.5" PointY="3.625" Height="2.1725878906249996" /> - <EntityTypeShape EntityType="DatabaseModel.IssuedToken" Width="2" PointX="5.25" PointY="3.875" Height="2.7494921874999996" /> - <EntityTypeShape EntityType="DatabaseModel.IssuedRequestToken" Width="2" PointX="4.25" PointY="7" Height="1.5956835937499996" /> - <EntityTypeShape EntityType="DatabaseModel.IssuedAccessToken" Width="1.625" PointX="6.5" PointY="7" Height="1.2110807291666657" /> - <InheritanceConnector EntityType="DatabaseModel.IssuedRequestToken" ManuallyRouted="false"> - <ConnectorPoint PointX="5.75" PointY="6.6244921875" /> - <ConnectorPoint PointX="5.75" PointY="7" /> - </InheritanceConnector> - <InheritanceConnector EntityType="DatabaseModel.IssuedAccessToken" ManuallyRouted="false"> - <ConnectorPoint PointX="6.875" PointY="6.6244921875" /> - <ConnectorPoint PointX="6.875" PointY="7" /> - </InheritanceConnector> <AssociationConnector Association="DatabaseModel.FK_AuthenticationToken_User"> - <ConnectorPoint PointX="4.625" PointY="1.4776205358072916" /> - <ConnectorPoint PointX="5.25" PointY="1.4776205358072916" /></AssociationConnector> - <AssociationConnector Association="DatabaseModel.FK_IssuedToken_Consumer1"> - <ConnectorPoint PointX="2.625" PointY="4.8322661624685885" /> - <ConnectorPoint PointX="5.25" PointY="4.8322661624685885" /> - </AssociationConnector> - <AssociationConnector Association="DatabaseModel.FK_IssuedToken_User1"> - <ConnectorPoint PointX="3.75" PointY="3.6340950520833339" /> - <ConnectorPoint PointX="3.75" PointY="4.0627779870647478" /> - <ConnectorPoint PointX="5.25" PointY="4.0627779870647478" /></AssociationConnector> - <EntityTypeShape EntityType="DatabaseModel.Nonce" Width="1.5" PointX="0.5" PointY="7.75" Height="1.9802864583333326" /> - <EntityTypeShape EntityType="DatabaseModel.OpenIdAssociation" Width="1.75" PointX="2.25" PointY="7.75" Height="1.9802864583333333" /></Diagram></edmx:Diagrams> + <ConnectorPoint PointX="4.625" PointY="1.9324446614583337" /> + <ConnectorPoint PointX="5.25" PointY="1.9324446614583337" /></AssociationConnector> + <EntityTypeShape EntityType="DatabaseModel.Nonce" Width="1.5" PointX="9.375" PointY="0.75" Height="1.9802864583333326" /> + <EntityTypeShape EntityType="DatabaseModel.OpenIdAssociation" Width="1.75" PointX="7.375" PointY="0.75" Height="2.1725878906249996" /> + <EntityTypeShape EntityType="DatabaseModel.Client" Width="1.625" PointX="5.25" PointY="3.75" Height="2.1725878906249996" /> + <EntityTypeShape EntityType="DatabaseModel.ClientAuthorization" Width="1.75" PointX="2.875" PointY="3.75" Height="2.1725878906250031" /> + <AssociationConnector Association="DatabaseModel.FK_IssuedToken_Consumer" > + <ConnectorPoint PointX="5.25" PointY="4.8362939453125" /> + <ConnectorPoint PointX="4.625" PointY="4.8362939453125" /> + </AssociationConnector> + <AssociationConnector Association="DatabaseModel.FK_IssuedToken_User" > + <ConnectorPoint PointX="3.75" PointY="3.2494921875" /> + <ConnectorPoint PointX="3.75" PointY="3.75" /> + </AssociationConnector></Diagram></edmx:Diagrams> </edmx:Designer> </edmx:Edmx>
\ No newline at end of file diff --git a/projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs b/projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs index ff8bbb4..af3dba5 100644 --- a/projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs +++ b/projecttemplates/RelyingPartyLogic/OAuthAuthorizationServer.cs @@ -82,7 +82,7 @@ namespace RelyingPartyLogic { /// <returns>The client registration. Never null.</returns> /// <exception cref="ArgumentException">Thrown when no client with the given identifier is registered with this authorization server.</exception> public IConsumerDescription GetClient(string clientIdentifier) { - return Database.DataContext.Consumers.First(c => c.ConsumerKey == clientIdentifier); + return Database.DataContext.Clients.First(c => c.ClientIdentifier == clientIdentifier); } /// <summary> diff --git a/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj b/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj index 8f11aef..21215b0 100644 --- a/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj +++ b/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj @@ -106,18 +106,16 @@ </ItemGroup> <ItemGroup> <Compile Include="Model.cs" /> - <Compile Include="Model.IssuedToken.cs" /> + <Compile Include="Model.ClientAuthorization.cs" /> <Compile Include="Database.cs" /> <Compile Include="DataRoleProvider.cs" /> <Compile Include="Model.AuthenticationToken.cs" /> - <Compile Include="Model.Consumer.cs" /> + <Compile Include="Model.Client.cs" /> <Compile Include="Model.Designer.cs"> <DependentUpon>Model.edmx</DependentUpon> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> </Compile> - <Compile Include="Model.IssuedAccessToken.cs" /> - <Compile Include="Model.IssuedRequestToken.cs" /> <Compile Include="Model.OpenIdAssociation.cs" /> <Compile Include="Model.User.cs" /> <Compile Include="NonceDbStore.cs" /> |