summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--projecttemplates/RelyingPartyLogic/DataRoleProvider.cs24
-rw-r--r--projecttemplates/RelyingPartyLogic/Database.cs2
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.Designer.cs92
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.edmx38
-rw-r--r--projecttemplates/RelyingPartyLogic/OAuthAuthorizationManager.cs2
-rw-r--r--projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs4
-rw-r--r--projecttemplates/RelyingPartyLogic/OAuthServiceProviderTokenManager.cs8
-rw-r--r--projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs12
-rw-r--r--projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs2
-rw-r--r--projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs4
-rw-r--r--projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs6
11 files changed, 97 insertions, 97 deletions
diff --git a/projecttemplates/RelyingPartyLogic/DataRoleProvider.cs b/projecttemplates/RelyingPartyLogic/DataRoleProvider.cs
index 1171646..3501fc8 100644
--- a/projecttemplates/RelyingPartyLogic/DataRoleProvider.cs
+++ b/projecttemplates/RelyingPartyLogic/DataRoleProvider.cs
@@ -18,10 +18,10 @@ namespace RelyingPartyLogic {
}
public override void AddUsersToRoles(string[] usernames, string[] roleNames) {
- var users = from token in Database.DataContext.AuthenticationToken
+ var users = from token in Database.DataContext.AuthenticationTokens
where usernames.Contains(token.ClaimedIdentifier)
select token.User;
- var roles = from role in Database.DataContext.Role
+ var roles = from role in Database.DataContext.Roles
where roleNames.Contains(role.Name, StringComparer.OrdinalIgnoreCase)
select role;
foreach (User user in users) {
@@ -32,10 +32,10 @@ namespace RelyingPartyLogic {
}
public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames) {
- var users = from token in Database.DataContext.AuthenticationToken
+ var users = from token in Database.DataContext.AuthenticationTokens
where usernames.Contains(token.ClaimedIdentifier)
select token.User;
- var roles = from role in Database.DataContext.Role
+ var roles = from role in Database.DataContext.Roles
where roleNames.Contains(role.Name, StringComparer.OrdinalIgnoreCase)
select role;
foreach (User user in users) {
@@ -46,7 +46,7 @@ namespace RelyingPartyLogic {
}
public override void CreateRole(string roleName) {
- Database.DataContext.AddToRole(new Role { Name = roleName });
+ Database.DataContext.AddToRoles(new Role { Name = roleName });
}
/// <summary>
@@ -58,7 +58,7 @@ namespace RelyingPartyLogic {
/// true if the role was successfully deleted; otherwise, false.
/// </returns>
public override bool DeleteRole(string roleName, bool throwOnPopulatedRole) {
- Role role = Database.DataContext.Role.SingleOrDefault(r => r.Name == roleName);
+ Role role = Database.DataContext.Roles.SingleOrDefault(r => r.Name == roleName);
if (role == null) {
return false;
}
@@ -80,7 +80,7 @@ namespace RelyingPartyLogic {
/// A string array containing the names of all the users where the user name matches <paramref name="usernameToMatch"/> and the user is a member of the specified role.
/// </returns>
public override string[] FindUsersInRole(string roleName, string usernameToMatch) {
- return (from role in Database.DataContext.Role
+ return (from role in Database.DataContext.Roles
where role.Name == roleName
from user in role.Users
from authTokens in user.AuthenticationTokens
@@ -89,18 +89,18 @@ namespace RelyingPartyLogic {
}
public override string[] GetAllRoles() {
- return Database.DataContext.Role.Select(role => role.Name).ToArray();
+ return Database.DataContext.Roles.Select(role => role.Name).ToArray();
}
public override string[] GetRolesForUser(string username) {
- return (from authToken in Database.DataContext.AuthenticationToken
+ return (from authToken in Database.DataContext.AuthenticationTokens
where authToken.ClaimedIdentifier == username
from role in authToken.User.Roles
select role.Name).ToArray();
}
public override string[] GetUsersInRole(string roleName) {
- return (from role in Database.DataContext.Role
+ return (from role in Database.DataContext.Roles
where string.Equals(role.Name, roleName, StringComparison.OrdinalIgnoreCase)
from user in role.Users
from token in user.AuthenticationTokens
@@ -108,7 +108,7 @@ namespace RelyingPartyLogic {
}
public override bool IsUserInRole(string username, string roleName) {
- Role role = Database.DataContext.Role.SingleOrDefault(r => string.Equals(r.Name, roleName, StringComparison.OrdinalIgnoreCase));
+ Role role = Database.DataContext.Roles.SingleOrDefault(r => string.Equals(r.Name, roleName, StringComparison.OrdinalIgnoreCase));
if (role != null) {
return role.Users.Any(user => user.AuthenticationTokens.Any(token => token.ClaimedIdentifier == username));
}
@@ -117,7 +117,7 @@ namespace RelyingPartyLogic {
}
public override bool RoleExists(string roleName) {
- return Database.DataContext.Role.Any(role => string.Equals(role.Name, roleName, StringComparison.OrdinalIgnoreCase));
+ return Database.DataContext.Roles.Any(role => string.Equals(role.Name, roleName, StringComparison.OrdinalIgnoreCase));
}
}
}
diff --git a/projecttemplates/RelyingPartyLogic/Database.cs b/projecttemplates/RelyingPartyLogic/Database.cs
index a1e17a6..3dbb493 100644
--- a/projecttemplates/RelyingPartyLogic/Database.cs
+++ b/projecttemplates/RelyingPartyLogic/Database.cs
@@ -26,7 +26,7 @@ namespace RelyingPartyLogic {
}
public static User LoggedInUser {
- get { return DataContext.AuthenticationToken.Where(token => token.ClaimedIdentifier == HttpContext.Current.User.Identity.Name).Select(token => token.User).FirstOrDefault(); }
+ get { return DataContext.AuthenticationTokens.Where(token => token.ClaimedIdentifier == HttpContext.Current.User.Identity.Name).Select(token => token.User).FirstOrDefault(); }
}
/// <summary>
diff --git a/projecttemplates/RelyingPartyLogic/Model.Designer.cs b/projecttemplates/RelyingPartyLogic/Model.Designer.cs
index dba46ed..93753a2 100644
--- a/projecttemplates/RelyingPartyLogic/Model.Designer.cs
+++ b/projecttemplates/RelyingPartyLogic/Model.Designer.cs
@@ -15,7 +15,7 @@
[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/18/2009 9:09:23 AM
+// Generation date: 12/9/2009 8:19:16 AM
namespace RelyingPartyLogic
{
@@ -50,80 +50,80 @@ namespace RelyingPartyLogic
}
partial void OnContextCreated();
/// <summary>
- /// There are no comments for Role in the schema.
+ /// There are no comments for Roles in the schema.
/// </summary>
- public global::System.Data.Objects.ObjectQuery<Role> Role
+ public global::System.Data.Objects.ObjectQuery<Role> Roles
{
get
{
- if ((this._Role == null))
+ if ((this._Roles == null))
{
- this._Role = base.CreateQuery<Role>("[Role]");
+ this._Roles = base.CreateQuery<Role>("[Roles]");
}
- return this._Role;
+ return this._Roles;
}
}
- private global::System.Data.Objects.ObjectQuery<Role> _Role;
+ private global::System.Data.Objects.ObjectQuery<Role> _Roles;
/// <summary>
- /// There are no comments for User in the schema.
+ /// There are no comments for Users in the schema.
/// </summary>
- public global::System.Data.Objects.ObjectQuery<User> User
+ public global::System.Data.Objects.ObjectQuery<User> Users
{
get
{
- if ((this._User == null))
+ if ((this._Users == null))
{
- this._User = base.CreateQuery<User>("[User]");
+ this._Users = base.CreateQuery<User>("[Users]");
}
- return this._User;
+ return this._Users;
}
}
- private global::System.Data.Objects.ObjectQuery<User> _User;
+ private global::System.Data.Objects.ObjectQuery<User> _Users;
/// <summary>
- /// There are no comments for AuthenticationToken in the schema.
+ /// There are no comments for AuthenticationTokens in the schema.
/// </summary>
- public global::System.Data.Objects.ObjectQuery<AuthenticationToken> AuthenticationToken
+ public global::System.Data.Objects.ObjectQuery<AuthenticationToken> AuthenticationTokens
{
get
{
- if ((this._AuthenticationToken == null))
+ if ((this._AuthenticationTokens == null))
{
- this._AuthenticationToken = base.CreateQuery<AuthenticationToken>("[AuthenticationToken]");
+ this._AuthenticationTokens = base.CreateQuery<AuthenticationToken>("[AuthenticationTokens]");
}
- return this._AuthenticationToken;
+ return this._AuthenticationTokens;
}
}
- private global::System.Data.Objects.ObjectQuery<AuthenticationToken> _AuthenticationToken;
+ private global::System.Data.Objects.ObjectQuery<AuthenticationToken> _AuthenticationTokens;
/// <summary>
- /// There are no comments for Consumer in the schema.
+ /// There are no comments for Consumers in the schema.
/// </summary>
- public global::System.Data.Objects.ObjectQuery<Consumer> Consumer
+ public global::System.Data.Objects.ObjectQuery<Consumer> Consumers
{
get
{
- if ((this._Consumer == null))
+ if ((this._Consumers == null))
{
- this._Consumer = base.CreateQuery<Consumer>("[Consumer]");
+ this._Consumers = base.CreateQuery<Consumer>("[Consumers]");
}
- return this._Consumer;
+ return this._Consumers;
}
}
- private global::System.Data.Objects.ObjectQuery<Consumer> _Consumer;
+ private global::System.Data.Objects.ObjectQuery<Consumer> _Consumers;
/// <summary>
- /// There are no comments for IssuedToken in the schema.
+ /// There are no comments for IssuedTokens in the schema.
/// </summary>
- public global::System.Data.Objects.ObjectQuery<IssuedToken> IssuedToken
+ public global::System.Data.Objects.ObjectQuery<IssuedToken> IssuedTokens
{
get
{
- if ((this._IssuedToken == null))
+ if ((this._IssuedTokens == null))
{
- this._IssuedToken = base.CreateQuery<IssuedToken>("[IssuedToken]");
+ this._IssuedTokens = base.CreateQuery<IssuedToken>("[IssuedTokens]");
}
- return this._IssuedToken;
+ return this._IssuedTokens;
}
}
- private global::System.Data.Objects.ObjectQuery<IssuedToken> _IssuedToken;
+ private global::System.Data.Objects.ObjectQuery<IssuedToken> _IssuedTokens;
/// <summary>
/// There are no comments for Nonces in the schema.
/// </summary>
@@ -155,39 +155,39 @@ namespace RelyingPartyLogic
}
private global::System.Data.Objects.ObjectQuery<OpenIdAssociation> _OpenIdAssociations;
/// <summary>
- /// There are no comments for Role in the schema.
+ /// There are no comments for Roles in the schema.
/// </summary>
- public void AddToRole(Role role)
+ public void AddToRoles(Role role)
{
- base.AddObject("Role", role);
+ base.AddObject("Roles", role);
}
/// <summary>
- /// There are no comments for User in the schema.
+ /// There are no comments for Users in the schema.
/// </summary>
- public void AddToUser(User user)
+ public void AddToUsers(User user)
{
- base.AddObject("User", user);
+ base.AddObject("Users", user);
}
/// <summary>
- /// There are no comments for AuthenticationToken in the schema.
+ /// There are no comments for AuthenticationTokens in the schema.
/// </summary>
- public void AddToAuthenticationToken(AuthenticationToken authenticationToken)
+ public void AddToAuthenticationTokens(AuthenticationToken authenticationToken)
{
- base.AddObject("AuthenticationToken", authenticationToken);
+ base.AddObject("AuthenticationTokens", authenticationToken);
}
/// <summary>
- /// There are no comments for Consumer in the schema.
+ /// There are no comments for Consumers in the schema.
/// </summary>
- public void AddToConsumer(Consumer consumer)
+ public void AddToConsumers(Consumer consumer)
{
- base.AddObject("Consumer", consumer);
+ base.AddObject("Consumers", consumer);
}
/// <summary>
- /// There are no comments for IssuedToken in the schema.
+ /// There are no comments for IssuedTokens in the schema.
/// </summary>
- public void AddToIssuedToken(IssuedToken issuedToken)
+ public void AddToIssuedTokens(IssuedToken issuedToken)
{
- base.AddObject("IssuedToken", issuedToken);
+ base.AddObject("IssuedTokens", issuedToken);
}
/// <summary>
/// There are no comments for Nonces in the schema.
diff --git a/projecttemplates/RelyingPartyLogic/Model.edmx b/projecttemplates/RelyingPartyLogic/Model.edmx
index 76fd57a..f3bb739 100644
--- a/projecttemplates/RelyingPartyLogic/Model.edmx
+++ b/projecttemplates/RelyingPartyLogic/Model.edmx
@@ -201,24 +201,24 @@
<edmx:ConceptualModels>
<Schema Namespace="DatabaseModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
<EntityContainer Name="DatabaseEntities">
- <EntitySet Name="Role" EntityType="DatabaseModel.Role" />
- <EntitySet Name="User" EntityType="DatabaseModel.User" />
+ <EntitySet Name="Roles" EntityType="DatabaseModel.Role" />
+ <EntitySet Name="Users" EntityType="DatabaseModel.User" />
<AssociationSet Name="UserRole" Association="DatabaseModel.UserRole">
- <End Role="Role" EntitySet="Role" />
- <End Role="User" EntitySet="User" />
+ <End Role="Role" EntitySet="Roles" />
+ <End Role="User" EntitySet="Users" />
</AssociationSet>
- <EntitySet Name="AuthenticationToken" EntityType="DatabaseModel.AuthenticationToken" />
- <EntitySet Name="Consumer" EntityType="DatabaseModel.Consumer" />
- <EntitySet Name="IssuedToken" EntityType="DatabaseModel.IssuedToken" />
+ <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="User" />
- <End Role="AuthenticationToken" EntitySet="AuthenticationToken" /></AssociationSet>
+ <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="Consumer" />
- <End Role="IssuedToken" EntitySet="IssuedToken" /></AssociationSet>
+ <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="User" />
- <End Role="IssuedToken" EntitySet="IssuedToken" /></AssociationSet>
+ <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>
@@ -321,7 +321,7 @@
<edmx:Mappings>
<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
<EntityContainerMapping StorageEntityContainer="DatabaseModelStoreContainer" CdmEntityContainer="DatabaseEntities">
- <EntitySetMapping Name="Role">
+ <EntitySetMapping Name="Roles">
<EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.Role)">
<MappingFragment StoreEntitySet="Role">
<ScalarProperty Name="RoleId" ColumnName="RoleId" />
@@ -329,7 +329,7 @@
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
- <EntitySetMapping Name="User">
+ <EntitySetMapping Name="Users">
<EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.User)">
<MappingFragment StoreEntitySet="User">
<ScalarProperty Name="UserId" ColumnName="UserId" />
@@ -347,7 +347,7 @@
<EndProperty Name="Role">
<ScalarProperty Name="RoleId" ColumnName="RoleId" /></EndProperty>
</AssociationSetMapping>
- <EntitySetMapping Name="AuthenticationToken"><EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.AuthenticationToken)">
+ <EntitySetMapping Name="AuthenticationTokens"><EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.AuthenticationToken)">
<MappingFragment StoreEntitySet="AuthenticationToken">
<ScalarProperty Name="AuthenticationTokenId" ColumnName="AuthenticationTokenId" />
<ScalarProperty Name="UsageCount" ColumnName="UsageCount" />
@@ -358,7 +358,7 @@
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
- <EntitySetMapping Name="Consumer">
+ <EntitySetMapping Name="Consumers">
<EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.Consumer)">
<MappingFragment StoreEntitySet="Consumer">
<ScalarProperty Name="Name" ColumnName="Name" />
@@ -369,7 +369,7 @@
<ScalarProperty Name="X509CertificateAsBinary" ColumnName="X509Certificate" />
<ScalarProperty Name="ConsumerSecret" ColumnName="ConsumerSecret" />
<ScalarProperty Name="ConsumerKey" ColumnName="ConsumerKey" /></MappingFragment></EntityTypeMapping></EntitySetMapping>
- <EntitySetMapping Name="IssuedToken">
+ <EntitySetMapping Name="IssuedTokens">
<EntityTypeMapping TypeName="IsTypeOf(DatabaseModel.IssuedToken)">
<MappingFragment StoreEntitySet="IssuedToken">
<ScalarProperty Name="IssuedTokenId" ColumnName="IssuedTokenId" />
@@ -441,7 +441,7 @@
</edmx:Options>
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
- <Diagram Name="Model" ZoomLevel="98">
+ <Diagram Name="Model" ZoomLevel="56">
<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" />
diff --git a/projecttemplates/RelyingPartyLogic/OAuthAuthorizationManager.cs b/projecttemplates/RelyingPartyLogic/OAuthAuthorizationManager.cs
index 752e2eb..f57faab 100644
--- a/projecttemplates/RelyingPartyLogic/OAuthAuthorizationManager.cs
+++ b/projecttemplates/RelyingPartyLogic/OAuthAuthorizationManager.cs
@@ -33,7 +33,7 @@ namespace RelyingPartyLogic {
ServiceProvider sp = OAuthServiceProvider.ServiceProvider;
var auth = sp.ReadProtectedResourceAuthorization(httpDetails, requestUri);
if (auth != null) {
- var accessToken = Database.DataContext.IssuedToken.OfType<IssuedAccessToken>().First(token => token.Token == auth.AccessToken);
+ var accessToken = Database.DataContext.IssuedTokens.OfType<IssuedAccessToken>().First(token => token.Token == auth.AccessToken);
var principal = sp.CreatePrincipal(auth);
var policy = new OAuthPrincipalAuthorizationPolicy(principal);
diff --git a/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs b/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs
index 8d582ab..1880d80 100644
--- a/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs
+++ b/projecttemplates/RelyingPartyLogic/OAuthServiceProvider.cs
@@ -68,7 +68,7 @@ namespace RelyingPartyLogic {
throw new InvalidOperationException();
}
- return Database.DataContext.IssuedToken.OfType<IssuedRequestToken>().Include("Consumer").First(t => t.Token == message.Token).Consumer;
+ return Database.DataContext.IssuedTokens.OfType<IssuedRequestToken>().Include("Consumer").First(t => t.Token == message.Token).Consumer;
}
}
@@ -79,7 +79,7 @@ namespace RelyingPartyLogic {
}
ITokenContainingMessage msg = pendingRequest;
- var token = Database.DataContext.IssuedToken.OfType<IssuedRequestToken>().First(t => t.Token == msg.Token);
+ var token = Database.DataContext.IssuedTokens.OfType<IssuedRequestToken>().First(t => t.Token == msg.Token);
token.Authorize();
PendingAuthorizationRequest = null;
diff --git a/projecttemplates/RelyingPartyLogic/OAuthServiceProviderTokenManager.cs b/projecttemplates/RelyingPartyLogic/OAuthServiceProviderTokenManager.cs
index be53180..4ae50ce 100644
--- a/projecttemplates/RelyingPartyLogic/OAuthServiceProviderTokenManager.cs
+++ b/projecttemplates/RelyingPartyLogic/OAuthServiceProviderTokenManager.cs
@@ -30,7 +30,7 @@ namespace RelyingPartyLogic {
/// <exception cref="KeyNotFoundException">Thrown if the consumer key cannot be found.</exception>
public IConsumerDescription GetConsumer(string consumerKey) {
try {
- return Database.DataContext.Consumer.First(c => c.ConsumerKey == consumerKey);
+ return Database.DataContext.Consumers.First(c => c.ConsumerKey == consumerKey);
} catch (InvalidOperationException) {
throw new KeyNotFoundException();
}
@@ -47,7 +47,7 @@ namespace RelyingPartyLogic {
/// been authorized, has expired or does not exist.
/// </returns>
public bool IsRequestTokenAuthorized(string requestToken) {
- return Database.DataContext.IssuedToken.OfType<IssuedRequestToken>().Any(
+ return Database.DataContext.IssuedTokens.OfType<IssuedRequestToken>().Any(
t => t.Token == requestToken && t.User != null);
}
@@ -65,7 +65,7 @@ namespace RelyingPartyLogic {
/// </remarks>
public IServiceProviderRequestToken GetRequestToken(string token) {
try {
- return Database.DataContext.IssuedToken.OfType<IssuedRequestToken>().First(tok => tok.Token == token);
+ return Database.DataContext.IssuedTokens.OfType<IssuedRequestToken>().First(tok => tok.Token == token);
} catch (InvalidOperationException) {
throw new KeyNotFoundException();
}
@@ -85,7 +85,7 @@ namespace RelyingPartyLogic {
/// </remarks>
public IServiceProviderAccessToken GetAccessToken(string token) {
try {
- return Database.DataContext.IssuedToken.OfType<IssuedAccessToken>().First(tok => tok.Token == token);
+ return Database.DataContext.IssuedTokens.OfType<IssuedAccessToken>().First(tok => tok.Token == token);
} catch (InvalidOperationException) {
throw new KeyNotFoundException();
}
diff --git a/projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs b/projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs
index 894fbf3..fbf808c 100644
--- a/projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs
+++ b/projecttemplates/RelyingPartyLogic/OAuthTokenManager.cs
@@ -37,7 +37,7 @@ namespace RelyingPartyLogic {
/// <exception cref="ArgumentException">Thrown if the secret cannot be found for the given token.</exception>
public string GetTokenSecret(string token) {
try {
- return Database.DataContext.IssuedToken.First(t => t.Token == token).TokenSecret;
+ return Database.DataContext.IssuedTokens.First(t => t.Token == token).TokenSecret;
} catch (InvalidOperationException) {
throw new ArgumentOutOfRangeException();
}
@@ -59,7 +59,7 @@ namespace RelyingPartyLogic {
public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
Consumer consumer;
try {
- consumer = Database.DataContext.Consumer.First(c => c.ConsumerKey == request.ConsumerKey);
+ consumer = Database.DataContext.Consumers.First(c => c.ConsumerKey == request.ConsumerKey);
} catch (InvalidOperationException) {
throw new ArgumentOutOfRangeException();
}
@@ -74,7 +74,7 @@ namespace RelyingPartyLogic {
if (request.ExtraData.TryGetValue("scope", out scope)) {
token.Scope = scope;
}
- Database.DataContext.AddToIssuedToken(token);
+ Database.DataContext.AddToIssuedTokens(token);
Database.DataContext.SaveChanges();
}
@@ -102,7 +102,7 @@ namespace RelyingPartyLogic {
/// </para>
/// </remarks>
public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
- var requestTokenEntity = Database.DataContext.IssuedToken.OfType<IssuedRequestToken>()
+ var requestTokenEntity = Database.DataContext.IssuedTokens.OfType<IssuedRequestToken>()
.Include("User")
.First(t => t.Consumer.ConsumerKey == consumerKey && t.Token == requestToken);
@@ -116,7 +116,7 @@ namespace RelyingPartyLogic {
};
Database.DataContext.DeleteObject(requestTokenEntity);
- Database.DataContext.AddToIssuedToken(accessTokenEntity);
+ Database.DataContext.AddToIssuedTokens(accessTokenEntity);
Database.DataContext.SaveChanges();
}
@@ -128,7 +128,7 @@ namespace RelyingPartyLogic {
/// Request or Access token, or invalid if the token is not recognized.
/// </returns>
public TokenType GetTokenType(string token) {
- IssuedToken tok = Database.DataContext.IssuedToken.FirstOrDefault(t => t.Token == token);
+ IssuedToken tok = Database.DataContext.IssuedTokens.FirstOrDefault(t => t.Token == token);
if (tok == null) {
return TokenType.InvalidToken;
} else {
diff --git a/projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs b/projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs
index 261ddea..47618a1 100644
--- a/projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs
+++ b/projecttemplates/WebFormsRelyingParty/Admin/Default.aspx.cs
@@ -18,7 +18,7 @@ namespace WebFormsRelyingParty.Admin {
public partial class Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
- this.usersRepeater.DataSource = Database.DataContext.User.Include("AuthenticationTokens");
+ this.usersRepeater.DataSource = Database.DataContext.Users.Include("AuthenticationTokens");
this.usersRepeater.DataBind();
}
}
diff --git a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs
index 9e708bc..eee3673 100644
--- a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs
+++ b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs
@@ -52,7 +52,7 @@
private void LoginUser(string claimedIdentifier, string friendlyIdentifier, ClaimsResponse claims, Token samlToken, bool trustedEmail) {
// Create an account for this user if we don't already have one.
- AuthenticationToken openidToken = Database.DataContext.AuthenticationToken.FirstOrDefault(token => token.ClaimedIdentifier == claimedIdentifier);
+ AuthenticationToken openidToken = Database.DataContext.AuthenticationTokens.FirstOrDefault(token => token.ClaimedIdentifier == claimedIdentifier);
if (openidToken == null) {
// this is a user we haven't seen before.
User user = new User();
@@ -90,7 +90,7 @@
}
}
- Database.DataContext.AddToUser(user);
+ Database.DataContext.AddToUsers(user);
} else {
openidToken.UsageCount++;
openidToken.LastUsedUtc = DateTime.UtcNow;
diff --git a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs
index f196a2c..68b4398 100644
--- a/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs
+++ b/projecttemplates/WebFormsRelyingParty/Members/AccountInfo.aspx.cs
@@ -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.UserId == Database.LoggedInUser.UserId);
+ var token = Database.DataContext.AuthenticationTokens.First(t => t.ClaimedIdentifier == claimedId && t.User.UserId == Database.LoggedInUser.UserId);
Database.DataContext.DeleteObject(token);
Database.DataContext.SaveChanges();
this.Repeater1.DataBind();
@@ -72,7 +72,7 @@ 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.UserId == Database.LoggedInUser.UserId);
+ var tokenToRevoke = Database.DataContext.IssuedTokens.FirstOrDefault(t => t.Token == token && t.User.UserId == Database.LoggedInUser.UserId);
if (tokenToRevoke != null) {
Database.DataContext.DeleteObject(tokenToRevoke);
}
@@ -85,7 +85,7 @@ namespace WebFormsRelyingParty.Members {
// Check that this identifier isn't already tied to a user account.
// We do this again here in case the LoggingIn event couldn't verify
// and in case somehow the OP changed it anyway.
- var existingToken = Database.DataContext.AuthenticationToken.FirstOrDefault(token => token.ClaimedIdentifier == claimedId);
+ var existingToken = Database.DataContext.AuthenticationTokens.FirstOrDefault(token => token.ClaimedIdentifier == claimedId);
if (existingToken == null) {
var token = new AuthenticationToken();
token.ClaimedIdentifier = claimedId;