Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers(options =>
            {
                options.Filters.Add(new AuthorizeFilter());
            });

            services.AddDbContext <TodoDbContext>(options =>
            {
                options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
            });

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "My API", Version = "v1"
                });
                c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    Name   = "Authorization",
                    In     = ParameterLocation.Header,
                    Type   = SecuritySchemeType.ApiKey,
                    Scheme = "Bearer",
                });
                c.OperationFilter <AuthenticationRequirementOperationFilter>();
            });

            services
            .AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddEntityFrameworkStores <TodoDbContext>();

            services.AddTransient <IUserService, IdentityUserService>();
            services.AddTransient <JwtTokenService>();

            services
            .AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            })
            ;

            services.AddAuthorization(options =>
            {
                options.AddPolicy("create",
                                  policy => policy.RequireClaim("permissions", "create"));
                options.AddPolicy("update",
                                  policy => policy.RequireClaim("permissions", "update"));
                options.AddPolicy("delete",
                                  policy => policy.RequireClaim("permissions", "delete"));
            });
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddControllers();
            services.AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            }).AddEntityFrameworkStores <AsyncInnDbContext>();

            services.AddScoped <JwtTokenService>();
            // Add the wiring for adding "Authentication" for our API
            // "We want the system to always use these "Schemes" to authenticate us
            // This allows us to annotate our routes
            services.AddAuthentication(options =>
            {
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                // Tell the authenticaion scheme "how/where" to validate the token + secret
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });

            services.AddAuthorization(options =>
            {
                // Add "Name of Policy", and the Lambda returns a definition
                options.AddPolicy("create", policy => policy.RequireClaim("permissions", "create"));
                options.AddPolicy("read", policy => policy.RequireClaim("permissions", "read"));
                options.AddPolicy("update", policy => policy.RequireClaim("permissions", "update"));
                options.AddPolicy("delete", policy => policy.RequireClaim("permissions", "delete"));
            });

            services.AddDbContext <AsyncInnDbContext>(options =>
            {
                string connectionString = Configuration.GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });

            services.AddTransient <IRoom, RoomRepository>();
            services.AddTransient <IHotel, HotelRepository>();
            services.AddTransient <IAmenity, AmenityRepository>();
            services.AddTransient <IHotelRoom, HotelRoomRepository>();
            services.AddTransient <IUserService, IdentityUserService>();


            services.AddControllers().AddNewtonsoftJson(options =>
                                                        options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);

            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo()
                {
                    Title   = "Async Inn",
                    Version = "v1"
                });
            });
        }
Beispiel #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddControllers();

            // Boilerplate:
            services.AddAuthentication(options =>
            {
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });



            services.AddDbContext <AsyncInnDBContext>(options =>
            {
                // Our DATABASE_URL from js days
                string connectionString = Configuration.GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });

            services.AddTransient <IRoom, RoomRepository>();
            services.AddTransient <IHotels, HotelRepository>();
            services.AddTransient <IAmenity, AmenityRepository>();
            services.AddTransient <IHotelRoom, HotelRoomRepository>();
            services.AddTransient <IUserService, IdentityUserService>();
            services.AddScoped <JwtTokenService>();

            services.AddControllers().AddNewtonsoftJson(options =>
                                                        options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                                                        );

            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1", new OpenApiInfo()
                {
                    Title   = "Async Inn",
                    Version = "v1",
                });
            });

            services.AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddEntityFrameworkStores <AsyncInnDBContext>();
        }
Beispiel #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            // TODO:
            // Insert DBContext here and setup default connection string in appsettings.json
            services.AddDbContext <DiscoveringYouDBContext>(options =>
            {
                string connectionString = Configuration
                                          .GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });

            services
            .AddIdentity <User, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddEntityFrameworkStores <DiscoveringYouDBContext>();

            // TODO:
            // Insert dependency injection here

            services.AddTransient <IGoalRepository, DatabaseGoalRepository>();
            services.AddTransient <IInstanceRepository, DatabaseInstanceRepository>();
            services.AddTransient <IUserRepository, IdentityUserRepository>();
            services.AddTransient <JwtTokenService>();

            // Token creation and authentication injection
            services.AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });
        }
Beispiel #5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddControllers(options =>
            {
                // Equivalent to [Authorize] on every controller
                options.Filters.Add(new AuthorizeFilter());
            })
            .AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            });

            // 3. Register our DbContext with the app
            services.AddDbContext <SchoolDbContext>(options =>
            {
                // Equivalent to DATABASE_URL
                string connectionString = Configuration.GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });

            services
            .AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddEntityFrameworkStores <SchoolDbContext>();

            services.AddTransient <IUserService, IdentityUserService>();
            services.AddScoped <JwtTokenService>(); // Note: note Interface, just the service

            services
            .AddAuthentication(options =>
            {
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });

            services.AddAuthorization(options =>
            {
                options.AddPolicy("create", policy => policy.RequireClaim("permissions", "create"));
                options.AddPolicy("update", policy => policy.RequireClaim("permissions", "update"));
                options.AddPolicy("delete", policy => policy.RequireClaim("permissions", "delete"));
            });

            services.AddTransient <ICourseRepository, DatabaseCourseRepository>();

            // services.AddTransient<IStudentRepository, MemoryStudentRepository>();
            services.AddTransient <IStudentRepository, DatabaseStudentRepository>();

            services.AddTransient <ITechnologyRepository, DatabaseTechnologyRepository>();

            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "DV Enrollment", Version = "v1"
                });

                // Make Auth available in our Swagger definition
                options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    Name   = "Authorization",
                    In     = ParameterLocation.Header,
                    Type   = SecuritySchemeType.ApiKey,
                    Scheme = "Bearer",
                });
                options.OperationFilter <AuthenticationRequirementOperationFilter>();
            });
        }
Beispiel #6
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddControllers(options =>
            {
                // Equivalent to [Authorize] on every controller
                options.Filters.Add(new AuthorizeFilter());
            })
            .AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            });

            // 3. Register DbContext with the app
            services.AddDbContext <HotelDbContext>(options =>
            {
                // DATABASE_URL equivalent
                string connectionString = Configuration.GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });

            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo {
                    Title = "Hotel Docs", Version = "v1"
                });

                options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    Name   = "Authorization",
                    In     = ParameterLocation.Header,
                    Type   = SecuritySchemeType.ApiKey,
                    Scheme = "Bearer",
                });
                options.OperationFilter <AuthenticationRequirementOperationFilter>();
            });

            services.AddTransient <IHotelRepository, DatabaseHotelRepository>();

            services.AddTransient <IAmenityRepository, DatabaseAmenityRepository>();

            services.AddTransient <IHotelRoomRepository, DatabaseHotelRoomRepository>();

            services.AddTransient <IRoomRepository, DatabaseRoomRepository>();

            services
            .AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddEntityFrameworkStores <HotelDbContext>();

            services.AddTransient <IUserService, IdentityUserService>();

            services.AddScoped <JwtTokenService>();

            services.AddAuthentication(options =>
            {
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });

            services.AddAuthorization(options => { });
        }
Beispiel #7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddControllers(options =>
            {
                options.Filters.Add(new AuthorizeFilter());
            })
            .AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            });
            services.AddDbContext <AsyncInnDbContext>(options => {
                // Our DATABASE_URL from js days
                string connectionString = Configuration.GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });

            services
            .AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddEntityFrameworkStores <AsyncInnDbContext>();

            services.AddTransient <IUserService, IdentityUserService>();
            services.AddTransient <JwtTokenService>();

            services.
            AddAuthentication(options =>
            {
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });

            services.AddAuthorization();



            services.AddTransient <IHotel, HotelRepo>();
            services.AddTransient <IAmentity, AmentityRepo>();
            services.AddTransient <IRoom, RoomRepo>();
            services.AddTransient <IHotelRoom, HotelRoomRepo>();
            services.AddSwaggerGen(options =>
            {
                // Make sure get the "using Statement"
                options.SwaggerDoc("v1", new OpenApiInfo()
                {
                    Title   = "Async Inn",
                    Version = "v1",
                });

                options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    Name   = "Authorization",
                    In     = ParameterLocation.Header,
                    Type   = SecuritySchemeType.ApiKey,
                    Scheme = "Bearer,"
                });
                options.OperationFilter <AuthenticationRequirementOperationFilter>();
            });
        }
Beispiel #8
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication(options =>
            {
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });

            services.AddAuthorization(options =>
            {
                options.AddPolicy("create", policy => policy.RequireClaim("permissions", "create"));
                options.AddPolicy("update", policy => policy.RequireClaim("permissions", "update"));
                options.AddPolicy("delete", policy => policy.RequireClaim("permissions", "delete"));
                options.AddPolicy("read", policy => policy.RequireClaim("permissions", "read"));
                options.AddPolicy("send", policy => policy.RequireClaim("permissions", "send"));
            });

            services.AddDbContext <LiteBerryDbContext>(options =>
            {
                string connectionString = Configuration.GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });

            //We are not using email so do we need this
            services.AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = false;
            })
            .AddEntityFrameworkStores <LiteBerryDbContext>();

            services.AddTransient <IUserService, IdentityUserService>();

            services.AddTransient <IActivityLog, ActivityLogRepository>();
            services.AddTransient <IDesign, DesignRepository>();
            services.AddTransient <IUser, UserRepository>();

            services.AddSignalR()
            .AddAzureSignalR();

            services.AddMvc();

            services.AddScoped <JwtTokenService>();

            services.AddControllers().AddNewtonsoftJson(options =>
                                                        options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                                                        );

            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1", new OpenApiInfo()
                {
                    Title   = "LiteBerry",
                    Version = "v1",
                });
            });
        }
Beispiel #9
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <HotelDbContext>(options =>
            {
                string connectionString = Configuration.GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });



            services.AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddEntityFrameworkStores <HotelDbContext>();

            //This registers the Jwt token service which allows us to pass tokens for users after they sign in.
            services.AddScoped <JwtTokenService>();

            //This wires the Authentication for the API it tells the system to always use these schemes to authenticate us
            services.AddAuthentication(options =>
            {
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            { // this tells the authentication scheme how and where to validate the token and secret
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });

            services.AddAuthorization(options =>
            {
                options.AddPolicy("create", policy => policy.RequireClaim("permissions", "create"));
                options.AddPolicy("update", policy => policy.RequireClaim("permissions", "update"));
                options.AddPolicy("delete", policy => policy.RequireClaim("permissions", "delete"));
            });


            //Registers Dependency Injection services
            //Maps Dependency IWhatever(i.e. IRoom) to correct Repository(RoomRepository)

            services.AddTransient <IRoom, RoomRepository>();
            services.AddTransient <IAmenity, AmenityRepository>();
            services.AddTransient <IHotel, HotelRepository>();
            services.AddTransient <IHotelRoom, HotelRoomRepository>();
            services.AddTransient <IUserService, IdentityUserService>();

            // Adds Controllers
            services.AddMvc();
            services.AddControllers();

            services.AddControllers().AddNewtonsoftJson(options =>
                                                        options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                                                        );


            //registers swagger service
            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1", new OpenApiInfo()
                {
                    Title   = "Async Inn",
                    Version = "v1"
                });
            });
        }
Beispiel #10
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers(options =>
            {
                options.Filters.Add(new AuthorizeFilter());
            });

            services.AddControllers()
            // No infinite reference looping here.
            .AddNewtonsoftJson(OptionsBuilderConfigurationExtensions =>
            {
                OptionsBuilderConfigurationExtensions.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            });

            services.AddMvc();
            services.AddControllers();
            // step 3 Register our DbContext
            services.AddDbContext <HotelDbContext>(options =>
            {
                string connectionString = Configuration.GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });

            services
            .AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddEntityFrameworkStores <HotelDbContext>();

            services.AddTransient <IUserService, IdentityUserService>();
            services.AddScoped <JwtTokenService>();
            services.AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });
            services.AddAuthorization(options =>
            {
                options.AddPolicy("create", policy => policy.RequireClaim("permission", "create"));
                options.AddPolicy("update", policy => policy.RequireClaim("permission", "update"));
                options.AddPolicy("delete", policy => policy.RequireClaim("permission", "delete"));
            });

            services.AddTransient <IHotelRepo, DatabaseHotelRepo>();
            services.AddTransient <IRoomRepo, DatabaseRoomRepo>();
            services.AddTransient <IAmenityRepo, DatabaseAmenityRepo>();
            services.AddTransient <IHotelRoom, DatabaseHotelRoomRepo>();

            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Hotel Info", Version = "v1"
                });
                options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    Name   = "Authorization",
                    In     = ParameterLocation.Header,
                    Type   = SecuritySchemeType.ApiKey,
                    Scheme = "Bearer"
                });
                options.OperationFilter <AuthenticationRequrementOperationFilter>();
            });
        }
Beispiel #11
0
        // This is very similar to what dotenv did for us in NodeJS
        public void ConfigureServices(IServiceCollection services)
        {
            // 3. Register our DbContext with the app
            services.AddDbContext <SchoolDbContext>(options =>
            {
                // Equivalent to DATABASE_URI
                string connectionString = Configuration.GetConnectionString("DefaultConnection");
                options.UseSqlServer(connectionString);
            });

            services.AddIdentity <ApplicationUser, IdentityRole>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddEntityFrameworkStores <SchoolDbContext>();

            services.AddScoped <JwtTokenService>();

            // This will eventually allow us to "Decorate" (Annotate) our routes
            services.AddAuthentication(options =>
            {
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = JwtTokenService.GetValidationParameters(Configuration);
            });

            services.AddAuthorization(options =>
            {
                // Add "Name of Policy", and the Lambda returns a definition
                options.AddPolicy("create", policy => policy.RequireClaim("permissions", "create"));
                options.AddPolicy("update", policy => policy.RequireClaim("permissions", "update"));
                options.AddPolicy("delete", policy => policy.RequireClaim("permissions", "delete"));
                options.AddPolicy("deposit", policy => policy.RequireClaim("permissions", "deposit"));
            });

            // Register my Dependency Injection services
            // This mapps the Dependency (IStudent) to the correct Service (StudentRepository)
            // "Whenever I see IStudent, use StudentRepository
            // This makes StudentRepository swappapble with any alternate implementation
            services.AddTransient <ICourse, CourseRepository>();
            services.AddTransient <IStudent, StudentRepository>();
            services.AddTransient <ITechnology, TechnologyRepository>();
            services.AddTransient <IUserService, IdentityUserService>();


            // Bring in our controllers
            services.AddMvc();
            services.AddControllers();


            services.AddControllers().AddNewtonsoftJson(options =>
                                                        options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                                                        );

            services.AddSwaggerGen(options =>
            {
                // Make sure get the "using Statement"
                options.SwaggerDoc("v1", new OpenApiInfo()
                {
                    Title   = "School Demo",
                    Version = "v1",
                });
            });
        }