// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, BettingGameContext dbContext) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); BettingGameDataInitializer.Seed(dbContext); app.UseCors(builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()); var settings = app.ApplicationServices.GetService <IOptions <Auth0Settings> >(); var options = new JwtBearerOptions { Audience = settings.Value.ClientId, Authority = $"https://{settings.Value.Domain}", TokenValidationParameters = new TokenValidationParameters { NameClaimType = "name", RoleClaimType = "https://schemas.testa.eu.auth0.com/roles" }, Events = new JwtBearerEvents { OnAuthenticationFailed = context => Task.FromResult(0), OnTokenValidated = context => { var claimsIdentity = context.Ticket.Principal.Identity as ClaimsIdentity; claimsIdentity?.AddClaim(new Claim("id_token", context.Request.Headers["Authorization"][0].Substring(context.Ticket.AuthenticationScheme.Length + 1))); // OPTIONAL: you can read/modify the claims that are populated based on the JWT //claimsIdentity.AddClaim(new Claim(ClaimTypes.Name, claimsIdentity.FindFirst("name").Value)); //claimsIdentity.AddClaim(new Claim(ClaimTypes.Role, claimsIdentity.FindFirst("role").Value)); return(Task.FromResult(0)); } } }; app.UseJwtBearerAuthentication(options); app.UseMvc(); }
public UnitOfWork(BettingGameContext context) { _context = context; }
public TipsRepository(BettingGameContext context) { _context = context; }
public MatchesRepository(BettingGameContext bettingGameContext) { _context = bettingGameContext; }