Guest User

Untitled

a guest
Nov 22nd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <Route path='/login' component={Login} />
  2.  
  3. public void ConfigureServices(IServiceCollection services)
  4. {
  5. services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
  6. // Cookie auth for MVC page that hosts React app
  7. .AddCookie(options =>
  8. {
  9. options.LoginPath = new PathString("/Account/Login");
  10. options.LogoutPath = new PathString("/Account/Logout");
  11.  
  12. options.Cookie = new CookieBuilder
  13. {
  14. HttpOnly = true,
  15. Name = "OurCookieAuthentication",
  16. Path = "/",
  17. SameSite = SameSiteMode.Lax,
  18. SecurePolicy = CookieSecurePolicy.SameAsRequest
  19. };
  20. options.ExpireTimeSpan = TimeSpan.FromMinutes(30);
  21. options.SlidingExpiration = true;
  22.  
  23. }
  24. )
  25. // JWT authenticaton for REST API called by React app
  26. .AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, options => {
  27. options.TokenValidationParameters = new TokenValidationParameters
  28. {
  29. ValidateAudience = false,
  30. ValidateIssuer = false,
  31. ValidateIssuerSigningKey = true,
  32. IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("thesecret")),
  33. ValidateLifetime = true,
  34. ClockSkew = TimeSpan.FromMinutes(5)
  35. };
  36. });
  37. ;
  38.  
  39. services.AddMvc()
  40. }
  41.  
  42. options.LoginPath = new PathString("/Account/Login");
  43.  
  44. options.LoginPath = new PathString("/login");
Add Comment
Please, Sign In to add comment