Guest User

Untitled

a guest
Jul 17th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
  2. .AddJwtBearer(options =>
  3. {
  4. options.TokenValidationParameters = new TokenValidationParameters
  5. {
  6. ValidateIssuer = true,
  7. ValidateAudience = true,
  8. ValidateLifetime = true,
  9. ValidateIssuerSigningKey = true,
  10. ValidIssuer = Configuration["Jwt:Issuer"],
  11. ValidAudience = Configuration["Jwt:Audience"],
  12. IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"]))
  13. };
  14. });
  15.  
  16. services.AddCors(options =>
  17. {
  18. options.AddPolicy("CorsPolicy",
  19. builder => builder.AllowAnyOrigin()
  20. .AllowAnyMethod()
  21. .AllowAnyHeader()
  22. .AllowCredentials()
  23. .Build());
  24. });
  25.  
  26. services.AddMvc();
Add Comment
Please, Sign In to add comment