summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--projecttemplates/RelyingPartyLogic/CreateDatabase.sql36
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs21
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.Designer.cs446
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.IssuedAccessToken.cs16
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.IssuedRequestToken.cs7
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.IssuedToken.cs28
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.User.cs13
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.edmx215
-rw-r--r--projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs4
-rw-r--r--projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj1
-rw-r--r--projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs3
-rw-r--r--projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs16
12 files changed, 506 insertions, 300 deletions
diff --git a/projecttemplates/RelyingPartyLogic/CreateDatabase.sql b/projecttemplates/RelyingPartyLogic/CreateDatabase.sql
index 52ca669..81aff9f 100644
--- a/projecttemplates/RelyingPartyLogic/CreateDatabase.sql
+++ b/projecttemplates/RelyingPartyLogic/CreateDatabase.sql
@@ -27,14 +27,15 @@ GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[User](
- [Id] [int] IDENTITY(1,1) NOT NULL,
+ [UserId] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LastName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[EmailAddress] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[EmailAddressVerified] [bit] NOT NULL,
+ [CreatedOn] [datetime] NOT NULL,
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED
(
- [Id] ASC
+ [UserId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
@@ -43,11 +44,11 @@ GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Role](
- [Id] [int] IDENTITY(1,1) NOT NULL,
+ [RoleId] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_Role] PRIMARY KEY CLUSTERED
(
- [Id] ASC
+ [RoleId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
@@ -58,7 +59,7 @@ GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[IssuedToken](
- [TokenId] [int] IDENTITY(1,1) NOT NULL,
+ [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,
@@ -72,7 +73,7 @@ CREATE TABLE [dbo].[IssuedToken](
[Scope] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_IssuedToken] PRIMARY KEY CLUSTERED
(
- [TokenId] ASC
+ [IssuedTokenId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
@@ -102,13 +103,16 @@ GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AuthenticationToken](
- [Id] [int] IDENTITY(1,1) NOT NULL,
+ [AuthenticationTokenId] [int] IDENTITY(1,1) NOT NULL,
[UserId] [int] NOT NULL,
[OpenIdClaimedIdentifier] [nvarchar](250) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL,
[OpenIdFriendlyIdentifier] [nvarchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
+ [CreatedOn] [datetime] NOT NULL,
+ [LastUsed] [datetime] NOT NULL,
+ [UsageCount] [int] NOT NULL,
CONSTRAINT [PK_AuthenticationToken] PRIMARY KEY CLUSTERED
(
- [Id] ASC
+ [AuthenticationTokenId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
@@ -156,10 +160,18 @@ AS
GO
ALTER TABLE [dbo].[User] ADD CONSTRAINT [DF_User_EmailAddressVerified] DEFAULT ((0)) FOR [EmailAddressVerified]
GO
+ALTER TABLE [dbo].[User] ADD CONSTRAINT [DF_User_CreatedOn] DEFAULT (getdate()) FOR [CreatedOn]
+GO
ALTER TABLE [dbo].[IssuedToken] ADD CONSTRAINT [DF_IssuedToken_CreatedOn] DEFAULT (getdate()) FOR [CreatedOn]
GO
ALTER TABLE [dbo].[IssuedToken] ADD CONSTRAINT [DF_IssuedToken_IsAccessToken] DEFAULT ((0)) FOR [IsAccessToken]
GO
+ALTER TABLE [dbo].[AuthenticationToken] ADD CONSTRAINT [DF_AuthenticationToken_CreatedOn] DEFAULT (getdate()) FOR [CreatedOn]
+GO
+ALTER TABLE [dbo].[AuthenticationToken] ADD CONSTRAINT [DF_AuthenticationToken_LastUsed] DEFAULT (getdate()) FOR [LastUsed]
+GO
+ALTER TABLE [dbo].[AuthenticationToken] ADD CONSTRAINT [DF_AuthenticationToken_UsageCount] DEFAULT ((0)) FOR [UsageCount]
+GO
ALTER TABLE [dbo].[IssuedToken] WITH CHECK ADD CONSTRAINT [FK_IssuedToken_Consumer] FOREIGN KEY([ConsumerId])
REFERENCES [dbo].[Consumer] ([ConsumerId])
ON UPDATE CASCADE
@@ -168,28 +180,28 @@ GO
ALTER TABLE [dbo].[IssuedToken] CHECK CONSTRAINT [FK_IssuedToken_Consumer]
GO
ALTER TABLE [dbo].[IssuedToken] WITH CHECK ADD CONSTRAINT [FK_IssuedToken_User] FOREIGN KEY([UserId])
-REFERENCES [dbo].[User] ([Id])
+REFERENCES [dbo].[User] ([UserId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[IssuedToken] CHECK CONSTRAINT [FK_IssuedToken_User]
GO
ALTER TABLE [dbo].[UserRole] WITH CHECK ADD CONSTRAINT [FK_UserRole_Role] FOREIGN KEY([RoleId])
-REFERENCES [dbo].[Role] ([Id])
+REFERENCES [dbo].[Role] ([RoleId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[UserRole] CHECK CONSTRAINT [FK_UserRole_Role]
GO
ALTER TABLE [dbo].[UserRole] WITH CHECK ADD CONSTRAINT [FK_UserRole_User] FOREIGN KEY([UserId])
-REFERENCES [dbo].[User] ([Id])
+REFERENCES [dbo].[User] ([UserId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[UserRole] CHECK CONSTRAINT [FK_UserRole_User]
GO
ALTER TABLE [dbo].[AuthenticationToken] WITH CHECK ADD CONSTRAINT [FK_AuthenticationToken_User] FOREIGN KEY([UserId])
-REFERENCES [dbo].[User] ([Id])
+REFERENCES [dbo].[User] ([UserId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
diff --git a/projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs b/projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs
index e44fd83..f629bf6 100644
--- a/projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs
+++ b/projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs
@@ -5,6 +5,15 @@
using System.Web;
public partial class AuthenticationToken {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AuthenticationToken"/> class.
+ /// </summary>
+ public AuthenticationToken() {
+ this.CreatedOnUtc = DateTime.UtcNow;
+ this.LastUsedUtc = DateTime.UtcNow;
+ this.UsageCount = 1;
+ }
+
public bool IsInfoCard {
get { return this.ClaimedIdentifier.StartsWith(UriPrefixForInfoCard); }
}
@@ -17,5 +26,17 @@
string synthesizedClaimedId = UriPrefixForInfoCard + Uri.EscapeDataString(uniqueId);
return synthesizedClaimedId;
}
+
+ partial void OnLastUsedUtcChanging(DateTime value) {
+ if (value.Kind != DateTimeKind.Utc) {
+ throw new ArgumentException("DateTime must be given in UTC time.");
+ }
+ }
+
+ partial void OnCreatedOnUtcChanging(DateTime value) {
+ if (value.Kind != DateTimeKind.Utc) {
+ throw new ArgumentException("DateTime must be given in UTC time.");
+ }
+ }
}
}
diff --git a/projecttemplates/RelyingPartyLogic/Model.Designer.cs b/projecttemplates/RelyingPartyLogic/Model.Designer.cs
index d19d305..af86171 100644
--- a/projecttemplates/RelyingPartyLogic/Model.Designer.cs
+++ b/projecttemplates/RelyingPartyLogic/Model.Designer.cs
@@ -10,12 +10,12 @@
[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", "UserAuthenticationToken", "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_Consumer", "Consumer", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(RelyingPartyLogic.Consumer), "IssuedTokens", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(RelyingPartyLogic.IssuedToken))]
-[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DatabaseModel", "FK_IssuedToken_User", "User", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(RelyingPartyLogic.User), "IssuedTokens", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(RelyingPartyLogic.IssuedToken))]
+[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))]
// Original file name:
-// Generation date: 11/13/2009 4:45:45 PM
+// Generation date: 11/16/2009 8:23:18 PM
namespace RelyingPartyLogic
{
@@ -164,7 +164,7 @@ namespace RelyingPartyLogic
/// There are no comments for DatabaseModel.AuthenticationToken in the schema.
/// </summary>
/// <KeyProperties>
- /// Id
+ /// AuthenticationTokenId
/// </KeyProperties>
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="AuthenticationToken")]
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
@@ -174,39 +174,22 @@ namespace RelyingPartyLogic
/// <summary>
/// Create a new AuthenticationToken object.
/// </summary>
- /// <param name="id">Initial value of Id.</param>
/// <param name="claimedIdentifier">Initial value of ClaimedIdentifier.</param>
- public static AuthenticationToken CreateAuthenticationToken(int id, string claimedIdentifier)
+ /// <param name="createdOnUtc">Initial value of CreatedOnUtc.</param>
+ /// <param name="lastUsedUtc">Initial value of LastUsedUtc.</param>
+ /// <param name="usageCount">Initial value of UsageCount.</param>
+ /// <param name="authenticationTokenId">Initial value of AuthenticationTokenId.</param>
+ public static AuthenticationToken CreateAuthenticationToken(string claimedIdentifier, global::System.DateTime createdOnUtc, global::System.DateTime lastUsedUtc, int usageCount, int authenticationTokenId)
{
AuthenticationToken authenticationToken = new AuthenticationToken();
- authenticationToken.Id = id;
authenticationToken.ClaimedIdentifier = claimedIdentifier;
+ authenticationToken.CreatedOnUtc = createdOnUtc;
+ authenticationToken.LastUsedUtc = lastUsedUtc;
+ authenticationToken.UsageCount = usageCount;
+ authenticationToken.AuthenticationTokenId = authenticationTokenId;
return authenticationToken;
}
/// <summary>
- /// There are no comments for Property Id in the schema.
- /// </summary>
- [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
- [global::System.Runtime.Serialization.DataMemberAttribute()]
- public int Id
- {
- get
- {
- return this._Id;
- }
- set
- {
- this.OnIdChanging(value);
- this.ReportPropertyChanging("Id");
- this._Id = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
- this.ReportPropertyChanged("Id");
- this.OnIdChanged();
- }
- }
- private int _Id;
- partial void OnIdChanging(int value);
- partial void OnIdChanged();
- /// <summary>
/// There are no comments for Property ClaimedIdentifier in the schema.
/// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
@@ -253,9 +236,101 @@ namespace RelyingPartyLogic
partial void OnFriendlyIdentifierChanging(string value);
partial void OnFriendlyIdentifierChanged();
/// <summary>
+ /// There are no comments for Property CreatedOnUtc in the schema.
+ /// </summary>
+ [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
+ [global::System.Runtime.Serialization.DataMemberAttribute()]
+ public global::System.DateTime CreatedOnUtc
+ {
+ get
+ {
+ return this._CreatedOnUtc;
+ }
+ private set
+ {
+ this.OnCreatedOnUtcChanging(value);
+ this.ReportPropertyChanging("CreatedOnUtc");
+ this._CreatedOnUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+ this.ReportPropertyChanged("CreatedOnUtc");
+ this.OnCreatedOnUtcChanged();
+ }
+ }
+ private global::System.DateTime _CreatedOnUtc;
+ partial void OnCreatedOnUtcChanging(global::System.DateTime value);
+ partial void OnCreatedOnUtcChanged();
+ /// <summary>
+ /// There are no comments for Property LastUsedUtc in the schema.
+ /// </summary>
+ [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
+ [global::System.Runtime.Serialization.DataMemberAttribute()]
+ public global::System.DateTime LastUsedUtc
+ {
+ get
+ {
+ return this._LastUsedUtc;
+ }
+ set
+ {
+ this.OnLastUsedUtcChanging(value);
+ this.ReportPropertyChanging("LastUsedUtc");
+ this._LastUsedUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+ this.ReportPropertyChanged("LastUsedUtc");
+ this.OnLastUsedUtcChanged();
+ }
+ }
+ private global::System.DateTime _LastUsedUtc;
+ partial void OnLastUsedUtcChanging(global::System.DateTime value);
+ partial void OnLastUsedUtcChanged();
+ /// <summary>
+ /// There are no comments for Property UsageCount in the schema.
+ /// </summary>
+ [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
+ [global::System.Runtime.Serialization.DataMemberAttribute()]
+ public int UsageCount
+ {
+ get
+ {
+ return this._UsageCount;
+ }
+ set
+ {
+ this.OnUsageCountChanging(value);
+ this.ReportPropertyChanging("UsageCount");
+ this._UsageCount = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+ this.ReportPropertyChanged("UsageCount");
+ this.OnUsageCountChanged();
+ }
+ }
+ private int _UsageCount;
+ partial void OnUsageCountChanging(int value);
+ partial void OnUsageCountChanged();
+ /// <summary>
+ /// There are no comments for Property AuthenticationTokenId in the schema.
+ /// </summary>
+ [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
+ [global::System.Runtime.Serialization.DataMemberAttribute()]
+ public int AuthenticationTokenId
+ {
+ get
+ {
+ return this._AuthenticationTokenId;
+ }
+ private set
+ {
+ this.OnAuthenticationTokenIdChanging(value);
+ this.ReportPropertyChanging("AuthenticationTokenId");
+ this._AuthenticationTokenId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+ this.ReportPropertyChanged("AuthenticationTokenId");
+ this.OnAuthenticationTokenIdChanged();
+ }
+ }
+ private int _AuthenticationTokenId;
+ partial void OnAuthenticationTokenIdChanging(int value);
+ partial void OnAuthenticationTokenIdChanged();
+ /// <summary>
/// There are no comments for User in the schema.
/// </summary>
- [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "UserAuthenticationToken", "User")]
+ [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_AuthenticationToken_User", "User")]
[global::System.Xml.Serialization.XmlIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()]
@@ -263,11 +338,11 @@ namespace RelyingPartyLogic
{
get
{
- return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.UserAuthenticationToken", "User").Value;
+ return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_AuthenticationToken_User", "User").Value;
}
set
{
- ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.UserAuthenticationToken", "User").Value = value;
+ ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_AuthenticationToken_User", "User").Value = value;
}
}
/// <summary>
@@ -279,13 +354,13 @@ namespace RelyingPartyLogic
{
get
{
- return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.UserAuthenticationToken", "User");
+ return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_AuthenticationToken_User", "User");
}
set
{
if ((value != null))
{
- ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<User>("DatabaseModel.UserAuthenticationToken", "User", value);
+ ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<User>("DatabaseModel.FK_AuthenticationToken_User", "User", value);
}
}
}
@@ -294,7 +369,7 @@ namespace RelyingPartyLogic
/// There are no comments for DatabaseModel.Role in the schema.
/// </summary>
/// <KeyProperties>
- /// Id
+ /// RoleId
/// </KeyProperties>
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="Role")]
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
@@ -304,39 +379,16 @@ namespace RelyingPartyLogic
/// <summary>
/// Create a new Role object.
/// </summary>
- /// <param name="id">Initial value of Id.</param>
/// <param name="name">Initial value of Name.</param>
- public static Role CreateRole(int id, string name)
+ /// <param name="roleId">Initial value of RoleId.</param>
+ public static Role CreateRole(string name, int roleId)
{
Role role = new Role();
- role.Id = id;
role.Name = name;
+ role.RoleId = roleId;
return role;
}
/// <summary>
- /// There are no comments for Property Id in the schema.
- /// </summary>
- [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
- [global::System.Runtime.Serialization.DataMemberAttribute()]
- public int Id
- {
- get
- {
- return this._Id;
- }
- private set
- {
- this.OnIdChanging(value);
- this.ReportPropertyChanging("Id");
- this._Id = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
- this.ReportPropertyChanged("Id");
- this.OnIdChanged();
- }
- }
- private int _Id;
- partial void OnIdChanging(int value);
- partial void OnIdChanged();
- /// <summary>
/// There are no comments for Property Name in the schema.
/// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
@@ -360,6 +412,29 @@ namespace RelyingPartyLogic
partial void OnNameChanging(string value);
partial void OnNameChanged();
/// <summary>
+ /// There are no comments for Property RoleId in the schema.
+ /// </summary>
+ [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
+ [global::System.Runtime.Serialization.DataMemberAttribute()]
+ public int RoleId
+ {
+ get
+ {
+ return this._RoleId;
+ }
+ private set
+ {
+ this.OnRoleIdChanging(value);
+ this.ReportPropertyChanging("RoleId");
+ this._RoleId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+ this.ReportPropertyChanged("RoleId");
+ this.OnRoleIdChanged();
+ }
+ }
+ private int _RoleId;
+ partial void OnRoleIdChanging(int value);
+ partial void OnRoleIdChanged();
+ /// <summary>
/// There are no comments for Users in the schema.
/// </summary>
[global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "UserRole", "User")]
@@ -385,7 +460,7 @@ namespace RelyingPartyLogic
/// There are no comments for DatabaseModel.User in the schema.
/// </summary>
/// <KeyProperties>
- /// Id
+ /// UserId
/// </KeyProperties>
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="User")]
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
@@ -395,39 +470,18 @@ namespace RelyingPartyLogic
/// <summary>
/// Create a new User object.
/// </summary>
- /// <param name="id">Initial value of Id.</param>
/// <param name="emailAddressVerified">Initial value of EmailAddressVerified.</param>
- public static User CreateUser(int id, bool emailAddressVerified)
+ /// <param name="createdOnUtc">Initial value of CreatedOnUtc.</param>
+ /// <param name="userId">Initial value of UserId.</param>
+ public static User CreateUser(bool emailAddressVerified, global::System.DateTime createdOnUtc, int userId)
{
User user = new User();
- user.Id = id;
user.EmailAddressVerified = emailAddressVerified;
+ user.CreatedOnUtc = createdOnUtc;
+ user.UserId = userId;
return user;
}
/// <summary>
- /// There are no comments for Property Id in the schema.
- /// </summary>
- [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
- [global::System.Runtime.Serialization.DataMemberAttribute()]
- public int Id
- {
- get
- {
- return this._Id;
- }
- private set
- {
- this.OnIdChanging(value);
- this.ReportPropertyChanging("Id");
- this._Id = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
- this.ReportPropertyChanged("Id");
- this.OnIdChanged();
- }
- }
- private int _Id;
- partial void OnIdChanging(int value);
- partial void OnIdChanged();
- /// <summary>
/// There are no comments for Property FirstName in the schema.
/// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
@@ -520,6 +574,52 @@ namespace RelyingPartyLogic
partial void OnEmailAddressVerifiedChanging(bool value);
partial void OnEmailAddressVerifiedChanged();
/// <summary>
+ /// There are no comments for Property CreatedOnUtc in the schema.
+ /// </summary>
+ [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
+ [global::System.Runtime.Serialization.DataMemberAttribute()]
+ public global::System.DateTime CreatedOnUtc
+ {
+ get
+ {
+ return this._CreatedOnUtc;
+ }
+ private set
+ {
+ this.OnCreatedOnUtcChanging(value);
+ this.ReportPropertyChanging("CreatedOnUtc");
+ this._CreatedOnUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+ this.ReportPropertyChanged("CreatedOnUtc");
+ this.OnCreatedOnUtcChanged();
+ }
+ }
+ private global::System.DateTime _CreatedOnUtc;
+ partial void OnCreatedOnUtcChanging(global::System.DateTime value);
+ partial void OnCreatedOnUtcChanged();
+ /// <summary>
+ /// There are no comments for Property UserId in the schema.
+ /// </summary>
+ [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
+ [global::System.Runtime.Serialization.DataMemberAttribute()]
+ public int UserId
+ {
+ get
+ {
+ return this._UserId;
+ }
+ private set
+ {
+ this.OnUserIdChanging(value);
+ this.ReportPropertyChanging("UserId");
+ this._UserId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+ this.ReportPropertyChanged("UserId");
+ this.OnUserIdChanged();
+ }
+ }
+ private int _UserId;
+ partial void OnUserIdChanging(int value);
+ partial void OnUserIdChanged();
+ /// <summary>
/// There are no comments for Roles in the schema.
/// </summary>
[global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "UserRole", "Role")]
@@ -543,7 +643,7 @@ namespace RelyingPartyLogic
/// <summary>
/// There are no comments for AuthenticationTokens in the schema.
/// </summary>
- [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "UserAuthenticationToken", "AuthenticationToken")]
+ [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_AuthenticationToken_User", "AuthenticationToken")]
[global::System.Xml.Serialization.XmlIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()]
@@ -551,34 +651,34 @@ namespace RelyingPartyLogic
{
get
{
- return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<AuthenticationToken>("DatabaseModel.UserAuthenticationToken", "AuthenticationToken");
+ return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<AuthenticationToken>("DatabaseModel.FK_AuthenticationToken_User", "AuthenticationToken");
}
set
{
if ((value != null))
{
- ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<AuthenticationToken>("DatabaseModel.UserAuthenticationToken", "AuthenticationToken", value);
+ ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<AuthenticationToken>("DatabaseModel.FK_AuthenticationToken_User", "AuthenticationToken", value);
}
}
}
/// <summary>
- /// There are no comments for IssuedToken in the schema.
+ /// There are no comments for IssuedTokens in the schema.
/// </summary>
- [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_User", "IssuedTokens")]
+ [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_User1", "IssuedToken")]
[global::System.Xml.Serialization.XmlIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()]
- public global::System.Data.Objects.DataClasses.EntityCollection<IssuedToken> IssuedToken
+ public global::System.Data.Objects.DataClasses.EntityCollection<IssuedToken> IssuedTokens
{
get
{
- return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_User", "IssuedTokens");
+ return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_User1", "IssuedToken");
}
set
{
if ((value != null))
{
- ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_User", "IssuedTokens", value);
+ ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_User1", "IssuedToken", value);
}
}
}
@@ -757,7 +857,7 @@ namespace RelyingPartyLogic
{
return this._ConsumerId;
}
- set
+ private set
{
this.OnConsumerIdChanging(value);
this.ReportPropertyChanging("ConsumerId");
@@ -793,23 +893,23 @@ namespace RelyingPartyLogic
partial void OnNameChanging(string value);
partial void OnNameChanged();
/// <summary>
- /// There are no comments for IssuedToken in the schema.
+ /// There are no comments for IssuedTokens in the schema.
/// </summary>
- [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_Consumer", "IssuedTokens")]
+ [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_Consumer1", "IssuedToken")]
[global::System.Xml.Serialization.XmlIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()]
- public global::System.Data.Objects.DataClasses.EntityCollection<IssuedToken> IssuedToken
+ public global::System.Data.Objects.DataClasses.EntityCollection<IssuedToken> IssuedTokens
{
get
{
- return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_Consumer", "IssuedTokens");
+ 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_Consumer", "IssuedTokens", value);
+ ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<IssuedToken>("DatabaseModel.FK_IssuedToken_Consumer1", "IssuedToken", value);
}
}
}
@@ -818,7 +918,7 @@ namespace RelyingPartyLogic
/// There are no comments for DatabaseModel.IssuedToken in the schema.
/// </summary>
/// <KeyProperties>
- /// TokenId
+ /// IssuedTokenId
/// </KeyProperties>
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="IssuedToken")]
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
@@ -828,29 +928,6 @@ namespace RelyingPartyLogic
public abstract partial class IssuedToken : global::System.Data.Objects.DataClasses.EntityObject
{
/// <summary>
- /// There are no comments for Property TokenId in the schema.
- /// </summary>
- [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
- [global::System.Runtime.Serialization.DataMemberAttribute()]
- public int TokenId
- {
- get
- {
- return this._TokenId;
- }
- set
- {
- this.OnTokenIdChanging(value);
- this.ReportPropertyChanging("TokenId");
- this._TokenId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
- this.ReportPropertyChanged("TokenId");
- this.OnTokenIdChanged();
- }
- }
- private int _TokenId;
- partial void OnTokenIdChanging(int value);
- partial void OnTokenIdChanged();
- /// <summary>
/// There are no comments for Property Token in the schema.
/// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
@@ -897,28 +974,28 @@ namespace RelyingPartyLogic
partial void OnTokenSecretChanging(string value);
partial void OnTokenSecretChanged();
/// <summary>
- /// There are no comments for Property CreatedOn 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()]
- public global::System.DateTime CreatedOn
+ public global::System.DateTime CreatedOnUtc
{
get
{
- return this._CreatedOn;
+ return this._CreatedOnUtc;
}
- set
+ internal set
{
- this.OnCreatedOnChanging(value);
- this.ReportPropertyChanging("CreatedOn");
- this._CreatedOn = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
- this.ReportPropertyChanged("CreatedOn");
- this.OnCreatedOnChanged();
+ this.OnCreatedOnUtcChanging(value);
+ this.ReportPropertyChanging("CreatedOnUtc");
+ this._CreatedOnUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+ this.ReportPropertyChanged("CreatedOnUtc");
+ this.OnCreatedOnUtcChanged();
}
}
- private global::System.DateTime _CreatedOn;
- partial void OnCreatedOnChanging(global::System.DateTime value);
- partial void OnCreatedOnChanged();
+ private global::System.DateTime _CreatedOnUtc;
+ partial void OnCreatedOnUtcChanging(global::System.DateTime value);
+ partial void OnCreatedOnUtcChanged();
/// <summary>
/// There are no comments for Property Scope in the schema.
/// </summary>
@@ -943,9 +1020,32 @@ namespace RelyingPartyLogic
partial void OnScopeChanging(string value);
partial void OnScopeChanged();
/// <summary>
+ /// There are no comments for Property IssuedTokenId in the schema.
+ /// </summary>
+ [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
+ [global::System.Runtime.Serialization.DataMemberAttribute()]
+ public int IssuedTokenId
+ {
+ 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();
+ }
+ }
+ private int _IssuedTokenId;
+ partial void OnIssuedTokenIdChanging(int value);
+ partial void OnIssuedTokenIdChanged();
+ /// <summary>
/// There are no comments for Consumer in the schema.
/// </summary>
- [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_Consumer", "Consumer")]
+ [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_Consumer1", "Consumer")]
[global::System.Xml.Serialization.XmlIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()]
@@ -953,11 +1053,11 @@ namespace RelyingPartyLogic
{
get
{
- return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer", "Consumer").Value;
+ 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_Consumer", "Consumer").Value = value;
+ ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer1", "Consumer").Value = value;
}
}
/// <summary>
@@ -969,20 +1069,20 @@ namespace RelyingPartyLogic
{
get
{
- return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer", "Consumer");
+ return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer1", "Consumer");
}
set
{
if ((value != null))
{
- ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer", "Consumer", value);
+ ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Consumer>("DatabaseModel.FK_IssuedToken_Consumer1", "Consumer", value);
}
}
}
/// <summary>
/// There are no comments for User in the schema.
/// </summary>
- [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_User", "User")]
+ [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "FK_IssuedToken_User1", "User")]
[global::System.Xml.Serialization.XmlIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()]
@@ -990,11 +1090,11 @@ namespace RelyingPartyLogic
{
get
{
- return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_IssuedToken_User", "User").Value;
+ 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_User", "User").Value = value;
+ ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_IssuedToken_User1", "User").Value = value;
}
}
/// <summary>
@@ -1006,13 +1106,13 @@ namespace RelyingPartyLogic
{
get
{
- return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<User>("DatabaseModel.FK_IssuedToken_User", "User");
+ 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_User", "User", value);
+ ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<User>("DatabaseModel.FK_IssuedToken_User1", "User", value);
}
}
}
@@ -1021,7 +1121,7 @@ namespace RelyingPartyLogic
/// There are no comments for DatabaseModel.IssuedRequestToken in the schema.
/// </summary>
/// <KeyProperties>
- /// TokenId
+ /// IssuedTokenId
/// </KeyProperties>
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="IssuedRequestToken")]
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
@@ -1031,17 +1131,17 @@ namespace RelyingPartyLogic
/// <summary>
/// Create a new IssuedRequestToken object.
/// </summary>
- /// <param name="tokenId">Initial value of TokenId.</param>
/// <param name="token">Initial value of Token.</param>
/// <param name="tokenSecret">Initial value of TokenSecret.</param>
- /// <param name="createdOn">Initial value of CreatedOn.</param>
- public static IssuedRequestToken CreateIssuedRequestToken(int tokenId, string token, string tokenSecret, global::System.DateTime createdOn)
+ /// <param name="createdOnUtc">Initial value of CreatedOnUtc.</param>
+ /// <param name="issuedTokenId">Initial value of IssuedTokenId.</param>
+ public static IssuedRequestToken CreateIssuedRequestToken(string token, string tokenSecret, global::System.DateTime createdOnUtc, int issuedTokenId)
{
IssuedRequestToken issuedRequestToken = new IssuedRequestToken();
- issuedRequestToken.TokenId = tokenId;
issuedRequestToken.Token = token;
issuedRequestToken.TokenSecret = tokenSecret;
- issuedRequestToken.CreatedOn = createdOn;
+ issuedRequestToken.CreatedOnUtc = createdOnUtc;
+ issuedRequestToken.IssuedTokenId = issuedTokenId;
return issuedRequestToken;
}
/// <summary>
@@ -1118,7 +1218,7 @@ namespace RelyingPartyLogic
/// There are no comments for DatabaseModel.IssuedAccessToken in the schema.
/// </summary>
/// <KeyProperties>
- /// TokenId
+ /// IssuedTokenId
/// </KeyProperties>
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="IssuedAccessToken")]
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
@@ -1128,41 +1228,41 @@ namespace RelyingPartyLogic
/// <summary>
/// Create a new IssuedAccessToken object.
/// </summary>
- /// <param name="tokenId">Initial value of TokenId.</param>
/// <param name="token">Initial value of Token.</param>
/// <param name="tokenSecret">Initial value of TokenSecret.</param>
- /// <param name="createdOn">Initial value of CreatedOn.</param>
- public static IssuedAccessToken CreateIssuedAccessToken(int tokenId, string token, string tokenSecret, global::System.DateTime createdOn)
+ /// <param name="createdOnUtc">Initial value of CreatedOnUtc.</param>
+ /// <param name="issuedTokenId">Initial value of IssuedTokenId.</param>
+ public static IssuedAccessToken CreateIssuedAccessToken(string token, string tokenSecret, global::System.DateTime createdOnUtc, int issuedTokenId)
{
IssuedAccessToken issuedAccessToken = new IssuedAccessToken();
- issuedAccessToken.TokenId = tokenId;
issuedAccessToken.Token = token;
issuedAccessToken.TokenSecret = tokenSecret;
- issuedAccessToken.CreatedOn = createdOn;
+ issuedAccessToken.CreatedOnUtc = createdOnUtc;
+ issuedAccessToken.IssuedTokenId = issuedTokenId;
return issuedAccessToken;
}
/// <summary>
- /// There are no comments for Property ExpirationDate in the schema.
+ /// There are no comments for Property ExpirationDateUtc in the schema.
/// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()]
- public global::System.Nullable<global::System.DateTime> ExpirationDate
+ public global::System.Nullable<global::System.DateTime> ExpirationDateUtc
{
get
{
- return this._ExpirationDate;
+ return this._ExpirationDateUtc;
}
set
{
- this.OnExpirationDateChanging(value);
- this.ReportPropertyChanging("ExpirationDate");
- this._ExpirationDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
- this.ReportPropertyChanged("ExpirationDate");
- this.OnExpirationDateChanged();
+ this.OnExpirationDateUtcChanging(value);
+ this.ReportPropertyChanging("ExpirationDateUtc");
+ this._ExpirationDateUtc = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
+ this.ReportPropertyChanged("ExpirationDateUtc");
+ this.OnExpirationDateUtcChanged();
}
}
- private global::System.Nullable<global::System.DateTime> _ExpirationDate;
- partial void OnExpirationDateChanging(global::System.Nullable<global::System.DateTime> value);
- partial void OnExpirationDateChanged();
+ private global::System.Nullable<global::System.DateTime> _ExpirationDateUtc;
+ partial void OnExpirationDateUtcChanging(global::System.Nullable<global::System.DateTime> value);
+ partial void OnExpirationDateUtcChanged();
}
}
diff --git a/projecttemplates/RelyingPartyLogic/Model.IssuedAccessToken.cs b/projecttemplates/RelyingPartyLogic/Model.IssuedAccessToken.cs
index fff27af..d966baf 100644
--- a/projecttemplates/RelyingPartyLogic/Model.IssuedAccessToken.cs
+++ b/projecttemplates/RelyingPartyLogic/Model.IssuedAccessToken.cs
@@ -54,5 +54,21 @@ namespace RelyingPartyLogic {
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 && value.Value.Kind != DateTimeKind.Utc) {
+ throw new ArgumentException("DateTime must be given in UTC time.");
+ }
+ }
}
}
diff --git a/projecttemplates/RelyingPartyLogic/Model.IssuedRequestToken.cs b/projecttemplates/RelyingPartyLogic/Model.IssuedRequestToken.cs
index c62f5c4..1e96eb7 100644
--- a/projecttemplates/RelyingPartyLogic/Model.IssuedRequestToken.cs
+++ b/projecttemplates/RelyingPartyLogic/Model.IssuedRequestToken.cs
@@ -43,6 +43,13 @@ namespace RelyingPartyLogic {
}
/// <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>
diff --git a/projecttemplates/RelyingPartyLogic/Model.IssuedToken.cs b/projecttemplates/RelyingPartyLogic/Model.IssuedToken.cs
new file mode 100644
index 0000000..aab1fc1
--- /dev/null
+++ b/projecttemplates/RelyingPartyLogic/Model.IssuedToken.cs
@@ -0,0 +1,28 @@
+//-----------------------------------------------------------------------
+// <copyright file="Model.IssuedToken.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 IssuedToken {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="IssuedToken"/> class.
+ /// </summary>
+ public IssuedToken() {
+ this.CreatedOnUtc = DateTime.UtcNow;
+ }
+
+ partial void OnCreatedOnUtcChanging(DateTime value) {
+ if (value.Kind != DateTimeKind.Utc) {
+ throw new ArgumentException("DateTime must be given in UTC time.");
+ }
+ }
+ }
+}
diff --git a/projecttemplates/RelyingPartyLogic/Model.User.cs b/projecttemplates/RelyingPartyLogic/Model.User.cs
index 16980e2..51fd38b 100644
--- a/projecttemplates/RelyingPartyLogic/Model.User.cs
+++ b/projecttemplates/RelyingPartyLogic/Model.User.cs
@@ -11,6 +11,19 @@ namespace RelyingPartyLogic {
using System.Web;
public partial class User {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="User"/> class.
+ /// </summary>
+ public User() {
+ this.CreatedOnUtc = DateTime.UtcNow;
+ }
+
+ partial void OnCreatedOnUtcChanging(DateTime value) {
+ if (value.Kind != DateTimeKind.Utc) {
+ throw new ArgumentException("DateTime must be given in UTC time.");
+ }
+ }
+
partial void OnEmailAddressChanged() {
// Whenever the email address is changed, we must reset its verified status.
this.EmailAddressVerified = false;
diff --git a/projecttemplates/RelyingPartyLogic/Model.edmx b/projecttemplates/RelyingPartyLogic/Model.edmx
index f37aa6c..21fa98a 100644
--- a/projecttemplates/RelyingPartyLogic/Model.edmx
+++ b/projecttemplates/RelyingPartyLogic/Model.edmx
@@ -35,12 +35,15 @@
</EntityContainer>
<EntityType Name="AuthenticationToken">
<Key>
- <PropertyRef Name="Id" />
+ <PropertyRef Name="AuthenticationTokenId" />
</Key>
- <Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
+ <Property Name="AuthenticationTokenId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="UserId" Type="int" Nullable="false" />
<Property Name="OpenIdClaimedIdentifier" Type="nvarchar" Nullable="false" MaxLength="250" />
<Property Name="OpenIdFriendlyIdentifier" Type="nvarchar" MaxLength="250" />
+ <Property Name="CreatedOn" Type="datetime" Nullable="false" />
+ <Property Name="LastUsed" Type="datetime" Nullable="false" />
+ <Property Name="UsageCount" Type="int" Nullable="false" />
</EntityType>
<EntityType Name="Consumer">
<Key>
@@ -57,9 +60,9 @@
</EntityType>
<EntityType Name="IssuedToken">
<Key>
- <PropertyRef Name="TokenId" />
+ <PropertyRef Name="IssuedTokenId" />
</Key>
- <Property Name="TokenId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
+ <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" />
@@ -74,20 +77,21 @@
</EntityType>
<EntityType Name="Role">
<Key>
- <PropertyRef Name="Id" />
+ <PropertyRef Name="RoleId" />
</Key>
- <Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
+ <Property Name="RoleId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="nvarchar" Nullable="false" MaxLength="50" />
</EntityType>
<EntityType Name="User">
<Key>
- <PropertyRef Name="Id" />
+ <PropertyRef Name="UserId" />
</Key>
- <Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
+ <Property Name="UserId" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="FirstName" Type="nvarchar" MaxLength="50" />
<Property Name="LastName" Type="nvarchar" MaxLength="50" />
<Property Name="EmailAddress" Type="nvarchar" MaxLength="100" />
<Property Name="EmailAddressVerified" Type="bit" Nullable="false" />
+ <Property Name="CreatedOn" Type="datetime" Nullable="false" />
</EntityType>
<EntityType Name="UserRole">
<Key>
@@ -104,7 +108,7 @@
<End Role="AuthenticationToken" Type="DatabaseModel.Store.AuthenticationToken" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="User">
- <PropertyRef Name="Id" />
+ <PropertyRef Name="UserId" />
</Principal>
<Dependent Role="AuthenticationToken">
<PropertyRef Name="UserId" />
@@ -132,7 +136,7 @@
<End Role="IssuedToken" Type="DatabaseModel.Store.IssuedToken" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="User">
- <PropertyRef Name="Id" />
+ <PropertyRef Name="UserId" />
</Principal>
<Dependent Role="IssuedToken">
<PropertyRef Name="UserId" />
@@ -146,7 +150,7 @@
<End Role="UserRole" Type="DatabaseModel.Store.UserRole" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Role">
- <PropertyRef Name="Id" />
+ <PropertyRef Name="RoleId" />
</Principal>
<Dependent Role="UserRole">
<PropertyRef Name="RoleId" />
@@ -160,7 +164,7 @@
<End Role="UserRole" Type="DatabaseModel.Store.UserRole" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="User">
- <PropertyRef Name="Id" />
+ <PropertyRef Name="UserId" />
</Principal>
<Dependent Role="UserRole">
<PropertyRef Name="UserId" />
@@ -179,56 +183,53 @@
<End Role="User" EntitySet="User" />
</AssociationSet>
<EntitySet Name="AuthenticationToken" EntityType="DatabaseModel.AuthenticationToken" />
- <AssociationSet Name="UserAuthenticationToken" Association="DatabaseModel.UserAuthenticationToken">
- <End Role="User" EntitySet="User" />
- <End Role="AuthenticationToken" EntitySet="AuthenticationToken" /></AssociationSet>
<EntitySet Name="Consumer" EntityType="DatabaseModel.Consumer" />
<EntitySet Name="IssuedToken" EntityType="DatabaseModel.IssuedToken" />
- <AssociationSet Name="FK_IssuedToken_Consumer" Association="DatabaseModel.FK_IssuedToken_Consumer">
+ <AssociationSet Name="FK_AuthenticationToken_User" Association="DatabaseModel.FK_AuthenticationToken_User">
+ <End Role="User" EntitySet="User" />
+ <End Role="AuthenticationToken" EntitySet="AuthenticationToken" /></AssociationSet>
+ <AssociationSet Name="FK_IssuedToken_Consumer1" Association="DatabaseModel.FK_IssuedToken_Consumer1">
<End Role="Consumer" EntitySet="Consumer" />
- <End Role="IssuedTokens" EntitySet="IssuedToken" /></AssociationSet>
- <AssociationSet Name="FK_IssuedToken_User" Association="DatabaseModel.FK_IssuedToken_User">
+ <End Role="IssuedToken" EntitySet="IssuedToken" /></AssociationSet>
+ <AssociationSet Name="FK_IssuedToken_User1" Association="DatabaseModel.FK_IssuedToken_User1">
<End Role="User" EntitySet="User" />
- <End Role="IssuedTokens" EntitySet="IssuedToken" /></AssociationSet>
- </EntityContainer>
+ <End Role="IssuedToken" EntitySet="IssuedToken" /></AssociationSet></EntityContainer>
<EntityType Name="AuthenticationToken" Abstract="false">
<Key>
- <PropertyRef Name="Id" /></Key>
- <Property Name="Id" Type="Int32" Nullable="false" a:SetterAccess="Public" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" />
- <NavigationProperty Name="User" Relationship="DatabaseModel.UserAuthenticationToken" FromRole="AuthenticationToken" ToRole="User" />
+ <PropertyRef Name="AuthenticationTokenId" /></Key>
<Property Name="ClaimedIdentifier" Type="String" Nullable="false" />
- <Property Name="FriendlyIdentifier" Type="String" Nullable="true" /></EntityType>
+ <Property Name="FriendlyIdentifier" Type="String" Nullable="true" />
+ <Property Name="CreatedOnUtc" Type="DateTime" Nullable="false" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" />
+ <Property Name="LastUsedUtc" Type="DateTime" Nullable="false" />
+ <Property Name="UsageCount" Type="Int32" Nullable="false" />
+ <Property Name="AuthenticationTokenId" Type="Int32" Nullable="false" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" />
+ <NavigationProperty Name="User" Relationship="DatabaseModel.FK_AuthenticationToken_User" FromRole="AuthenticationToken" ToRole="User" /></EntityType>
<EntityType Name="Role">
<Key>
- <PropertyRef Name="Id" />
- </Key>
- <Property Name="Id" Type="Int32" Nullable="false" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" />
+ <PropertyRef Name="RoleId" /></Key>
<Property Name="Name" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
<NavigationProperty Name="Users" Relationship="DatabaseModel.UserRole" FromRole="Role" ToRole="User" />
- </EntityType>
+ <Property Name="RoleId" Type="Int32" Nullable="false" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" /></EntityType>
<EntityType Name="User">
<Key>
- <PropertyRef Name="Id" />
- </Key>
- <Property Name="Id" Type="Int32" Nullable="false" a:SetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" />
+ <PropertyRef Name="UserId" /></Key>
<Property Name="FirstName" Type="String" MaxLength="50" Unicode="true" FixedLength="false" />
<Property Name="LastName" Type="String" MaxLength="50" Unicode="true" FixedLength="false" />
<Property Name="EmailAddress" Type="String" MaxLength="100" Unicode="true" FixedLength="false" >
<Documentation>
<Summary>The email address claimed to be controlled by the user. Whether it is actually owned by the user is indicated by the EmailAddressVerified property.</Summary></Documentation></Property>
<NavigationProperty Name="Roles" Relationship="DatabaseModel.UserRole" FromRole="User" ToRole="Role" />
- <NavigationProperty Name="AuthenticationTokens" Relationship="DatabaseModel.UserAuthenticationToken" FromRole="User" ToRole="AuthenticationToken" />
<Property Name="EmailAddressVerified" Type="Boolean" Nullable="false" >
<Documentation>
<Summary>A value indicating whether the email address has been verified as actually owned by this user.</Summary></Documentation></Property>
- <NavigationProperty Name="IssuedToken" Relationship="DatabaseModel.FK_IssuedToken_User" FromRole="User" ToRole="IssuedTokens" /></EntityType>
+ <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>
<Association Name="UserRole">
<End Role="Role" Type="DatabaseModel.Role" Multiplicity="*" />
<End Role="User" Type="DatabaseModel.User" Multiplicity="*" />
</Association>
- <Association Name="UserAuthenticationToken">
- <End Type="DatabaseModel.User" Role="User" Multiplicity="1" />
- <End Type="DatabaseModel.AuthenticationToken" Role="AuthenticationToken" Multiplicity="*" /></Association>
<EntityType Name="Consumer">
<Key>
<PropertyRef Name="ConsumerId" /></Key>
@@ -238,31 +239,34 @@
<Property Name="CallbackAsString" Type="String" Nullable="true" />
<Property Name="VerificationCodeFormatAsInt" Type="Int32" Nullable="false" a:GetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" a:SetterAccess="Private" />
<Property Name="VerificationCodeLength" Type="Int32" Nullable="false" />
- <Property Name="ConsumerId" Type="Int32" Nullable="false" />
- <NavigationProperty Name="IssuedToken" Relationship="DatabaseModel.FK_IssuedToken_Consumer" FromRole="Consumer" ToRole="IssuedTokens" />
- <Property Name="Name" Type="String" Nullable="true" /></EntityType>
+ <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="TokenId" /></Key>
- <Property Name="TokenId" Type="Int32" Nullable="false" />
+ <PropertyRef Name="IssuedTokenId" /></Key>
<Property Name="Token" Type="String" Nullable="false" />
<Property Name="TokenSecret" Type="String" Nullable="false" />
- <Property Name="CreatedOn" Type="DateTime" Nullable="false" />
- <NavigationProperty Name="Consumer" Relationship="DatabaseModel.FK_IssuedToken_Consumer" FromRole="IssuedTokens" ToRole="Consumer" />
- <NavigationProperty Name="User" Relationship="DatabaseModel.FK_IssuedToken_User" FromRole="IssuedTokens" ToRole="User" />
- <Property Name="Scope" Type="String" Nullable="true" /></EntityType>
- <Association Name="FK_IssuedToken_Consumer">
- <End Type="DatabaseModel.Consumer" Role="Consumer" Multiplicity="1" />
- <End Type="DatabaseModel.IssuedToken" Role="IssuedTokens" Multiplicity="*" /></Association>
- <Association Name="FK_IssuedToken_User">
- <End Type="DatabaseModel.User" Role="User" Multiplicity="0..1" />
- <End Type="DatabaseModel.IssuedToken" Role="IssuedTokens" Multiplicity="*" /></Association>
+ <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" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" a:SetterAccess="Private" />
<Property Name="VerificationCode" Type="String" Nullable="true" />
<Property Name="CallbackAsString" Type="String" Nullable="true" a:GetterAccess="Private" xmlns:a="http://schemas.microsoft.com/ado/2006/04/codegeneration" a:SetterAccess="Private" /></EntityType>
<EntityType Name="IssuedAccessToken" BaseType="DatabaseModel.IssuedToken">
- <Property Name="ExpirationDate" Type="DateTime" Nullable="true" /></EntityType></Schema>
+ <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></Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
@@ -271,7 +275,7 @@
<EntitySetMapping Name="Role">
<EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.Role)">
<MappingFragment StoreEntitySet="Role">
- <ScalarProperty Name="Id" ColumnName="Id" />
+ <ScalarProperty Name="RoleId" ColumnName="RoleId" />
<ScalarProperty Name="Name" ColumnName="Name" />
</MappingFragment>
</EntityTypeMapping>
@@ -279,8 +283,9 @@
<EntitySetMapping Name="User">
<EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.User)">
<MappingFragment StoreEntitySet="User">
+ <ScalarProperty Name="UserId" ColumnName="UserId" />
+ <ScalarProperty Name="CreatedOnUtc" ColumnName="CreatedOn" />
<ScalarProperty Name="EmailAddressVerified" ColumnName="EmailAddressVerified" />
- <ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="FirstName" ColumnName="FirstName" />
<ScalarProperty Name="LastName" ColumnName="LastName" />
<ScalarProperty Name="EmailAddress" ColumnName="EmailAddress" />
@@ -288,26 +293,22 @@
</EntityTypeMapping>
</EntitySetMapping>
<AssociationSetMapping Name="UserRole" TypeName="DatabaseModel.UserRole" StoreEntitySet="UserRole">
- <EndProperty Name="Role">
- <ScalarProperty Name="Id" ColumnName="RoleId" />
- </EndProperty>
<EndProperty Name="User">
- <ScalarProperty Name="Id" ColumnName="UserId" />
- </EndProperty>
+ <ScalarProperty Name="UserId" ColumnName="UserId" /></EndProperty>
+ <EndProperty Name="Role">
+ <ScalarProperty Name="RoleId" ColumnName="RoleId" /></EndProperty>
</AssociationSetMapping>
<EntitySetMapping Name="AuthenticationToken"><EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.AuthenticationToken)">
<MappingFragment StoreEntitySet="AuthenticationToken">
+ <ScalarProperty Name="AuthenticationTokenId" ColumnName="AuthenticationTokenId" />
+ <ScalarProperty Name="UsageCount" ColumnName="UsageCount" />
+ <ScalarProperty Name="LastUsedUtc" ColumnName="LastUsed" />
+ <ScalarProperty Name="CreatedOnUtc" ColumnName="CreatedOn" />
<ScalarProperty Name="FriendlyIdentifier" ColumnName="OpenIdFriendlyIdentifier" />
<ScalarProperty Name="ClaimedIdentifier" ColumnName="OpenIdClaimedIdentifier" />
- <ScalarProperty Name="Id" ColumnName="Id" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
- <AssociationSetMapping Name="UserAuthenticationToken" TypeName="DatabaseModel.UserAuthenticationToken" StoreEntitySet="AuthenticationToken">
- <EndProperty Name="AuthenticationToken">
- <ScalarProperty Name="Id" ColumnName="Id" /></EndProperty>
- <EndProperty Name="User">
- <ScalarProperty Name="Id" ColumnName="UserId" /></EndProperty></AssociationSetMapping>
<EntitySetMapping Name="Consumer">
<EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.Consumer)">
<MappingFragment StoreEntitySet="Consumer">
@@ -322,33 +323,39 @@
<EntitySetMapping Name="IssuedToken">
<EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.IssuedToken)">
<MappingFragment StoreEntitySet="IssuedToken">
+ <ScalarProperty Name="IssuedTokenId" ColumnName="IssuedTokenId" />
<ScalarProperty Name="Scope" ColumnName="Scope" />
- <ScalarProperty Name="CreatedOn" ColumnName="CreatedOn" />
+ <ScalarProperty Name="CreatedOnUtc" ColumnName="CreatedOn" />
<ScalarProperty Name="TokenSecret" ColumnName="TokenSecret" />
<ScalarProperty Name="Token" ColumnName="Token" />
- <ScalarProperty Name="TokenId" ColumnName="TokenId" /></MappingFragment></EntityTypeMapping>
+ </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" />
- <ScalarProperty Name="TokenId" ColumnName="TokenId" />
<Condition ColumnName="IsAccessToken" Value="0" /></MappingFragment></EntityTypeMapping>
<EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.IssuedAccessToken)">
<MappingFragment StoreEntitySet="IssuedToken" >
- <ScalarProperty Name="ExpirationDate" ColumnName="ExpirationDate" />
- <ScalarProperty Name="TokenId" ColumnName="TokenId" />
+ <ScalarProperty Name="IssuedTokenId" ColumnName="IssuedTokenId" />
+ <ScalarProperty Name="ExpirationDateUtc" ColumnName="ExpirationDate" />
<Condition ColumnName="IsAccessToken" Value="1" /></MappingFragment></EntityTypeMapping></EntitySetMapping>
- <AssociationSetMapping Name="FK_IssuedToken_Consumer" TypeName="DatabaseModel.FK_IssuedToken_Consumer" StoreEntitySet="IssuedToken">
- <EndProperty Name="IssuedTokens">
- <ScalarProperty Name="TokenId" ColumnName="TokenId" /></EndProperty>
+ <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_User" TypeName="DatabaseModel.FK_IssuedToken_User" StoreEntitySet="IssuedToken">
- <EndProperty Name="IssuedTokens">
- <ScalarProperty Name="TokenId" ColumnName="TokenId" /></EndProperty>
+ <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="Id" ColumnName="UserId" /></EndProperty>
+ <ScalarProperty Name="UserId" ColumnName="UserId" /></EndProperty>
<Condition ColumnName="UserId" IsNull="false" /></AssociationSetMapping></EntityContainerMapping>
</Mapping>
</edmx:Mappings>
@@ -367,38 +374,38 @@
</edmx:Options>
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
- <Diagram Name="Model">
- <EntityTypeShape EntityType="DatabaseModel.AuthenticationToken" Width="1.875" PointX="5.25" PointY="1.125" Height="1.4033821614583335" IsExpanded="true" />
- <EntityTypeShape EntityType="DatabaseModel.Role" Width="1.5" PointX="0.75" PointY="1.25" Height="1.5956835937500002" IsExpanded="true" />
- <EntityTypeShape EntityType="DatabaseModel.User" Width="1.75" PointX="2.875" PointY="0.875" Height="2.3648893229166661" IsExpanded="true" />
+ <Diagram Name="Model" ZoomLevel="86">
+ <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" />
<AssociationConnector Association="DatabaseModel.UserRole" ManuallyRouted="false">
- <ConnectorPoint PointX="2.25" PointY="2.0478417968750002" />
- <ConnectorPoint PointX="2.875" PointY="2.0478417968750002" /></AssociationConnector>
+ <ConnectorPoint PointX="2.25" PointY="2.047841796875" />
+ <ConnectorPoint PointX="2.875" PointY="2.047841796875" /></AssociationConnector>
<InheritanceConnector EntityType="DatabaseModel.AuthenticationToken">
<ConnectorPoint PointX="6.5625" PointY="3.375" />
<ConnectorPoint PointX="6.5625" PointY="2.9129850260416665" /></InheritanceConnector>
- <AssociationConnector Association="DatabaseModel.UserAuthenticationToken">
- <ConnectorPoint PointX="4.625" PointY="2.0189925130208337" />
- <ConnectorPoint PointX="5.25" PointY="2.0189925130208337" /></AssociationConnector>
<EntityTypeShape EntityType="DatabaseModel.Consumer" Width="2.125" PointX="0.5" PointY="3.625" Height="2.1725878906249996" />
- <EntityTypeShape EntityType="DatabaseModel.IssuedToken" Width="2" PointX="4.5" PointY="3.625" Height="2.1725878906249996" />
- <AssociationConnector Association="DatabaseModel.FK_IssuedToken_Consumer" ManuallyRouted="false" >
- <ConnectorPoint PointX="2.625" PointY="5.359375" />
- <ConnectorPoint PointX="4.5" PointY="5.359375" />
- </AssociationConnector>
- <AssociationConnector Association="DatabaseModel.FK_IssuedToken_User" >
- <ConnectorPoint PointX="3.6874995" PointY="3.4321907552083331" />
- <ConnectorPoint PointX="3.6874995" PointY="4.005208333333333" />
- <ConnectorPoint PointX="4.5" PointY="4.005208333333333" />
+ <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>
- <EntityTypeShape EntityType="DatabaseModel.IssuedRequestToken" Width="2" PointX="4.25" PointY="6.25" Height="1.5956835937499996" />
- <EntityTypeShape EntityType="DatabaseModel.IssuedAccessToken" Width="1.625" PointX="6.5" PointY="6.25" Height="1.2110807291666657" />
- <InheritanceConnector EntityType="DatabaseModel.IssuedRequestToken">
- <ConnectorPoint PointX="5.375" PointY="5.797587890625" />
- <ConnectorPoint PointX="5.375" PointY="6.25" /></InheritanceConnector>
- <InheritanceConnector EntityType="DatabaseModel.IssuedAccessToken">
- <ConnectorPoint PointX="6.5" PointY="4.7112939453125" />
- <ConnectorPoint PointX="7.34375" PointY="4.7112939453125" />
- <ConnectorPoint PointX="7.34375" PointY="6.25" /></InheritanceConnector></Diagram></edmx:Diagrams>
+ <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></Diagram></edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx> \ No newline at end of file
diff --git a/projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs b/projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs
index fbba776..894fbf3 100644
--- a/projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs
+++ b/projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs
@@ -67,7 +67,6 @@ namespace RelyingPartyLogic {
var token = new IssuedRequestToken {
Callback = request.Callback,
Consumer = consumer,
- CreatedOn = DateTime.Now,
Token = response.Token,
TokenSecret = response.TokenSecret,
};
@@ -110,8 +109,7 @@ namespace RelyingPartyLogic {
var accessTokenEntity = new IssuedAccessToken {
Token = accessToken,
TokenSecret = accessTokenSecret,
- ExpirationDate = null, // currently, our access tokens don't expire
- CreatedOn = DateTime.Now,
+ ExpirationDateUtc = null, // currently, our access tokens don't expire
User = requestTokenEntity.User,
Scope = requestTokenEntity.Scope,
Consumer = requestTokenEntity.Consumer,
diff --git a/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj b/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj
index 7000e2b..1e7e759 100644
--- a/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj
+++ b/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj
@@ -82,6 +82,7 @@
<Reference Include="System.Web.Mobile" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Model.IssuedToken.cs" />
<Compile Include="Database.cs" />
<Compile Include="DataRoleProvider.cs" />
<Compile Include="Model.AuthenticationToken.cs" />
diff --git a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs
index aebf266..0857019 100644
--- a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs
+++ b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs
@@ -91,6 +91,9 @@
}
Database.DataContext.AddToUser(user);
+ } else {
+ openidToken.UsageCount++;
+ openidToken.LastUsedUtc = DateTime.UtcNow;
}
bool persistentCookie = false;
diff --git a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs
index 21b15d2..f196a2c 100644
--- a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs
+++ b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs
@@ -20,16 +20,16 @@ namespace WebFormsRelyingParty.Members {
Database.LoggedInUser.AuthenticationTokens.Load();
this.Repeater1.DataSource = Database.LoggedInUser.AuthenticationTokens;
- if (!Database.LoggedInUser.IssuedToken.IsLoaded) {
- Database.LoggedInUser.IssuedToken.Load();
+ if (!Database.LoggedInUser.IssuedTokens.IsLoaded) {
+ Database.LoggedInUser.IssuedTokens.Load();
}
- this.tokenListRepeater.DataSource = Database.LoggedInUser.IssuedToken;
- foreach (var token in Database.LoggedInUser.IssuedToken) {
+ this.tokenListRepeater.DataSource = Database.LoggedInUser.IssuedTokens;
+ foreach (var token in Database.LoggedInUser.IssuedTokens) {
if (!token.ConsumerReference.IsLoaded) {
token.ConsumerReference.Load();
}
}
- this.authorizedClientsPanel.Visible = Database.LoggedInUser.IssuedToken.Count > 0;
+ this.authorizedClientsPanel.Visible = Database.LoggedInUser.IssuedTokens.Count > 0;
if (!IsPostBack) {
this.Repeater1.DataBind();
@@ -49,7 +49,7 @@ namespace WebFormsRelyingParty.Members {
protected void deleteOpenId_Command(object sender, CommandEventArgs e) {
string claimedId = (string)e.CommandArgument;
- var token = Database.DataContext.AuthenticationToken.First(t => t.ClaimedIdentifier == claimedId && t.User.Id == Database.LoggedInUser.Id);
+ var token = Database.DataContext.AuthenticationToken.First(t => t.ClaimedIdentifier == claimedId && t.User.UserId == Database.LoggedInUser.UserId);
Database.DataContext.DeleteObject(token);
Database.DataContext.SaveChanges();
this.Repeater1.DataBind();
@@ -72,13 +72,13 @@ namespace WebFormsRelyingParty.Members {
protected void revokeToken_Command(object sender, CommandEventArgs e) {
string token = (string)e.CommandArgument;
- var tokenToRevoke = Database.DataContext.IssuedToken.FirstOrDefault(t => t.Token == token && t.User.Id == Database.LoggedInUser.Id);
+ var tokenToRevoke = Database.DataContext.IssuedToken.FirstOrDefault(t => t.Token == token && t.User.UserId == Database.LoggedInUser.UserId);
if (tokenToRevoke != null) {
Database.DataContext.DeleteObject(tokenToRevoke);
}
this.tokenListRepeater.DataBind();
- this.noAuthorizedClientsPanel.Visible = Database.LoggedInUser.IssuedToken.Count == 0;
+ this.noAuthorizedClientsPanel.Visible = Database.LoggedInUser.IssuedTokens.Count == 0;
}
private void AddIdentifier(string claimedId, string friendlyId) {