Skip to content
Browse files

getting the sample app running again

  • Loading branch information...
1 parent f54caf3 commit 644f631ad0846c34488ee5b63117b5d02e966ebb @OdeToCode committed Oct 15, 2012
View
4 src/Sample.Mongo/LogMeIn.Mongo.csproj
@@ -361,9 +361,9 @@
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
- <DevelopmentServerPort>0</DevelopmentServerPort>
+ <DevelopmentServerPort>3820</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
- <IISUrl>http://localhost:42791/</IISUrl>
+ <IISUrl>http://localhost:42792/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
View
2 src/Sample/Controllers/HomeController.cs
@@ -9,7 +9,7 @@
namespace LogMeIn.Controllers
{
- [Authorize]
+
public class HomeController : Controller
{
private MovieDb db = new MovieDb();
View
8 src/Sample/DependencyResolution/IoC.cs
@@ -16,10 +16,10 @@ public static class IoC {
});
x.For<IFilterProvider>().Use<SmFilterProvider>();
- x.For<IFlexMembershipProvider>().HybridHttpOrThreadLocalScoped().Use<FlexMembershipProvider>();
- x.For<IFlexRoleProvider>().HybridHttpOrThreadLocalScoped().Use<FlexRoleProvider>();
- x.For<IFlexUserStore>().HybridHttpOrThreadLocalScoped().Use<UserStore>();
- x.For<IFlexRoleStore>().HybridHttpOrThreadLocalScoped().Use<RoleStore>();
+ x.For<IFlexMembershipProvider>().HttpContextScoped().Use<FlexMembershipProvider>();
+ x.For<IFlexRoleProvider>().HttpContextScoped().Use<FlexRoleProvider>();
+ x.For<IFlexUserStore>().HttpContextScoped().Use<UserStore>();
+ x.For<IFlexRoleStore>().HttpContextScoped().Use<RoleStore>();
x.SetAllProperties(p => p.OfType<IFlexRoleProvider>());
x.Forward<IFlexMembershipProvider, IFlexOAuthProvider>();
View
4 src/Sample/Global.asax.cs
@@ -2,13 +2,9 @@
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
-using LogMeIn.App_Start;
namespace LogMeIn
{
- // Note: For instructions on enabling IIS6 or IIS7 classic mode,
- // visit http://go.microsoft.com/?LinkId=9394801
-
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
View
10 src/Sample/LogMeIn.csproj
@@ -186,19 +186,15 @@
<DependentUpon>201209221621381_Create.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
+ <Compile Include="Models\ManageMessageId.cs" />
<Compile Include="Models\MovieDb.cs" />
<Compile Include="Models\Movie.cs" />
<Compile Include="Models\Role.cs" />
<Compile Include="Models\RoleStore.cs" />
<Compile Include="Models\User.cs" />
<Compile Include="Models\UserStore.cs" />
- <Compile Include="Security\IUserProfileManager.cs" />
- <Compile Include="Security\IWebSecurity.cs" />
<Compile Include="Models\AccountModels.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Security\ManageMessageId.cs" />
- <Compile Include="Security\UserProfileManager.cs" />
- <Compile Include="Security\WebMatrixSecurity.cs" />
<Content Include="Views\Home\Details.cshtml" />
<Content Include="Views\Home\Create.cshtml" />
<Content Include="Views\Home\Edit.cshtml" />
@@ -353,9 +349,9 @@
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
- <DevelopmentServerPort>0</DevelopmentServerPort>
+ <DevelopmentServerPort>3776</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
- <IISUrl>http://localhost:42791/</IISUrl>
+ <IISUrl>http://localhost:42793/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
View
4 src/Sample/Security/ManageMessageId.cs → src/Sample/Models/ManageMessageId.cs
@@ -1,9 +1,9 @@
-namespace LogMeIn
+namespace LogMeIn.Models
{
public enum ManageMessageId
{
ChangePasswordSuccess,
SetPasswordSuccess,
- RemoveLoginSuccess,
+ RemoveLoginSuccess
}
}
View
5 src/Sample/Models/User.cs
@@ -6,6 +6,11 @@ namespace LogMeIn.Models
{
public class User : IFlexMembershipUser
{
+ public User()
+ {
+ PasswordResetTokenExpiration = DateTime.Now;
+ }
+
public int Id { get; set; }
public string Username { get; set; }
public string Password { get; set; }
View
9 src/Sample/Security/IUserProfileManager.cs
@@ -1,9 +0,0 @@
-namespace LogMeIn.Security
-{
- // TODO: what parameters are needed?
- public interface IUserProfileManager
- {
- bool Exists(string userName);
- void Add(string userName);
- }
-}
View
28 src/Sample/Security/IWebSecurity.cs
@@ -1,28 +0,0 @@
-using System.Collections.Generic;
-using DotNetOpenAuth.AspNet;
-using Microsoft.Web.WebPages.OAuth;
-
-namespace LogMeIn
-{
-
- // TODO: simplify
- public interface IWebSecurity
- {
- bool Login(string userName, string password, bool persistCookie = false);
- void Logout();
- void Register(string userName, string password);
- bool HasLocalAccount(string userName);
- string GetUserName(string provider, string providerUserId);
- ManageMessageId? Dissassociate(string ownerAccount, string provider, string providerUserId);
- bool ChangePassword(string name, string oldPassword, string newPassword);
- void CreateAccount(string name, string newPassword);
- void CreateOrUpdateAccount(string provider, string providerUserId, string name);
- string SerializeProviderUserId(string provider, string providerUserId);
- AuthenticationClientData GetOAuthClientData(string provider);
- bool TryDeserializeProviderUserId(string externalLoginData, out string provider, out string providerUserId);
- ICollection<AuthenticationClientData> RegisteredClientData { get; }
- ICollection<OAuthAccount> GetAccountsFromUserName(string name);
- void RequestAuthentication(string provider, string returnUrl);
- AuthenticationResult VerifyAuthentication(string action);
- }
-}
View
25 src/Sample/Security/UserProfileManager.cs
@@ -1,25 +0,0 @@
-using System.Linq;
-using LogMeIn.Models;
-
-namespace LogMeIn.Security
-{
- //class UserProfileManager : IUserProfileManager
- //{
- // //public bool Exists(string userName)
- // //{
- // // using (UsersContext db = new UsersContext())
- // // {
- // // return db.UserProfiles.FirstOrDefault(u => u.UserName.ToLower() == userName.ToLower()) != null;
- // // }
- // //}
-
- // public void Add(string userName)
- // {
- // using (UsersContext db = new UsersContext())
- // {
- // db.UserProfiles.Add(new UserProfile {UserName = userName});
- // db.SaveChanges();
- // }
- // }
- //}
-}
View
113 src/Sample/Security/WebMatrixSecurity.cs
@@ -1,113 +0,0 @@
-using System.Collections.Generic;
-using System.Transactions;
-using DotNetOpenAuth.AspNet;
-using Microsoft.Web.WebPages.OAuth;
-using WebMatrix.WebData;
-
-namespace LogMeIn
-{
- public class WebMatrixSecurity : IWebSecurity
- {
- public bool Login(string userName, string password, bool persistCookie = false)
- {
- return WebSecurity.Login(userName, password, persistCookie);
- }
-
- public void CreateUserAndAccount(string userName, string password)
- {
- WebSecurity.CreateUserAndAccount(userName, password);
- }
-
- public void Logout()
- {
- WebSecurity.Logout();
- }
-
- public string GetUserName(string provider, string providerUserId)
- {
- return OAuthWebSecurity.GetUserName(provider, providerUserId);
- }
-
- public ManageMessageId? Dissassociate(string ownerAccount, string provider, string providerUserId)
- {
- // Use a transaction to prevent the user from deleting their last login credential
- using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.Serializable }))
- {
- bool hasLocalAccount = OAuthWebSecurity.HasLocalAccount(WebSecurity.GetUserId(ownerAccount));
- if (hasLocalAccount || OAuthWebSecurity.GetAccountsFromUserName(ownerAccount).Count > 1)
- {
- OAuthWebSecurity.DeleteAccount(provider, providerUserId);
- scope.Complete();
- return ManageMessageId.RemoveLoginSuccess;
- }
- }
- return null;
- }
-
- public bool HasLocalAccount(string userName)
- {
- return OAuthWebSecurity.HasLocalAccount(GetUserId(userName));
- }
-
- public int GetUserId(string userName)
- {
- return WebSecurity.GetUserId(userName);
- }
-
- public bool ChangePassword(string name, string oldPassword, string newPassword)
- {
- return WebSecurity.ChangePassword(name, oldPassword, newPassword);
- }
-
- public void CreateAccount(string name, string newPassword)
- {
- WebSecurity.CreateAccount(name, newPassword);
- }
-
- public void CreateOrUpdateAccount(string provider, string providerUserId, string name)
- {
- OAuthWebSecurity.CreateOrUpdateAccount(provider, providerUserId, name);
- }
-
- public string SerializeProviderUserId(string provider, string providerUserId)
- {
- return OAuthWebSecurity.SerializeProviderUserId(provider, providerUserId);
- }
-
- public AuthenticationClientData GetOAuthClientData(string provider)
- {
- return OAuthWebSecurity.GetOAuthClientData(provider);
- }
-
- public bool TryDeserializeProviderUserId(string externalLoginData, out string provider, out string providerUserId)
- {
- return OAuthWebSecurity.TryDeserializeProviderUserId(externalLoginData, out provider, out providerUserId);
- }
-
- public ICollection<AuthenticationClientData> RegisteredClientData
- {
- get { return OAuthWebSecurity.RegisteredClientData; }
- }
-
- public ICollection<OAuthAccount> GetAccountsFromUserName(string name)
- {
- return OAuthWebSecurity.GetAccountsFromUserName(name);
- }
-
- public void RequestAuthentication(string provider, string returnUrl)
- {
- OAuthWebSecurity.RequestAuthentication(provider, returnUrl);
- }
-
- public AuthenticationResult VerifyAuthentication(string action)
- {
- return OAuthWebSecurity.VerifyAuthentication(action);
- }
-
- public void Register(string userName, string password)
- {
- CreateUserAndAccount(userName, password);
- Login(userName, password);
- }
- }
-}

0 comments on commit 644f631

Please sign in to comment.
Something went wrong with that request. Please try again.