Class SamlServiceProvider
Provides Service Provider (SP) support for web browser single sign-on.
Inherited Members
Namespace: ComponentSpace.Saml2
Assembly: ComponentSpace.Saml2.dll
Syntax
public class SamlServiceProvider : SamlProvider, ISamlServiceProvider, ISamlProvider, IArtifactResolver
  Constructors
SamlServiceProvider(IHttpContextAccessor, ISamlConfigurationNameResolver, ISamlConfigurationResolver, ICertificateManager, ICertificateLoader, IIDCache, ISsoSessionStore, IHttpPostBinding, IHttpRedirectBinding, IHttpArtifactBinding, IArtifactCache, ISoapBinding, IUrlUtility, ISamlSchemaValidator, IXmlSignature, IXmlEncryption, IOptionsMonitor<CookiePolicyOptions>, ILoggerFactory)
Initializes a new instance of the SamlServiceProvider class.
Declaration
public SamlServiceProvider(IHttpContextAccessor httpContextAccessor, ISamlConfigurationNameResolver samlConfigurationNameResolver, ISamlConfigurationResolver samlConfigurationResolver, ICertificateManager certificateManager, ICertificateLoader certificateLoader, IIDCache idCache, ISsoSessionStore ssoSessionStore, IHttpPostBinding httpPostBinding, IHttpRedirectBinding httpRedirectBinding, IHttpArtifactBinding httpArtifactBinding, IArtifactCache artifactCache, ISoapBinding soapBinding, IUrlUtility urlUtility, ISamlSchemaValidator samlSchemaValidator, IXmlSignature xmlSignature, IXmlEncryption xmlEncryption, IOptionsMonitor<CookiePolicyOptions> cookiePolicyOptions, ILoggerFactory loggerFactory)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IHttpContextAccessor | httpContextAccessor | The HTTP context accessor.  | 
      
| ISamlConfigurationNameResolver | samlConfigurationNameResolver | The SAML configuration name resolver.  | 
      
| ISamlConfigurationResolver | samlConfigurationResolver | The SAML configuration resolver.  | 
      
| ICertificateManager | certificateManager | The certificate manager.  | 
      
| ICertificateLoader | certificateLoader | The certificate loader.  | 
      
| IIDCache | idCache | The ID cache.  | 
      
| ISsoSessionStore | ssoSessionStore | The SSO session store.  | 
      
| IHttpPostBinding | httpPostBinding | The HTTP Post binding.  | 
      
| IHttpRedirectBinding | httpRedirectBinding | The HTTP Redirect binding.  | 
      
| IHttpArtifactBinding | httpArtifactBinding | The HTTP Artifact binding.  | 
      
| IArtifactCache | artifactCache | The HTTP Artifact cache.  | 
      
| ISoapBinding | soapBinding | The SOAP binding.  | 
      
| IUrlUtility | urlUtility | The URL utility.  | 
      
| ISamlSchemaValidator | samlSchemaValidator | The SAML XML schema validator.  | 
      
| IXmlSignature | xmlSignature | The XML signature provider.  | 
      
| IXmlEncryption | xmlEncryption | The XML encryption provider.  | 
      
| IOptionsMonitor<CookiePolicyOptions> | cookiePolicyOptions | The cookie policy options.  | 
      
| ILoggerFactory | loggerFactory | The logger factory.  | 
      
Properties
Events
Gets or sets the optional events associated with SAML SSO and SLO.
Declaration
public ISamlServiceProviderEvents Events { get; set; }
  Property Value
| Type | Description | 
|---|---|
| ISamlServiceProviderEvents | The optional events associated with SAML SSO and SLO.  | 
      
Methods
ClearSessionAsync(string)
Clears the current SAML session state for all partners or for the specified partner only.
Declaration
public override Task ClearSessionAsync(string partnerName = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | partnerName | The partner name or   | 
      
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the operation.  | 
      
Overrides
Exceptions
| Type | Condition | 
|---|---|
| SamlException | Thrown when the SAML session state cannot be cleared.  | 
      
GetStatusAsync()
Returns the current SSO status.
Declaration
public override Task<ISsoStatus> GetStatusAsync()
  Returns
| Type | Description | 
|---|---|
| Task<ISsoStatus> | A task that represents the operation and returns the current SSO status.  | 
      
Overrides
Exceptions
| Type | Condition | 
|---|---|
| SamlException | Thrown when the starts cannot be retrieved.  | 
      
InitiateSloAsync(string, string, string)
Initiates single logout from the service provider to the identity provider (ie. SP-initiated SLO).
An logout request is sent to the identity provider.
Declaration
public Task InitiateSloAsync(string partnerName, string logoutReason, string relayState)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | partnerName | The partner identity provider name.  | 
      
| string | logoutReason | The logout reason or   | 
      
| string | relayState | The relay state or   | 
      
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the operation.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| SamlException | Thrown when the single logout fails.  | 
      
InitiateSsoAsync(string, string, ISsoOptions)
Initiates single sign-on from the service provider to the identity provider (ie. SP-initiated SSO).
An authn request is sent to the identity provider.
Declaration
public Task InitiateSsoAsync(string partnerName, string relayState, ISsoOptions ssoOptions)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | partnerName | The partner identity provider name.  | 
      
| string | relayState | The relay state or   | 
      
| ISsoOptions | ssoOptions | The SSO options or   | 
      
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the operation.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| SamlException | Thrown when the single sign-on fails.  | 
      
ReceiveSloAsync()
Receives a single logout request (ie. IdP-initiated SLO) or single logout response (ie. SP-initiated SLO) from an identity provider.
Declaration
public Task<ISloResult> ReceiveSloAsync()
  Returns
| Type | Description | 
|---|---|
| Task<ISloResult> | A task that represents the operation and returns the SLO result.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| SamlException | Thrown when the single logout fails.  | 
      
ReceiveSsoAsync()
Receives a single sign-on response from the identity provider (ie. IdP-initiated or SP-initiated SSO).
Declaration
public Task<ISpSsoResult> ReceiveSsoAsync()
  Returns
| Type | Description | 
|---|---|
| Task<ISpSsoResult> | A task that represents the operation and returns the SSO result.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| SamlException | Thrown when the single sign-on fails.  | 
      
ResolveArtifactAsync()
Receives an artifact resolve request and sends an artifact response,.
Declaration
public override Task ResolveArtifactAsync()
  Returns
| Type | Description | 
|---|---|
| Task | A task that represents the operation.  | 
      
Overrides
Exceptions
| Type | Condition | 
|---|---|
| SamlException | Thrown when the artifact resolve request cannot be processed.  | 
      
SendSloAsync(string, string)
Sends a single logout response to the identity provider (ie IdP-initiated SLO).
Declaration
public Task SendSloAsync(string errorMessage, string correlationID)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | errorMessage | The error message or   | 
      
| string | correlationID | The correlation ID identifying the logout request to respond to.  | 
      
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the operation.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| SamlException | Thrown when the single logout fails.  |