public ConfigSettingsController(IOptions <AzureAdConfiguration> azureAdConfiguration, IOptions <HearingServicesConfiguration> servicesConfiguration, KinlyConfiguration kinlyConfiguration, ILogger <ConfigSettingsController> logger, IMapperFactory mapperFactory) { _azureAdConfiguration = azureAdConfiguration.Value; _servicesConfiguration = servicesConfiguration.Value; _logger = logger; _mapperFactory = mapperFactory; _kinlyConfiguration = kinlyConfiguration; }
protected BaseServiceTokenHandler(IOptions <AzureAdConfiguration> azureAdConfiguration, IOptions <ServiceConfiguration> serviceConfiguration, IMemoryCache memoryCache, ITokenProvider tokenProvider) { _azureAdConfiguration = azureAdConfiguration.Value; ServiceConfiguration = serviceConfiguration.Value; _memoryCache = memoryCache; _tokenProvider = tokenProvider; }
public VideoServiceTokenHandler( IOptions <AzureAdConfiguration> azureAdConfigurationOptions, IOptions <ServicesConfiguration> servicesSonConfigurationOptions, IMemoryCache memoryCache, IAzureTokenProvider azureTokenProvider) { _azureAdConfiguration = azureAdConfigurationOptions.Value; _servicesConfiguration = servicesSonConfigurationOptions.Value; _memoryCache = memoryCache; _azureTokenProvider = azureTokenProvider; }
public ConfigSettingsController( IOptions <AzureAdConfiguration> azureAdConfiguration, IOptions <KinlyConfiguration> kinlyConfiguration, IOptions <ApplicationInsightsConfiguration> applicationInsightsConfiguration, IOptions <TestUserSecrets> testSettings) { _azureAdConfiguration = azureAdConfiguration.Value; _kinlyConfiguration = kinlyConfiguration.Value; _applicationInsightsConfiguration = applicationInsightsConfiguration.Value; _testUserSecrets = testSettings.Value; }
public TestSettings() { var configRootBuilder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddUserSecrets("f99a3fe8-cf72-486a-b90f-b65c27da84ee"); Security = new AzureAdConfiguration(); var config = configRootBuilder.Build(); config.Bind("AzureAd", Security); }
public void Should_return_response_with_settings() { var azureAdConfiguration = new AzureAdConfiguration { ClientId = "ClientId", TenantId = "TenantId", ClientSecret = "ClientSecret", Authority = "Authority", RedirectUri = "https://vh-admin-web.com", PostLogoutRedirectUri = "https://vh-admin-web.com/" }; var testSettings = new TestUserSecrets { TestUsernameStem = "@hmcts.net" }; var kinlyConfiguration = new KinlyConfiguration { ConferencePhoneNumber = "1111111", JoinByPhoneFromDate = "2021-02-03" }; var applicationInsightsConfiguration = new ApplicationInsightsConfiguration(); var httpContext = new DefaultHttpContext(); httpContext.Request.Scheme = "https"; httpContext.Request.Host = new HostString("vh-admin-web.com"); httpContext.Request.PathBase = ""; var controllerContext = new ControllerContext { HttpContext = httpContext }; var configSettingsController = new ConfigSettingsController( Options.Create(azureAdConfiguration), Options.Create(kinlyConfiguration), Options.Create(applicationInsightsConfiguration), Options.Create(testSettings)) { ControllerContext = controllerContext }; var actionResult = (OkObjectResult)configSettingsController.Get().Result; var clientSettings = (ClientSettingsResponse)actionResult.Value; clientSettings.ClientId.Should().Be(azureAdConfiguration.ClientId); clientSettings.TenantId.Should().Be(azureAdConfiguration.TenantId); clientSettings.RedirectUri.Should().Be(azureAdConfiguration.RedirectUri); clientSettings.PostLogoutRedirectUri.Should().Be(azureAdConfiguration.PostLogoutRedirectUri); clientSettings.ConferencePhoneNumber.Should().Be(kinlyConfiguration.ConferencePhoneNumber); clientSettings.JoinByPhoneFromDate.Should().Be(kinlyConfiguration.JoinByPhoneFromDate); clientSettings.TestUsernameStem.Should().Be(testSettings.TestUsernameStem); }
public static ClientSettingsResponse MapAppConfigurationToResponseModel(AzureAdConfiguration azureAdConfiguration, HearingServicesConfiguration servicesConfiguration) { return(new ClientSettingsResponse { ClientId = azureAdConfiguration.ClientId, TenantId = azureAdConfiguration.TenantId, RedirectUri = azureAdConfiguration.RedirectUri, PostLogoutRedirectUri = azureAdConfiguration.PostLogoutRedirectUri, TestApiUrl = servicesConfiguration.TestApiUrl, AppInsightsInstrumentationKey = azureAdConfiguration.ApplicationInsights.InstrumentationKey, Authority = azureAdConfiguration.Authority }); }
public DistributedTokenCache(IDistributedCache distributedCache, IDataProtectionProvider dataProtectionProvider, IOptionsSnapshot <AzureAdConfiguration> configuration, ClaimsPrincipal claimsPrincipal = null) { _claimsPrincipal = claimsPrincipal; _distributedCache = distributedCache; _dataProtectionProvider = dataProtectionProvider; _azureAdConfiguration = configuration.Value; _dataProtector = dataProtectionProvider.CreateProtector(typeof(DistributedTokenCache).FullName); _key = GenerateKey(claimsPrincipal); BeforeAccess = OnBeforeAccess; AfterAccess = OnAfterAccess; }
public void TestInitialize() { _azureAdConfiguration = new AzureAdConfiguration() { ClientId = "TestClientId", ClientSecret = "TestSecret", Authority = "https://Test/Authority", GraphApiBaseUri = "https://test.windows.net/" }; _tokenProvider = new Mock <ITokenProvider>(); _tokenProvider.Setup(t => t.GetClientAccessToken(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Token); _graphApiSettings = new GraphApiSettings(_tokenProvider.Object, _azureAdConfiguration); }
public AzureConfigBuilder() { _config = new AzureAdConfiguration() { ApplicationInsights = new ApplicationInsightsConfiguration() { InstrumentationKey = ConfigData.APPLICATION_INSIGHTS }, Authority = ConfigData.AUTHORITY, ClientId = ConfigData.CLIENT_ID, ClientSecret = ConfigData.CLIENT_SECRET, PostLogoutRedirectUri = ConfigData.POST_LOGOUT_URL, RedirectUri = ConfigData.REDIRECT_URL, TenantId = ConfigData.TENANT_ID }; }
public void ConfigureServices(IServiceCollection services) { var azureAdConfig = new AzureAdConfiguration(); Configuration.Bind(nameof(AzureAdConfiguration), azureAdConfig); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddAzureAdB2C(azureAdConfig); services.AddCors(); services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/dist"; }); }
private TestConfig() { var configRootBuilder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddUserSecrets <Startup>(); _configuration = configRootBuilder.Build(); AzureAd = new AzureAdConfiguration(); _configuration.GetSection("AzureAd").Bind(AzureAd); VhServices = new VhServices(); _configuration.GetSection("VhServices").Bind(VhServices); TestSettings = new TestSettings(); _configuration.GetSection("Testing").Bind(TestSettings); Settings = new Settings(); _configuration.Bind(Settings); }
public void Should_return_response_with_settings() { var securitySettings = new AzureAdConfiguration { ClientId = "ClientId", ClientSecret = "ClientSecret", TenantId = "TenantId", Authority = "Authority", ApplicationInsights = new ApplicationInsightsConfiguration { InstrumentationKey = "AiKey" } }; var servicesConfiguration = new HearingServicesConfiguration { VideoApiUrl = "https://vh-video-api/" }; var kinlyConfiguration = new KinlyConfiguration { JoinByPhoneFromDate = "2021-02-09" }; var parameters = new ParameterBuilder(_mocker).AddObject(Options.Create(securitySettings)) .AddObject(Options.Create(servicesConfiguration)) .AddObject(kinlyConfiguration).Build(); var configSettingsController = _mocker.Create <ConfigSettingsController>(parameters); var actionResult = (OkObjectResult)configSettingsController.GetClientConfigurationSettings().Result; var clientSettings = (ClientSettingsResponse)actionResult.Value; clientSettings.ClientId.Should().Be(securitySettings.ClientId); clientSettings.TenantId.Should().Be(securitySettings.TenantId); clientSettings.VideoApiUrl.Should().Be(servicesConfiguration.VideoApiUrl); clientSettings.JoinByPhoneFromDate.Should().Be(kinlyConfiguration.JoinByPhoneFromDate); }
public TokenProvider(IOptions <AzureAdConfiguration> azureAdConfiguration) { _azureAdConfiguration = azureAdConfiguration.Value; }
public GraphApiSettings(ITokenProvider tokenProvider, AzureAdConfiguration azureAdConfig) { _tokenProvider = tokenProvider; _azureAdConfiguration = azureAdConfig; }
public AzureTokenProvider(IOptions <AzureAdConfiguration> azureAdConfigurationOptions) { _azureAdConfiguration = azureAdConfigurationOptions.Value; }
public AzureTokenProvider(IOptions <AzureAdConfiguration> environmentConfiguration) { _securitySettings = environmentConfiguration.Value; }
public VhAadScheme(AzureAdConfiguration azureAdConfiguration, string eventhubPath) : base(eventhubPath) { _azureAdConfiguration = azureAdConfiguration; }
public static Task <string> SetDefaultVideoWebBearerToken(AzureAdConfiguration azureAdConfiguration) { return(new TokenProvider(Options.Create(azureAdConfiguration)).GetClientAccessToken( azureAdConfiguration.ClientId, azureAdConfiguration.ClientSecret, azureAdConfiguration.ClientId)); }
public void Setup() { SecureHttpRequest = new Mock <ISecureHttpRequest>(); _settings = new Settings { IsLive = true, ReformEmail = Domain.Replace("@", ""), AdGroup = new AdGroup { Administrator = "Admin", } }; var azureAdConfig = new AzureAdConfiguration() { ClientId = "TestClientId", ClientSecret = "TestSecret", Authority = "https://Test/Authority", }; var tokenProvider = new Mock <ITokenProvider>(); GraphApiSettings = new GraphApiSettings(tokenProvider.Object, azureAdConfig); IdentityServiceApiClient = new Mock <IIdentityServiceApiClient>(); AzureAdGraphUserResponse = new AzureAdGraphUserResponse() { ObjectId = "1", DisplayName = "T Tester", GivenName = "Test", Surname = "Tester", OtherMails = new List <string>(), UserPrincipalName = "TestUser" }; AzureAdGraphQueryResponse = new AzureAdGraphQueryResponse <AzureAdGraphUserResponse> { Value = new List <AzureAdGraphUserResponse> { AzureAdGraphUserResponse } }; var additionalData = new Dictionary <string, object>(); var jobject = new JObject { new JProperty("@odata.type", "#microsoft.graph.group"), new JProperty("startDateTime", DateTime.UtcNow), new JProperty("endDateTime", DateTime.UtcNow.AddYears(1)), new JProperty("secretText", "The passwords must be 16-64 characters in length"), new JProperty("keyId", Guid.NewGuid().ToString()), new JProperty("hint", "something") }; additionalData.Add("value", new List <JObject> { jobject }); DirectoryObject = new DirectoryObject { Id = "1", AdditionalData = additionalData, ODataType = "@odata.type" }; DistributedCache = new Mock <ICache>(); Service = new UserApi.Services.UserAccountService(SecureHttpRequest.Object, GraphApiSettings, IdentityServiceApiClient.Object, _settings, DistributedCache.Object); }
public ConfigSettingsController(IOptions <AzureAdConfiguration> azureAdConfiguration, IOptions <HearingServicesConfiguration> servicesConfiguration) { _azureAdConfiguration = azureAdConfiguration.Value; _servicesConfiguration = servicesConfiguration.Value; }
public TokenProvider(AzureAdConfiguration azureAdConfiguration) { _azureAdConfiguration = azureAdConfiguration; }
public GraphClient(ITokenProvider tokenProvider, ILogger <GraphClient> logger, IOptionsSnapshot <AzureAdConfiguration> azureAdConfiguration) { _tokenProvider = tokenProvider; _logger = logger; _azureAdConfiguration = azureAdConfiguration.Value; }
private async Task <AuthenticationContext> CreateAuthenticationContext(AzureAdConfiguration adOptions, ClaimsPrincipal claimsPrincipal = null) { return(new AuthenticationContext( adOptions.Authority, await _tokenCacheProvider.GetCacheAsync(claimsPrincipal))); }
public AuthController(IRootConfigurationProvider rootConfigurationProvider) { // Get from config azureAdOptions = rootConfigurationProvider.AzureAdConfiguration; }