public SecondStepLogin() { InitializeComponent(); this.AuthenticationCommand = new MockAuthenticationCommand(); this.OrganizationMembershipManagementQuery = new MockOrganizationMembershipManagementQuery(); }
public AuthenticationController(IAuthenticationCommand authenticationCommand, IAuthenticationQuery authenticationQuery, IOrganizationMembershipManagementQuery organizationMembershipManagementQuery) { _authenticationCommand = authenticationCommand; _authenticationQuery = authenticationQuery; _organizationMembershipManagementQuery = organizationMembershipManagementQuery; }
public FirstStepLogin() { InitializeComponent(); if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { return; } AuthenticationCommand = new MockAuthenticationCommand(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(options => options.ModelValidatorProviders.Clear()).SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" }); var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme { In = ParameterLocation.Header, Description = "Please insert JWT with Bearer into field", Name = "Authorization", Type = SecuritySchemeType.ApiKey }); c.AddSecurityRequirement(new OpenApiSecurityRequirement { { new OpenApiSecurityScheme { Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "Bearer" } }, new string[] { } } }); }); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddFromConfigurationFile(Configuration.GetSection("Services")); ServiceProvider serviceProvider = services.BuildServiceProvider(); IAuthenticationCommand authenticationCommand = serviceProvider.GetService <IAuthenticationCommand>(); IAuthenticationQuery authenticationQuery = serviceProvider.GetService <IAuthenticationQuery>(); IAuthenticationInformation authenticationInformation = serviceProvider.GetService <IAuthenticationInformation>(); services.AddControllers(config => { config.Filters.Add(new AuthenticationFilter(authenticationInformation, authenticationCommand, authenticationQuery)); config.Filters.Add(new ActionFilterExample()); }); var mappingConfig = new MapperConfiguration(mc => { mc.AddProfile(new UserManagementMappingProfile()); mc.AddProfile(new CustomerManagementMappingProfile()); mc.AddProfile(new OrganizationManagementMappingProfile()); mc.AddProfile(new OrganizationMembershipManagementMappingProfile()); }); IMapper mapper = mappingConfig.CreateMapper(); services.AddSingleton(mapper); }
public AuthenticationFilter(IAuthenticationInformation authenticationInformation, IAuthenticationCommand authenticationCommand, IAuthenticationQuery authenticationQuery) { _authenticationCommand = authenticationCommand; _authenticationQuery = authenticationQuery; _authenticationInformation = authenticationInformation; }