ComponentSpace

Forums



Enabing SAML Trace


Enabing SAML Trace

Author
Message
akcatchme
akcatchme
New Member
New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)

Group: Awaiting Activation
Posts: 5, Visits: 45
I am using highlevel api of component space.  if certification mismatch or any issues , it gives exception in the line 
_samlServiceProvider.ReceiveSsoAsync().Result
Is there way to capture SAML Response if I got error for debugging purpose ? If there is no issues with SAML response , don't need to capture anything.
ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
The best option is to enable the SAML trace.
Note that ReceiveSsoAsync is part of our SAML product for ASP.NET Core.
Enabling trace is the best option when debugging issues.
https://www.componentspace.com/Forums/7936/Enabling-SAML-Trace
The trace captures the SAML response and includes details about signature failures etc.



Regards
ComponentSpace Development
akcatchme
akcatchme
New Member
New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)

Group: Awaiting Activation
Posts: 5, Visits: 45
ComponentSpace - 9/17/2018
The best option is to enable the SAML trace.
Note that ReceiveSsoAsync is part of our SAML product for ASP.NET Core.
Enabling trace is the best option when debugging issues.
https://www.componentspace.com/Forums/7936/Enabling-SAML-Trace
The trace captures the SAML response and includes details about signature failures etc.


Thank you for your information.
I am using NLog instead of AddSerilog . 
I use the logic as you mentioned and appsettings is also configured with LowLevel Warning.  It logs error but doesn't have SAML response on it.
Below is code in Program.cs : 
 public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
      .UseKestrel()
      .UseContentRoot(Directory.GetCurrentDirectory())
      .UseIISIntegration()
      .UseStartup<Startup>()
      .ConfigureLogging(logging =>
      {
       logging.ClearProviders();
       logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
      })
      .UseNLog() // NLog: setup NLog for Dependency injection
      .Build();

Error logs :

at ComponentSpace.Saml2.SamlServiceProvider.ReceiveSsoAsync()
2018-09-17 13:09:46.2119|ERROR|DESKTOP-E17ARME|YourCause.IdentityServer|Connection id "0HLGSP1P7LD11", Request id "0HLGSP1P7LD11:00000002": An unhandled exception was thrown by the application.System.Exception: An error was encountered while handling the remote login. ---> System.AggregateException: One or more errors occurred. (The SAML response isn't signed.) ---> ComponentSpace.Saml2.Exceptions.SamlSignatureException: The SAML response isn't signed.
 at ComponentSpace.Saml2.SamlServiceProvider.VerifySamlResponseSignatureAsync(XmlElement samlResponseElement)
 at ComponentSpace.Saml2.SamlServiceProvider.ProcessSamlResponseAsync(XmlElement samlResponseElement)
 at ComponentSpace.Saml2.SamlServiceProvider.ReceiveSsoAsync()
 --- End of inner exception stack trace ---
 at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
 at YourCause.IdentityServer.Host.Security.Saml2.Saml2AuthenticationHandler.HandleRemoteAuthenticateAsync() in C:\anilkhadka\YourCause\application\YourCauseProject\IdentityServer\YourCause.IdentityServer.v2\YourCause.IdentityServer.Host\Security\Saml2\Saml2AuthenticationHandler.cs:line 125
 at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
 --- End of inner exception stack trace ---
 at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
 at IdentityServer4.Hosting.FederatedSignOut.AuthenticationRequestHandlerWrapper.HandleRequestAsync() in C:\local\identity\server4\IdentityServer4\src\IdentityServer4\Hosting\FederatedSignOut\AuthenticationRequestHandlerWrapper.cs:line 38
 at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
 at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)
 at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context) in C:\local\identity\server4\IdentityServer4\src\IdentityServer4\Hosting\BaseUrlMiddleware.cs:line 36
 at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
 at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
 at YourCause.IdentityServer.Host.Startup.<>c.<<Configure>b__6_0>d.MoveNext() in C:\anilkhadka\YourCause\application\YourCauseProject\IdentityServer\YourCause.IdentityServer.v2\YourCause.IdentityServer.Host\Startup.cs:line 122
--- End of stack trace from previous location where exception was thrown ---
 at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
 at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Please let me know if you need more information.
ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
We mostly log at the debug level.
If logging is setup correctly, you should see more than just the exception being thrown.
As an experiment, if you call the logDebug method from your application, do you see the entry in the log?

Regards
ComponentSpace Development
Karlo Abela
Karlo Abela
New Member
New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)New Member (8 reputation)

Group: Forum Members
Posts: 5, Visits: 26
Hi, we are using ComponentSpace.SAML2.dll version 2.6.0.18 and we are getting this error when trying to enable SAML trace base on the instruction.

Are we missing something?




ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
The CyclicTraceListener was added as a convenience in v2.8.3.

For earlier releases, you can use one of the standard Microsoft trace listeners or a 3rd party trace listener.

For example:


<!-- The diagnostics are only required for problem determination. -->
<system.diagnostics>
  <trace autoflush="true">
  <listeners>
   <add name="TextWriter"/>
  </listeners>
  </trace>
  <sources>
  <source name="ComponentSpace.SAML2" switchValue="Verbose">
   <listeners>
    <add name="TextWriter"/>
   </listeners>
  </source>
  </sources>
  <sharedListeners>
  <!-- Ensure IIS has create/write file permissions for the log folder. -->
  <add name="TextWriter" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\temp\logs\sp.log"/>
  </sharedListeners>
</system.diagnostics>




Regards
ComponentSpace Development
ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
We use the .NET framework system diagnostics for logging so you can use any System.Diagnostics.TraceListener implementation you wish.

As a convenience, we supply a ComponentSpace.SAML2.Utility.CyclicTraceListener that cycles daily.

However, there are more sophisticated 3rd party trace listeners available. 

Regards
ComponentSpace Development
Ify
Ify
New Member
New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)

Group: Forum Members
Posts: 10, Visits: 62
ComponentSpace - 3/17/2017
Thanks MG for sharing.

Hi I have replied to your email. Thanks

ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
Thanks.

Regards
ComponentSpace Development
thinktime
thinktime
New Member
New Member (29 reputation)New Member (29 reputation)New Member (29 reputation)New Member (29 reputation)New Member (29 reputation)New Member (29 reputation)New Member (29 reputation)New Member (29 reputation)New Member (29 reputation)

Group: Forum Members
Posts: 27, Visits: 144




I can't turn it on, as CyclicTraceListener is not defined. 
lib v 2.6.0.18
GO


Similar Topics


Execution: 0.000. 2 queries. Compression Enabled.
Login
Existing Account
Email Address:


Password:


Select a Forum....












Forums, Documentation & Knowledge Base - ComponentSpace


Search