Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Route path='/login' component={Login} />
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
- // Cookie auth for MVC page that hosts React app
- .AddCookie(options =>
- {
- options.LoginPath = new PathString("/Account/Login");
- options.LogoutPath = new PathString("/Account/Logout");
- options.Cookie = new CookieBuilder
- {
- HttpOnly = true,
- Name = "OurCookieAuthentication",
- Path = "/",
- SameSite = SameSiteMode.Lax,
- SecurePolicy = CookieSecurePolicy.SameAsRequest
- };
- options.ExpireTimeSpan = TimeSpan.FromMinutes(30);
- options.SlidingExpiration = true;
- }
- )
- // JWT authenticaton for REST API called by React app
- .AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, options => {
- options.TokenValidationParameters = new TokenValidationParameters
- {
- ValidateAudience = false,
- ValidateIssuer = false,
- ValidateIssuerSigningKey = true,
- IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("thesecret")),
- ValidateLifetime = true,
- ClockSkew = TimeSpan.FromMinutes(5)
- };
- });
- ;
- services.AddMvc()
- }
- options.LoginPath = new PathString("/Account/Login");
- options.LoginPath = new PathString("/login");
Add Comment
Please, Sign In to add comment