Show / Hide Table of Contents

Class SamlServiceProvider

Provides Service Provider (SP) support for web browser single sign-on.

Inheritance
System.Object
SamlProvider
SamlServiceProvider
Implements
ISamlServiceProvider
ISamlProvider
IArtifactResolver
Inherited Members
SamlProvider.SetConfigurationNameAsync(String)
SamlProvider.PeekMessageTypeAsync()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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
Microsoft.AspNetCore.Http.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.

Microsoft.Extensions.Options.IOptionsMonitor<Microsoft.AspNetCore.Builder.CookiePolicyOptions> cookiePolicyOptions

The cookie policy options.

Microsoft.Extensions.Logging.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 async Task ClearSessionAsync(string partnerName = null)
Parameters
Type Name Description
System.String partnerName

The partner name or null if none.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the operation.

Overrides
SamlProvider.ClearSessionAsync(String)
Exceptions
Type Condition
SamlException

Thrown when the SAML session state cannot be cleared.

GetStatusAsync()

Returns the current SSO status.

Declaration
public override async Task<ISsoStatus> GetStatusAsync()
Returns
Type Description
System.Threading.Tasks.Task<ISsoStatus>

A task that represents the operation and returns the current SSO status.

Overrides
SamlProvider.GetStatusAsync()
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 async Task InitiateSloAsync(string partnerName, string logoutReason, string relayState)
Parameters
Type Name Description
System.String partnerName

The partner identity provider name.

System.String logoutReason

The logout reason or null if none.

System.String relayState

The relay state or null if none.

Returns
Type Description
System.Threading.Tasks.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 async Task InitiateSsoAsync(string partnerName, string relayState, ISsoOptions ssoOptions)
Parameters
Type Name Description
System.String partnerName

The partner identity provider name.

System.String relayState

The relay state or null if none.

ISsoOptions ssoOptions

The SSO options or null if none.

Returns
Type Description
System.Threading.Tasks.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 async Task<ISloResult> ReceiveSloAsync()
Returns
Type Description
System.Threading.Tasks.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 async Task<ISpSsoResult> ReceiveSsoAsync()
Returns
Type Description
System.Threading.Tasks.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 async Task ResolveArtifactAsync()
Returns
Type Description
System.Threading.Tasks.Task

A task that represents the operation.

Overrides
SamlProvider.ResolveArtifactAsync()
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 async Task SendSloAsync(string errorMessage, string correlationID)
Parameters
Type Name Description
System.String errorMessage

The error message or null if logout was successful.

System.String correlationID

The correlation ID identifying the logout request to respond to.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the operation.

Exceptions
Type Condition
SamlException

Thrown when the single logout fails.

Implements

ISamlServiceProvider
ISamlProvider
IArtifactResolver
In This Article
Back to top Copyright © ComponentSpace Pty Ltd 2017-2022. All rights reserved.