Ejemplo n.º 1
0
 public LoginController(IConfiguration config, PhotoboxDB database)
 {
     _config    = config;
     _database  = database;
     _pwHelper  = new PasswordHelper();
     _jwtHelper = new JWTHelper(config);
 }
Ejemplo n.º 2
0
        // 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"]))
                };
            });
        }
Ejemplo n.º 3
0
 public ImageController(PhotoboxDB DB)
 {
     this.DB = DB;
 }
 public PhotographerController(IConfiguration config, PhotoboxDB database)
 {
     _config   = config;
     _database = database;
     _pwHelper = new PasswordHelper();
 }
Ejemplo n.º 5
0
 public BrokerController(IConfiguration config, PhotoboxDB database)
 {
     _config    = config;
     _database  = database;
     _jwtHelper = new JWTHelper(config);
 }