Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1.         public IServiceProvider ConfigureServices(IServiceCollection services)
  2.         {
  3.             // Add framework services
  4.             services.AddSingleton(AutoMapperConfig.Initialize());
  5.  
  6.             var jwtSettings = Configuration.Get<JwtSettings>();
  7.             services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
  8.                     .AddJwtBearer(options =>
  9.                     {
  10.                         options.TokenValidationParameters = new TokenValidationParameters
  11.                         {
  12.                             ValidateIssuer = true,
  13.                             ValidateAudience = false,
  14.                             ValidateLifetime = false,
  15.                             ValidateIssuerSigningKey = true,
  16.  
  17.                             ValidIssuer = jwtSettings.Issuer,
  18.                             IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtSettings.Key))
  19.                         };
  20.                     });
  21.  
  22.             services.AddMvc();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement