public QueryService(ITypeDiscoverer typeDiscoverer, IContainer container, IQueryCoordinator queryCoordinator, WebConfiguration configuration) { _typeDiscoverer = typeDiscoverer; _container = container; _queryCoordinator = queryCoordinator; _configuration = configuration; }
public ForgotPasswordViewModelBuilder( WebConfiguration webConfiguration, IDictionary <string, string[]> queryString) { _webConfiguration = webConfiguration; _queryString = queryString; }
private static ExcelWorksheet GenerateWorksheet(List <CertificateResponse> certificates) { var aggregrateLogger = new Mock <IAggregateLogger>(); var fileTransferClient = new Mock <IFileTransferClient>(); var webConfig = new WebConfiguration() { CertificateDetails = new CertificateDetails() { ChairName = "Dave", ChairTitle = "Lord" } }; var spreadsheetCreator = new PrintingSpreadsheetCreator(aggregrateLogger.Object, fileTransferClient.Object, webConfig); MemoryStream spreadsheetStream = null; fileTransferClient.Setup(h => h.Send(It.IsAny <MemoryStream>(), It.IsAny <string>())) .Callback <MemoryStream, string>((stream, filename) => { spreadsheetStream = stream; }); spreadsheetCreator.Create(1, certificates); spreadsheetStream.Should().NotBeNull(); var newStream = new MemoryStream(spreadsheetStream.ToArray()); var excelPackage = new ExcelPackage(newStream); var worksheet = excelPackage.Workbook.Worksheets.Single(); return(worksheet); }
public IEnumerable <string> Get() { var t = optionsAccessor.ApiName; var config = WebConfiguration.Insance(); return(new string[] { "value1", "value2" }); }
public async Task Then_If_Returns_Bad_Request_An_Exception_Is_Thrown( WebConfiguration webConfiguration, Mock <IAzureClientCredentialHelper> azureClientCredentialHelper) { //Arrange var baseUrl = "https://localhost"; var configuration = new ProvideFeedbackApiConfiguration { Url = baseUrl }; var response = new HttpResponseMessage { Content = new StringContent(""), StatusCode = HttpStatusCode.BadRequest }; webConfiguration.ProvideFeedbackApiConfiguration = configuration; var expectedUrl = $"{baseUrl}/api/feedback"; var httpMessageHandler = SetupMessageHandlerMock(response, new Uri(expectedUrl)); var client = new HttpClient(httpMessageHandler.Object); var service = new ProvideFeedbackService(webConfiguration, client, azureClientCredentialHelper.Object); //Act Assert Assert.ThrowsAsync <HttpRequestException>(() => service.GetProviderFeedBack()); }
/// <summary>重新加载</summary> private void Reload() { this.configuration = WebConfigurationView.Instance.Configuration; this.m_CustomizeManagement = new CustomizeManagement(); this.m_NavigationManagement = new NavigationManagement(); this.m_MenuManagement = new MenuManagement(); if (WebConfigurationView.Instance.Layout == "EnterprisePortalPlatform") { // 自定义页面 m_CustomizeBuilder = new Layouts.EnterprisePortalPlatform.CustomizeBuilder(); // 导航 m_NavigationBuilder = new Layouts.EnterprisePortalPlatform.NavigationBuilder(); // 菜单 m_MenuBuilder = new Layouts.EnterprisePortalPlatform.MenuBuilder(); } else { // 自定义页面 m_CustomizeBuilder = new Layouts.CollaborationPlatform.CustomizeBuilder(); // 导航 m_NavigationBuilder = new Layouts.CollaborationPlatform.NavigationBuilder(); // 菜单 m_MenuBuilder = new Layouts.CollaborationPlatform.MenuBuilder(); } }
public void Setup() { _configuration = new WebConfiguration { EmployerAccountsConfiguration = new EmployerAccountsConfiguration { EmployerAccountsBaseUrl = "https://localhost:44344" } }; var dependancyResolver = new Mock <IDependencyResolver>(); dependancyResolver.Setup(r => r.GetService(typeof(IWebConfiguration))).Returns(_configuration); DependencyResolver.SetResolver(dependancyResolver.Object); var routes = new RouteCollection(); var request = new Mock <HttpRequestBase>(MockBehavior.Strict); var response = new Mock <HttpResponseBase>(MockBehavior.Strict); var context = new Mock <HttpContextBase>(MockBehavior.Strict); context.SetupGet(x => x.Request).Returns(request.Object); context.SetupGet(x => x.Response).Returns(response.Object); var routeData = new RouteData(); _urlHelper = new UrlHelper(new RequestContext(context.Object, routeData), routes); }
protected void Setup() { var config = new WebConfiguration() { Authentication = new AuthSettings() { Role = "EPA" } }; var contextAccessor = new Mock <IHttpContextAccessor>(); contextAccessor.SetupGet(a => a.HttpContext.User.Claims).Returns(new List <Claim> { new Claim("http://schemas.portal.com/ukprn", "12345678"), new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn", "username"), new Claim("http://schemas.portal.com/mail", "*****@*****.**"), new Claim("http://schemas.portal.com/displayname", "Mr Jones"), new Claim("http://schemas.portal.com/service", "EPA"), new Claim("http://schemas.portal.com/service", "CSA") }); OrganisationsApiClient = new Mock <IOrganisationsApiClient>(); LoginApiClient = new Mock <ILoginApiClient>(); //LoginOrchestrator = new Orchestrators.Login.LoginOrchestrator(new Mock<ILogger<Orchestrators.Login.LoginOrchestrator>>().Object, contextAccessor.Object, // LoginApiClient.Object); }
public void Setup() { _unit = new WebConfiguration { EmployerUsersApi = new EmployerUsersApiConfiguration { ApiBaseUrl = "--- configuration value goes here ---", ClientId = "00000000-0000-0000-0000-000000000000", ClientSecret = "--- configuration value goes here ---", IdentifierUri = "--- configuration value goes here ---", Tenant = "--- configuration value goes here ---", ClientCertificateThumbprint = "--- configuration value goes here ---" }, SiteValidator = new SiteValidatorSettings { Audience = "--- configuration value goes here ---", Scope = "--- configuration value goes here ---", Tenant = "--- configuration value goes here ---" }, AccountApi = new AccountApiConfiguration() { Tenant = "--- configuration value goes here ---", ApiBaseUrl = "--- configuration value goes here ---", ClientId = "00000000-0000-0000-0000-000000000000", ClientSecret = "--- configuration value goes here ---", IdentifierUri = "--- configuration value goes here ---" } }; }
private static PrintOutput GenerateJson(List <CertificateResponse> certificates) { var aggregrateLogger = new Mock <IAggregateLogger>(); var fileTransferClient = new Mock <IFileTransferClient>(); var webConfig = new WebConfiguration() { CertificateDetails = new CertificateDetails() { ChairName = "Dave", ChairTitle = "Lord" } }; var spreadsheetCreator = new PrintingJsonCreator(aggregrateLogger.Object, fileTransferClient.Object, webConfig); MemoryStream spreadsheetStream = null; fileTransferClient.Setup(h => h.Send(It.IsAny <MemoryStream>(), It.IsAny <string>())) .Callback <MemoryStream, string>((stream, filename) => { spreadsheetStream = stream; }); spreadsheetCreator.Create(1, certificates, "filename.json"); spreadsheetStream.Should().NotBeNull(); var newStream = new MemoryStream(spreadsheetStream.ToArray()); return(JsonConvert.DeserializeObject <PrintOutput>(System.Text.Encoding.Default.GetString(newStream.ToArray()))); }
public void Setup() { _unit = new WebConfiguration { ElasticSearch = new ElasticSearchSettings { IndexName = "--- configuration value goes here ---", ServerUrls = "--- configuration value goes here ---", ElasticUsername = "******", ElasticPassword = "******", Elk5Enabled = true, IgnoreSslCertificateEnabled = true, IndexShards = 1, IndexReplicas = 0 }, Site = new SiteSettings { BaseUrls = "https://127.0.0.1:51274,https://127.0.0.1:19722", DelayTimeInSeconds = "1800" }, SiteConnector = new SiteConnectorSettings { ClientId = "--- configuration value goes here ---", ClientSecret = "--- configuration value goes here ---", IdentifierUri = "--- configuration value goes here ---", Tenant = "--- configuration value goes here ---" } }; }
public Clients(WebConfiguration host) { this._host = host; string baseUrl = "http://" + host.Host; string baseUrls = "https://" + host.Host; this._clients = new List <Client> { new Client { ClientId = "bookstore.orders", ClientName = "Order Service", Description = "Bookstore Order Service", ClientSecrets = new List <Secret> { new Secret("secret".Sha256()) }, RequirePkce = false, AllowAccessTokensViaBrowser = true, AllowedCorsOrigins = new List <string> { baseUrl + ":6001", baseUrls }, AllowedScopes = new List <string> { "openid", "profile", "email" }, AllowedGrantTypes = GrantTypes.Code, AllowOfflineAccess = true, RequireConsent = false, Enabled = true, EnableLocalLogin = true, RedirectUris = new List <string> { baseUrl + ":6001/callback", baseUrls + "/callback" }, PostLogoutRedirectUris = new List <string> { baseUrl + ":6001", baseUrls, baseUrls + "/signout-callback" } }, new Client { ClientId = "postman", ClientName = "Postman", Description = "Postman Credentials", ClientSecrets = new List <Secret> { new Secret("secret".Sha256()) }, RequirePkce = false, AllowedScopes = new List <string> { "openid", "profile", "email", "bookstore.orders" }, AllowedGrantTypes = GrantTypes.ClientCredentials, Enabled = true } }; }
public CommandProxies(ITypeDiscoverer typeDiscoverer, ITypeImporter typeImporter, ICodeGenerator codeGenerator, WebConfiguration configuration) { _typeDiscoverer = typeDiscoverer; _typeImporter = typeImporter; _codeGenerator = codeGenerator; _configuration = configuration; }
public UserAgentHelper(WebConfiguration config, IHttpContextAccessor httpContextAccessor, ICustomFileProvider fileProvider) { _config = config; _httpContextAccessor = httpContextAccessor; _fileProvider = fileProvider; }
public Configuration() { Windows = new WindowsConfiguration(this); Android = new AndroidConfiguration(this); iOS = new iOSConfiguration(this); MacOS = new MacOSConfiguration(this); Web = new WebConfiguration(this); }
public static IConfigure Web(this IFrontendConfiguration configuration, Action <WebConfiguration> configureCallback) { var webConfiguration = new WebConfiguration(Configure.Instance.Container.Get <NamespaceMapper>()); Configure.Instance.Container.Bind <WebConfiguration>(webConfiguration); configuration.Target = webConfiguration; configureCallback(webConfiguration); return(Configure.Instance); }
public StormpathConfiguration( ClientConfiguration client = null, ApplicationConfiguration application = null, WebConfiguration web = null) { this.Client = new ClientConfiguration(client ?? Default.Configuration.Client); this.Application = new ApplicationConfiguration(application ?? Default.Configuration.Application); this.Web = new WebConfiguration(web ?? Default.Configuration.Web); }
public ActionResult Index() { var webconfigdev = WebConfiguration.Instance().UserName; var webconfigprod = WebConfiguration.Instance("ProdUS").UserName; var webconfiglocal = WebConfiguration.Instance("Local").UserName; return(View()); }
private WardNode(WardNodeConfiguration configuration, WebConfiguration webConfiguration) { _configuration = configuration; _webConfiguration = webConfiguration; Patients = new ObservableCollection <Patient>(); StartNode(); }
private static IWebHost BuildWebHost(string[] args) { var config = new WebConfiguration(WebConstants.ConfigPath); return(WebHost.CreateDefaultBuilder(args) .UseNLog() .UseStartup <Startup>() .UseUrls(config.ServerUrls) .Build()); }
public CommandSecurityProxies( ITypeDiscoverer typeDiscoverer, ICodeGenerator codeGenerator, ICommandSecurityManager commandSecurityManager, WebConfiguration configuration) { _typeDiscoverer = typeDiscoverer; _codeGenerator = codeGenerator; _configuration = configuration; _commandSecurityManager = commandSecurityManager; }
public HttpService(ILogger logger, WebConfiguration appConfiguration) { this.logger = logger; this.listenHostPort = appConfiguration.WebServiceHostPort; this.rewriteLocalhost = appConfiguration.RewriteLocalhost; StaticConfiguration.DisableErrorTraces = appConfiguration.DisableErrorTraces; this.diagnosticsPath = appConfiguration.DiagnosticsPath; this.diagnosticsPassword = appConfiguration.DiagnosticsPassword; }
protected AbstractClientProvider(WebConfiguration ccRoot, OAuthSettingsConfig ccOauth) { ClientId = ccOauth.ClientId; ClientSecret = ccOauth.ClientSecret; CallBackUrl = ccOauth.CallbackUrl; Scope = ccOauth.Scope; Endpoint = ccOauth.Endpoint; AcceptedRedirectUrl = ccRoot.AcceptedRedirectUrl; FailedRedirectUrl = ccRoot.FailedRedirectUrl; Proxy = ccRoot.Proxy; }
public void Arrange() { var config = new WebConfiguration() { Authentication = new AuthSettings() { Role = "EPA" } }; OrgQueryRepository = new Mock <IOrganisationQueryRepository>(); ContactQueryRepository = new Mock <IContactQueryRepository>(); var roles = new List <ContactRole> { new ContactRole { RoleName = "SuperUser" } }; ContactQueryRepository.Setup(r => r.GetBySignInId(It.IsNotIn(Guid.Empty))) .Returns(Task.FromResult(new Contact() { Id = It.IsAny <Guid>(), Status = ContactStatus.Live, OrganisationId = It.IsAny <Guid>(), Username = "******", Email = "*****@*****.**" })); ContactQueryRepository.Setup(r => r.GetBySignInId(Guid.Empty)) .Returns(Task.FromResult(new Contact() { Id = Guid.Empty, Status = ContactStatus.InvitePending, OrganisationId = It.IsAny <Guid>(), Username = "******", Email = "*****@*****.**" })); ContactQueryRepository.Setup(r => r.GetRolesFor(It.IsAny <Guid>())).ReturnsAsync(roles); OrgQueryRepository.Setup(r => r.Get(It.IsAny <Guid>())).ReturnsAsync(new Organisation { EndPointAssessorName = "SomeName", EndPointAssessorUkprn = 12345, Id = It.IsAny <Guid>(), Status = OrganisationStatus.New }); ContactRepository = new Mock <IContactRepository>(); ContactRepository.Setup(x => x.UpdateUserName(It.IsAny <Guid>(), It.IsAny <string>())).Returns(Task.FromResult(default(object))); RegisterRepository = new Mock <IRegisterRepository>(); RegisterRepository.Setup(m => m.UpdateEpaOrganisationPrimaryContact(It.IsAny <Guid>(), It.IsAny <string>())).Returns(Task.FromResult(default(object))); Handler = new LoginHandler(new Mock <ILogger <LoginHandler> >().Object, config, OrgQueryRepository.Object, ContactQueryRepository.Object, ContactRepository.Object, RegisterRepository.Object); }
public void Setup() { AutoMapperConfig.CreateMaps(); var server = new Mock <HttpServerUtilityBase>(); server.Setup(s => s.MapPath(It.IsAny <string>())).Returns <string>(x => x); var configuration = WebConfiguration.Load(server.Object); _homeController = new HomeController(configuration, new Mock <ILog>().Object, null); _contentController = new ContentController(configuration); }
public QueryService( ITypeFinder typeFinder, IContainer container, IQueryCoordinator queryCoordinator, WebConfiguration configuration, ILogger logger) { _typeFinder = typeFinder; _container = container; _queryCoordinator = queryCoordinator; _configuration = configuration; _logger = logger; }
public Startup(IConfiguration configuration) { Configuration = configuration; //Alternative way to deserialize settings _configuration = configuration.Get <WebConfiguration>(o => o.BindNonPublicProperties = true); var configurationFromFile = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.Development.json") .Build(); }
public CommandSecurityProxies( ITypeFinder typeFinder, ICodeGenerator codeGenerator, ICommandSecurityManager commandSecurityManager, IApplicationResources applicationResources, WebConfiguration configuration) { _typeFinder = typeFinder; _codeGenerator = codeGenerator; _configuration = configuration; _applicationResources = applicationResources; _commandSecurityManager = commandSecurityManager; }
public void SetUp() { _predicates.Clear(); _predicates.Add(x => false); Fake.ClearConfiguration(_responseFactory); Fake.ClearRecordedCalls(_responseFactory); Fake.ClearConfiguration(_handler); Fake.ClearRecordedCalls(_handler); _sut = new WebConfiguration( _predicates, _responseFactory, _handler); }
public void Setup() { _unit = new WebConfiguration { Authentication = new AuthSettings { Realm = "--- configuration value goes here ---", AdfsMetadata = "--- configuration value goes here ---" }, Challenge = new ChallengeSettings { ChallengeTimeoutMinutes = 3 }, Crypto = new CryptoSettings { Secret = "--- configuration value goes here ---", Salt = "--- configuration value goes here ---" }, ElasticSearch = new ElasticSearchSettings { IndexName = "--- configuration value goes here ---", ServerUrls = "--- configuration value goes here ---", ElasticUsername = "******", ElasticPassword = "******", Elk5Enabled = true, IgnoreSslCertificateEnabled = true, IndexShards = 1, IndexReplicas = 0 }, Roles = new RoleSettings { ConsoleUserRole = "--- configuration value goes here ---", ForceT2UserLocally = true, GroupClaim = "--- configuration value goes here ---", T2Role = "--- configuration value goes here ---", Tier2Claim = "--- configuration value goes here ---" }, Site = new SiteSettings { BaseUrls = "https://127.0.0.1:51274,https://127.0.0.1:19722" }, SiteConnector = new SiteConnectorSettings { ClientId = "--- configuration value goes here ---", ClientSecret = "--- configuration value goes here ---", IdentifierUri = "--- configuration value goes here ---", Tenant = "--- configuration value goes here ---" } }; }
public DefaultRegistry() { Scan( scan => { scan.TheCallingAssembly(); scan.WithDefaultConventions(); scan.With(new ControllerConvention()); }); WebConfiguration configuration = GetConfiguration(); For <IWebConfiguration>().Use(configuration); For <IAccountApiConfiguration>().Use(configuration.AccountApi); For <ISiteValidatorSettings>().Use(configuration.SiteValidator); }
/// <summary> /// Loads this class form the given configuration node. /// </summary> /// <param name="node">The node.</param> public void LoadFromXml( XmlNode node ) { if ( node != null ) { XmlHelper.ReadAttribute( out applicationRegistryKeyName, node.Attributes[@"applicationRegistryKeyName"] ); XmlHelper.ReadAttribute( out administratorEMailAddress, node.Attributes[@"administratorEMailAddress"] ); XmlHelper.ReadAttribute( out disableLoggingPasswordProtection, node.Attributes[@"disableLoggingPasswordProtection"], false ); XmlHelper.ReadAttribute( out smtpServer, node.Attributes[@"smtpServer"] ); XmlHelper.ReadAttribute( out smtpServerPort, node.Attributes[@"smtpServerPort"] ); XmlHelper.ReadAttribute( out smtpServerUserName, node.Attributes[@"smtpServerUserName"] ); XmlHelper.ReadAttribute( out smtpServerPassword, node.Attributes[@"smtpServerPassword"] ); string s; XmlHelper.ReadAttribute( out s, node.Attributes[@"deletedFilesFolderPath"] ); if ( !string.IsNullOrEmpty( s ) ) { deletedFilesFolderPath = new DirectoryInfo( s ); } // -- XmlNode databaseNode = node.SelectSingleNode( @"database" ); if ( databaseNode != null ) { string connectionStringString = null; int commandTimeoutSeconds = 0; bool traceSqlEnabled = false; string cacheSqlBehaviorText = null; DatabaseConfiguration.DatabaseCacheSqlBehavior cacheSqlBehavior = DatabaseConfiguration.DatabaseCacheSqlBehavior.Partially; XmlHelper.ReadAttribute( out connectionStringString, databaseNode.Attributes[@"connectionString"] ); XmlHelper.ReadAttribute( out commandTimeoutSeconds, databaseNode.Attributes[@"commandTimeoutSeconds"] ); XmlHelper.ReadAttribute( out cacheSqlBehaviorText, databaseNode.Attributes[@"cacheSqlBehavior"] ); if ( !string.IsNullOrEmpty( cacheSqlBehaviorText ) ) { cacheSqlBehavior = (DatabaseConfiguration.DatabaseCacheSqlBehavior) Enum.Parse( typeof( DatabaseConfiguration.DatabaseCacheSqlBehavior ), cacheSqlBehaviorText, true ); } XmlHelper.ReadAttribute( out traceSqlEnabled, databaseNode.Attributes[@"traceSqlEnabled"] ); database = new DatabaseConfiguration( connectionStringString, commandTimeoutSeconds, cacheSqlBehavior, traceSqlEnabled ); } // -- XmlNode webNode = node.SelectSingleNode( @"web" ); if ( webNode != null ) { bool useServerSideViewState = false; string replaceTildeFallback = null; string replaceTildeCompleteFallback = null; bool useCustomErrors = false; XmlHelper.ReadAttribute( out useServerSideViewState, webNode.Attributes[@"useServerSideViewState"] ); XmlHelper.ReadAttribute( out replaceTildeFallback, webNode.Attributes[@"replaceTildeFallback"] ); XmlHelper.ReadAttribute( out replaceTildeCompleteFallback, webNode.Attributes[@"replaceTildeCompleteFallback"] ); XmlHelper.ReadAttribute( out useCustomErrors, webNode.Attributes[@"useCustomErrors"] ); web = new WebConfiguration( useServerSideViewState, replaceTildeFallback, replaceTildeCompleteFallback, useCustomErrors ); } // -- /* <webProxy address="" bypassProxyOnLocal="" > <credentials domain="" userName="" password="" /> <bypassList> <bypass rx="" /> <bypass rx="" /> <bypass rx="" /> <bypass rx="" /> </bypassList> </webProxy> */ XmlNode webProxyNode = node.SelectSingleNode( @"webProxy" ); if ( webProxyNode != null ) { bool hasEnabled = false; bool enabled = false; string address = null; bool hasBypassProxyOnLocal = false; bool bypassProxyOnLocal = false; hasEnabled = webProxyNode.Attributes[@"enabled"] != null; XmlHelper.ReadAttribute( out enabled, webProxyNode.Attributes[@"enabled"] ); XmlHelper.ReadAttribute( out address, webProxyNode.Attributes[@"address"] ); hasBypassProxyOnLocal = webProxyNode.Attributes[@"bypassProxyOnLocal"] != null; XmlHelper.ReadAttribute( out bypassProxyOnLocal, webProxyNode.Attributes[@"bypassProxyOnLocal"] ); // If no address is given, ignore everything else. if ( hasEnabled && enabled && !string.IsNullOrEmpty( address ) ) { WebProxy webProxy = new WebProxy(); webProxy.Address = new Uri( address ); if ( hasBypassProxyOnLocal ) { webProxy.BypassProxyOnLocal = bypassProxyOnLocal; } XmlNode credentialsNode = webProxyNode.SelectSingleNode( @"credentials" ); if ( credentialsNode != null ) { string domain = null; string userName = null; string password = null; XmlHelper.ReadAttribute( out domain, credentialsNode.Attributes[@"domain"] ); XmlHelper.ReadAttribute( out userName, credentialsNode.Attributes[@"userName"] ); XmlHelper.ReadAttribute( out password, credentialsNode.Attributes[@"password"] ); // If no user name is given, ignore the credentials. if ( userName != null && userName.Length > 0 ) { NetworkCredential credentials = new NetworkCredential(); credentials.UserName = userName; credentials.Password = password; credentials.Domain = domain; webProxy.Credentials = credentials; } } XmlNodeList bypassNodes = webProxyNode.SelectNodes( @"bypassList/bypass" ); if ( bypassNodes != null && bypassNodes.Count > 0 ) { List<string> bypassRXs = new List<string>(); foreach ( XmlNode bypassNode in bypassNodes ) { string rx = null; XmlHelper.ReadAttribute( out rx, bypassNode.Attributes[@"rx"] ); if ( rx != null && rx.Length > 0 ) { bypassRXs.Add( rx ); } } if ( bypassRXs.Count > 0 ) { webProxy.BypassList = bypassRXs.ToArray(); } } this.webProxy = webProxy; } } } }