无法 运行 Sustainsys.Saml2 项目的示例

Unable to Run the Sample for the Sustainsys.Saml2 Project

有人可以向我解释如何 运行 Github Sustainsys.Saml2 存储库中的示例。

SampleIdentityServer4AspNetIdentity 没有解决方案文件。 在任何情况下,如果您将其作为起始项目,当您单击登录 link 然后单击 SAML 按钮时,它会在浏览器尝试加载 ExternalLogin 操作时抛出异常:

HttpRequestException: 由于目标机器主动拒绝,无法建立连接

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)

我真的需要让这个示例正常工作,因为我不认为我会理解它是如何工作的(doco 令人困惑,以至于用另一种语言编写)。

代码是最新的吗?还是我做错了什么? 如果有什么我需要做的,如果示例目录有一个解释它的自述文件,那将会有所帮助。否则,您希望获得无缝的“F5 体验”。

示例项目依赖于同一解决方案中的 Stub Idp。所以首先启动 Stub Idp 项目,然后启动任何示例项目。