public LoginController(IConfiguration config, PhotoboxDB database) { _config = config; _database = database; _pwHelper = new PasswordHelper(); _jwtHelper = new JWTHelper(config); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var settings = Configuration.GetSection("DatabaseSettings").Get <DatabaseSettings> (); PhotoboxDB photoboxDB = new PhotoboxDB(settings); services.AddSingleton(photoboxDB); services.AddControllers(); services.AddCors(); services.AddControllers().AddNewtonsoftJson(); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, ValidIssuer = Configuration["Jwt:Issuer"], ValidAudience = Configuration["Jwt:Issuer"], IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"])) }; }); }
public ImageController(PhotoboxDB DB) { this.DB = DB; }
public PhotographerController(IConfiguration config, PhotoboxDB database) { _config = config; _database = database; _pwHelper = new PasswordHelper(); }
public BrokerController(IConfiguration config, PhotoboxDB database) { _config = config; _database = database; _jwtHelper = new JWTHelper(config); }