Skip to content

Commit 35bc7d2

Browse files
committed
Update to MVC 5.2.3
1 parent 881cf74 commit 35bc7d2

File tree

93 files changed

+29320
-1236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+29320
-1236
lines changed

Couchbase.AspNet.sln

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1010
EndProject
1111
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Couchbase.AspNet", "Couchbase.AspNet\Couchbase.AspNet.csproj", "{A53FF68E-9029-4652-A59D-F9FFD097C206}"
1212
EndProject
13-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CouchbaseAspNetSample", "CouchbaseAspNetSample\CouchbaseAspNetSample.csproj", "{E0E0512D-42ED-4302-9E1D-182FE3945F28}"
14-
EndProject
1513
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Couchbase.AspNet.UnitTests", "Couchbase.AspNet.UnitTests\Couchbase.AspNet.UnitTests.csproj", "{A572A443-520A-4FDF-8C98-99AE83C96C27}"
1614
EndProject
15+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CouchbaseAspNetExample", "CouchbaseAspNetExample\CouchbaseAspNetExample.csproj", "{95975D67-8C32-43A6-9196-615DCBE393A6}"
16+
EndProject
1717
Global
1818
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1919
Debug|Any CPU = Debug|Any CPU
@@ -24,14 +24,14 @@ Global
2424
{A53FF68E-9029-4652-A59D-F9FFD097C206}.Debug|Any CPU.Build.0 = Debug|Any CPU
2525
{A53FF68E-9029-4652-A59D-F9FFD097C206}.Release|Any CPU.ActiveCfg = Release|Any CPU
2626
{A53FF68E-9029-4652-A59D-F9FFD097C206}.Release|Any CPU.Build.0 = Release|Any CPU
27-
{E0E0512D-42ED-4302-9E1D-182FE3945F28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28-
{E0E0512D-42ED-4302-9E1D-182FE3945F28}.Debug|Any CPU.Build.0 = Debug|Any CPU
29-
{E0E0512D-42ED-4302-9E1D-182FE3945F28}.Release|Any CPU.ActiveCfg = Release|Any CPU
30-
{E0E0512D-42ED-4302-9E1D-182FE3945F28}.Release|Any CPU.Build.0 = Release|Any CPU
3127
{A572A443-520A-4FDF-8C98-99AE83C96C27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3228
{A572A443-520A-4FDF-8C98-99AE83C96C27}.Debug|Any CPU.Build.0 = Debug|Any CPU
3329
{A572A443-520A-4FDF-8C98-99AE83C96C27}.Release|Any CPU.ActiveCfg = Release|Any CPU
3430
{A572A443-520A-4FDF-8C98-99AE83C96C27}.Release|Any CPU.Build.0 = Release|Any CPU
31+
{95975D67-8C32-43A6-9196-615DCBE393A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32+
{95975D67-8C32-43A6-9196-615DCBE393A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
33+
{95975D67-8C32-43A6-9196-615DCBE393A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
34+
{95975D67-8C32-43A6-9196-615DCBE393A6}.Release|Any CPU.Build.0 = Release|Any CPU
3535
EndGlobalSection
3636
GlobalSection(SolutionProperties) = preSolution
3737
HideSolutionNode = FALSE
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Web;
2+
using System.Web.Optimization;
3+
4+
namespace CouchbaseAspNetExample
5+
{
6+
public class BundleConfig
7+
{
8+
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
9+
public static void RegisterBundles(BundleCollection bundles)
10+
{
11+
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
12+
"~/Scripts/jquery-{version}.js"));
13+
14+
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
15+
"~/Scripts/jquery.validate*"));
16+
17+
// Use the development version of Modernizr to develop with and learn from. Then, when you're
18+
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
19+
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
20+
"~/Scripts/modernizr-*"));
21+
22+
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
23+
"~/Scripts/bootstrap.js",
24+
"~/Scripts/respond.js"));
25+
26+
bundles.Add(new StyleBundle("~/Content/css").Include(
27+
"~/Content/bootstrap.css",
28+
"~/Content/site.css"));
29+
}
30+
}
31+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Web;
2+
using System.Web.Mvc;
3+
4+
namespace CouchbaseAspNetExample
5+
{
6+
public class FilterConfig
7+
{
8+
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
9+
{
10+
filters.Add(new HandleErrorAttribute());
11+
}
12+
}
13+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data.Entity;
4+
using System.Linq;
5+
using System.Security.Claims;
6+
using System.Threading.Tasks;
7+
using System.Web;
8+
using Microsoft.AspNet.Identity;
9+
using Microsoft.AspNet.Identity.EntityFramework;
10+
using Microsoft.AspNet.Identity.Owin;
11+
using Microsoft.Owin;
12+
using Microsoft.Owin.Security;
13+
using CouchbaseAspNetExample.Models;
14+
15+
namespace CouchbaseAspNetExample
16+
{
17+
public class EmailService : IIdentityMessageService
18+
{
19+
public Task SendAsync(IdentityMessage message)
20+
{
21+
// Plug in your email service here to send an email.
22+
return Task.FromResult(0);
23+
}
24+
}
25+
26+
public class SmsService : IIdentityMessageService
27+
{
28+
public Task SendAsync(IdentityMessage message)
29+
{
30+
// Plug in your SMS service here to send a text message.
31+
return Task.FromResult(0);
32+
}
33+
}
34+
35+
// Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
36+
public class ApplicationUserManager : UserManager<ApplicationUser>
37+
{
38+
public ApplicationUserManager(IUserStore<ApplicationUser> store)
39+
: base(store)
40+
{
41+
}
42+
43+
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
44+
{
45+
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()));
46+
// Configure validation logic for usernames
47+
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
48+
{
49+
AllowOnlyAlphanumericUserNames = false,
50+
RequireUniqueEmail = true
51+
};
52+
53+
// Configure validation logic for passwords
54+
manager.PasswordValidator = new PasswordValidator
55+
{
56+
RequiredLength = 6,
57+
RequireNonLetterOrDigit = true,
58+
RequireDigit = true,
59+
RequireLowercase = true,
60+
RequireUppercase = true,
61+
};
62+
63+
// Configure user lockout defaults
64+
manager.UserLockoutEnabledByDefault = true;
65+
manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
66+
manager.MaxFailedAccessAttemptsBeforeLockout = 5;
67+
68+
// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
69+
// You can write your own provider and plug it in here.
70+
manager.RegisterTwoFactorProvider("Phone Code", new PhoneNumberTokenProvider<ApplicationUser>
71+
{
72+
MessageFormat = "Your security code is {0}"
73+
});
74+
manager.RegisterTwoFactorProvider("Email Code", new EmailTokenProvider<ApplicationUser>
75+
{
76+
Subject = "Security Code",
77+
BodyFormat = "Your security code is {0}"
78+
});
79+
manager.EmailService = new EmailService();
80+
manager.SmsService = new SmsService();
81+
var dataProtectionProvider = options.DataProtectionProvider;
82+
if (dataProtectionProvider != null)
83+
{
84+
manager.UserTokenProvider =
85+
new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
86+
}
87+
return manager;
88+
}
89+
}
90+
91+
// Configure the application sign-in manager which is used in this application.
92+
public class ApplicationSignInManager : SignInManager<ApplicationUser, string>
93+
{
94+
public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
95+
: base(userManager, authenticationManager)
96+
{
97+
}
98+
99+
public override Task<ClaimsIdentity> CreateUserIdentityAsync(ApplicationUser user)
100+
{
101+
return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);
102+
}
103+
104+
public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context)
105+
{
106+
return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication);
107+
}
108+
}
109+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using System.Web.Routing;
7+
8+
namespace CouchbaseAspNetExample
9+
{
10+
public class RouteConfig
11+
{
12+
public static void RegisterRoutes(RouteCollection routes)
13+
{
14+
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15+
16+
routes.MapRoute(
17+
name: "Default",
18+
url: "{controller}/{action}/{id}",
19+
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20+
);
21+
}
22+
}
23+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using Microsoft.AspNet.Identity;
3+
using Microsoft.AspNet.Identity.Owin;
4+
using Microsoft.Owin;
5+
using Microsoft.Owin.Security.Cookies;
6+
using Microsoft.Owin.Security.Google;
7+
using Owin;
8+
using CouchbaseAspNetExample.Models;
9+
10+
namespace CouchbaseAspNetExample
11+
{
12+
public partial class Startup
13+
{
14+
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
15+
public void ConfigureAuth(IAppBuilder app)
16+
{
17+
// Configure the db context, user manager and signin manager to use a single instance per request
18+
app.CreatePerOwinContext(ApplicationDbContext.Create);
19+
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
20+
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
21+
22+
// Enable the application to use a cookie to store information for the signed in user
23+
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
24+
// Configure the sign in cookie
25+
app.UseCookieAuthentication(new CookieAuthenticationOptions
26+
{
27+
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
28+
LoginPath = new PathString("/Account/Login"),
29+
Provider = new CookieAuthenticationProvider
30+
{
31+
// Enables the application to validate the security stamp when the user logs in.
32+
// This is a security feature which is used when you change a password or add an external login to your account.
33+
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
34+
validateInterval: TimeSpan.FromMinutes(30),
35+
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
36+
}
37+
});
38+
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
39+
40+
// Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process.
41+
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
42+
43+
// Enables the application to remember the second login verification factor such as phone or email.
44+
// Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from.
45+
// This is similar to the RememberMe option when you log in.
46+
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
47+
48+
// Uncomment the following lines to enable logging in with third party login providers
49+
//app.UseMicrosoftAccountAuthentication(
50+
// clientId: "",
51+
// clientSecret: "");
52+
53+
//app.UseTwitterAuthentication(
54+
// consumerKey: "",
55+
// consumerSecret: "");
56+
57+
//app.UseFacebookAuthentication(
58+
// appId: "",
59+
// appSecret: "");
60+
61+
//app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
62+
//{
63+
// ClientId = "",
64+
// ClientSecret = ""
65+
//});
66+
}
67+
}
68+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
6+
namespace CouchbaseAspNetExample.Constants
7+
{
8+
public static class AppConstants
9+
{
10+
public static string ApplicationName = "CouchbaseAspNet";
11+
}
12+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
body {
2+
padding-top: 50px;
3+
padding-bottom: 20px;
4+
}
5+
6+
/* Set padding to keep content from hitting the edges */
7+
.body-content {
8+
padding-left: 15px;
9+
padding-right: 15px;
10+
}
11+
12+
/* Override the default bootstrap behavior where horizontal description lists
13+
will truncate terms that are too long to fit in the left column
14+
*/
15+
.dl-horizontal dt {
16+
white-space: normal;
17+
}
18+
19+
/* Set width on the form input elements since they're 100% wide by default */
20+
input,
21+
select,
22+
textarea {
23+
max-width: 280px;
24+
}

0 commit comments

Comments
 (0)