sustainsys-saml2

Unable to Run the Sample for the Sustainsys.Saml2 Project


Can someone please explain to me how to run the samples in the Github repository for Sustainsys.Saml2.

The SampleIdentityServer4AspNetIdentity does not have a solution file. In any case, if you make it the starting project, when you click the login link and then the SAML button, it throws an exception when the browser attempts to load the ExternalLogin action:

HttpRequestException: No connection could be made because the target machine actively refused it

System.Net.Http.ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken) System.Threading.Tasks.ValueTask.get_Result() System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) System.Threading.Tasks.ValueTask.get_Result() System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask<ValueTuple<HttpConnection, HttpResponseMessage>> creationTask) System.Threading.Tasks.ValueTask.get_Result() System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, bool doRequestAuth, CancellationToken cancellationToken) System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task sendTask, HttpRequestMessage request, CancellationTokenSource cts, bool disposeCts) System.Net.HttpWebRequest.SendRequest() System.Net.HttpWebRequest.GetResponse()

WebException: No connection could be made because the target machine actively refused it No connection could be made because the target machine actively refused it System.Net.HttpWebRequest.GetResponse() System.Net.WebClient.GetWebResponse(WebRequest request) System.Net.WebClient.OpenRead(Uri address) System.Net.WebClient.OpenRead(string address) Sustainsys.Saml2.Metadata.MetadataLoader.Load(string metadataLocation, IEnumerable signingKeys, bool validateCertificate, string minIncomingSigningAlgorithm) in MetadataLoader.cs + using (var stream = client.OpenRead(metadataLocation)) Sustainsys.Saml2.Metadata.MetadataLoader.LoadIdp(string metadataLocation, bool unpackEntitiesDescriptor) in MetadataLoader.cs + var result = Load(metadataLocation, null, false, null); Sustainsys.Saml2.IdentityProvider.DoLoadMetadata() in IdentityProvider.cs + var metadata = MetadataLoader.LoadIdp( Sustainsys.Saml2.IdentityProvider.ReloadMetadataIfRequired() in IdentityProvider.cs + DoLoadMetadata(); Sustainsys.Saml2.IdentityProvider.get_SingleSignOnServiceUrl() in IdentityProvider.cs + ReloadMetadataIfRequired(); Sustainsys.Saml2.IdentityProvider.CreateAuthenticateRequest(Saml2Urls saml2Urls) in IdentityProvider.cs + var authnRequest = new Saml2AuthenticationRequest() Sustainsys.Saml2.WebSso.SignInCommand.InitiateLoginToIdp(IOptions options, IDictionary<string, string> relayData, Saml2Urls urls, IdentityProvider idp, Uri returnUrl, HttpRequestData request) in SignInCommand.cs + var authnRequest = idp.CreateAuthenticateRequest(urls); Sustainsys.Saml2.WebSso.SignInCommand.Run(EntityId idpEntityId, string returnPath, HttpRequestData request, IOptions options, IDictionary<string, string> relayData) in SignInCommand.cs + return InitiateLoginToIdp(options, relayData, urls, idp, returnUrl, request); Sustainsys.Saml2.AspNetCore2.Saml2Handler.ChallengeAsync(AuthenticationProperties properties) in Saml2Handler.cs + var result = SignInCommand.Run( Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, string scheme, AuthenticationProperties properties) Microsoft.AspNetCore.Mvc.ChallengeResult.ExecuteResultAsync(ActionContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync<TFilter, TFilterAsync>() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events) in IdentityServerMiddleware.cs IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes) in MtlsTokenEndpointMiddleware.cs Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context) IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context) in BaseUrlMiddleware.cs Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext) Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

I really need to get this sample working, as I don't think I'll develop an understanding for how it works otherwise (the doco is confusing to the point of being written in another language).

Is the code up to date? Or is there something I'm doing wrong? If there is something I need to do, it would help if the samples directory had a readme file which explained it. Otherwise, you expect to have a seamless "F5 experience".


Solution

  • The sample project relies on the Stub Idp that is in the same solution. So first start the Stub Idp project, then start any of the sample projects.