/// <summary> /// Builds a <see cref="ServiceProviderConfig"/> based on the current builder properties. /// </summary> /// <returns>A <see cref="ServiceProviderConfig"/>.</returns> public ServiceProviderConfig Build() { var config = new ServiceProviderConfig(); config.AuthenticationContextComparison = _authenticationContextComparison; config.Id = _id; config.NameIdFormatAllowCreate = _nameIdFormatAllowCreate; config.Server = _server; if (_signingCertificate != null) { config.SigningCertificate = _signingCertificate; } foreach (var authenticationContext in _authenticationContexts) { config.AuthenticationContexts.Add(authenticationContext); } foreach (var endpoint in _endpoints) { config.Endpoints.Add(endpoint); } foreach (var nameIdFormat in _nameIdFormats) { config.NameIdFormats.Add(nameIdFormat); } return(config); }
/// <summary> /// Configures the service provider. /// </summary> /// <param name="predicate">The service provider configuration.</param> /// <returns>The <see cref="Saml2ConfigBuilder"/>.</returns> public Saml2ConfigBuilder WithServiceProvider(Action <ServiceProviderConfigBuilder> predicate) { var builder = new ServiceProviderConfigBuilder(); predicate(builder); _serviceProviderConfig = builder.Build(); return(this); }
public async Task TestServiceProviderConfigEndpoint() { string json = Helpers.ReadExternalJsonFile("GeneralEndpoints", "ServiceProviderConfig.json"); IKudosApi kudos = new KudosApi(null, Helpers.PrepareHttpClient(json)); ServiceProviderConfig config = await kudos.GetServiceProviderConfigsAsync(); Assert.IsNotNull(config); }
static void Main(string[] args) { try { //setup our DI ServiceProviderConfig.getServiceProvider(); var serviceProvider = new ServiceCollection() .AddSingleton <IEdifactParser, EdifactParserImpl>() .BuildServiceProvider(); //// add StructureMap //var container = new Container(); //container.Configure(config => //{ // // Register stuff in container, using the StructureMap APIs... // config.Scan(_ => // { // _.AssemblyContainingType(typeof(Program)); // _.WithDefaultConventions(); // }); // // Populate the container using the service collection // config.Populate(services); //}); EdifactController edifactController = new EdifactController(serviceProvider); var result = edifactController.getLOCColums("UNA:+.? 'UNB+UNOC:3+2021000969+4441963198+180525:1225+3VAL2MJV6EH9IX+KMSV7HMD+CUSDECU-IE++1++1'UNH+EDIFACT+CUSDEC:D:96B:UN:145050'BGM+ZEM:::EX+09SEE7JPUV5HC06IC6+Z'LOC+17+IT044100'LOC+18+SOL'LOC+35+SE'LOC+36+TZ'LOC+116+SE003033'DTM+9:20090527:102'DTM+268:20090626:102'DTM+182:20090527:102'"); Console.WriteLine("Second element of each LOC row"); foreach (string s in result.secondColumn) { Console.WriteLine(s); } Console.WriteLine(); Console.WriteLine("Third element of each LOC row"); foreach (string s in result.thirdColumn) { Console.WriteLine(s); } Console.ReadKey(); } catch (Exception ex) { Console.WriteLine(ex); } }
public HttpResponseMessage Get(HttpRequestMessage request) { // change values as needed ServiceProviderConfig config = new ServiceProviderConfig(); config.schemas = new List <string>(); config.schemas.Add("urn:scim:schemas:core:2.0:ServiceProviderConfig"); config.documentationUrl = "http://example.com/help/scim.html"; config.patch.supported = true; config.bulk.supported = true; config.bulk.maxOperations = 1000; config.bulk.maxPayloadSize = 1048576; config.filter.supported = true; config.filter.maxResults = 200; config.changePassword.supported = false; config.sort.supported = true; config.etag.supported = true; config.authenticationSchemes.Add(new AuthenticationScheme { name = "OAuth Bearer Token", description = "Authentication Scheme using the OAuth Bearer Token Standard", specUrl = "http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-01", documentationUrl = "http://example.com/help/oauth.html", type = "oauthbearertoken", primary = true }); config.authenticationSchemes.Add(new AuthenticationScheme { name = "HTTP Basic", description = "Authentication Scheme using the Http Basic Standard", specUrl = "http://www.ietf.org/rfc/rfc2617.txt", documentationUrl = "http://example.com/help/httpBasic.html", type = "httpbasic" }); config.meta = new ServiceProviderConfigMeta { location = "https://example.com/v2/ServiceProviderConfig", resourceType = "", created = "", lastModified = "", version = "" }; return(request.CreateResponse(HttpStatusCode.OK, config)); }
/// <summary> /// Validates the <see cref="ServiceProviderConfig"/>. /// </summary> /// <param name="config">The <see cref="ServiceProviderConfig"/>.</param> public void ValidateServiceProviderConfig(ServiceProviderConfig config) { if (config.AuthenticationContexts == null) { throw new Saml20ConfigurationException("Configuration ServiceProvider AuthenticationContexts cannot be null"); } if (config.Endpoints == null) { throw new Saml20ConfigurationException("Configuration ServiceProvider Endpoints cannot be null"); } foreach (var endpoint in config.Endpoints) { if (string.IsNullOrEmpty(endpoint.LocalPath)) { throw new Saml20ConfigurationException("Configuration ServiceProvider Endpoint LocalPath cannot be null or empty"); } } if (string.IsNullOrEmpty(config.Id)) { throw new Saml20ConfigurationException("Configuration ServiceProvider Id cannot be null or empty"); } if (config.NameIdFormats == null) { throw new Saml20ConfigurationException("Configuration ServiceProvider NameIdFormats cannot be null"); } if (string.IsNullOrEmpty(config.Server)) { throw new Saml20ConfigurationException("Configuration ServiceProvider Server cannot be null or empty"); } if (config.SigningCertificate != null) { if (string.IsNullOrEmpty(config.SigningCertificate.FindValue)) { throw new Saml20ConfigurationException("Configuration ServiceProvider SigningCertificate FindValue cannot be null or empty"); } } }
private static async Task MainAsync() { IKudosApi kudos; kudos = new KudosApi(AuthorizationToken); // Use the following to monitor through Fiddler. HttpClientHandler clientHandler = new HttpClientHandler() { CookieContainer = new CookieContainer(), Proxy = new WebProxy("http://localhost:8888", false), UseProxy = true, UseDefaultCredentials = false }; //kudos = new KudosApi(AuthorizationToken, new HttpClient(clientHandler)); ServiceProviderConfig config = await kudos.GetServiceProviderConfigsAsync(); Console.WriteLine(config.DocumentationUrl); await UserEndpoint(kudos); await GroupEndpoint(kudos); }
public void Configure(IApplicationBuilder app /*, IHostingEnvironment env, ILoggerFactory loggerFactory*/) { //loggerFactory.AddConsole(Configuration.GetSection("Logging")); //loggerFactory.AddDebug(); app.UseApplicationInsightsRequestTelemetry(); //if (env.IsDevelopment()) //{ // app.UseDeveloperExceptionPage(); // app.UseBrowserLink(); //} //else //{ // app.UseExceptionHandler("/Home/Error"); //} app.UseApplicationInsightsExceptionTelemetry(); // Configure Session. app.UseSession(); app.UseStaticFiles(); app.UseMvcWithDefaultRoute(); ServiceProviderConfig.InitializeMusicStoreDatabaseAsync(app.ApplicationServices).Wait(); }
public static IServiceProvider GetServiceProvider(IServiceCollection services) { ServiceProviderConfig.RegisterServiceMethod = RegisterTypes; return(ServiceProviderConfig.InitServiceProvider(services)); }
public static void RegisterServices(IServiceCollection services) { ServiceProviderConfig.RegisterServiceMethod = RegisterTypes; ServiceProviderConfig.RegisterServices(services); ContainerManager.DefaultServiceCollection = services; }
public static IServiceProvider GetServiceProvider(IServiceCollection services) { return(ServiceProviderConfig.BuildServiceProvider()); }