Table of Contents

Class SamlIdentityProvider

Namespace
ComponentSpace.Saml2
Assembly
ComponentSpace.Saml2.dll

Provides Identity Provider (IdP) support for web browser single sign-on.

public class SamlIdentityProvider : SamlProvider, ISamlIdentityProvider, ISamlProvider, IArtifactResolver
Inheritance
SamlIdentityProvider
Implements
Inherited Members

Constructors

SamlIdentityProvider(IHttpContextAccessor, ISamlConfigurationNameResolver, ISamlConfigurationResolver, ICertificateManager, ICertificateLoader, IIDCache, ISsoSessionStore, IHttpPostBinding, IHttpRedirectBinding, IHttpArtifactBinding, IArtifactCache, ISoapBinding, IUrlUtility, ISamlSchemaValidator, IXmlSignature, IXmlEncryption, IOptionsMonitor<CookiePolicyOptions>, LicenseManager, ILoggerFactory)

Initializes a new instance of the SamlIdentityProvider class.

public SamlIdentityProvider(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, LicenseManager licenseManager, ILoggerFactory loggerFactory)

Parameters

httpContextAccessor IHttpContextAccessor

The HTTP context accessor.

samlConfigurationNameResolver ISamlConfigurationNameResolver

The SAML configuration name resolver.

samlConfigurationResolver ISamlConfigurationResolver

The SAML configuration resolver.

certificateManager ICertificateManager

The certificate manager.

certificateLoader ICertificateLoader

The certificate loader.

idCache IIDCache

The ID cache.

ssoSessionStore ISsoSessionStore

The SSO session store.

httpPostBinding IHttpPostBinding

The HTTP Post binding.

httpRedirectBinding IHttpRedirectBinding

The HTTP Redirect binding.

httpArtifactBinding IHttpArtifactBinding

The HTTP Artifact binding.

artifactCache IArtifactCache

The HTTP Artifact cache.

soapBinding ISoapBinding

The SOAP binding.

urlUtility IUrlUtility

The URL utility.

samlSchemaValidator ISamlSchemaValidator

The SAML XML schema validator.

xmlSignature IXmlSignature

The XML signature provider.

xmlEncryption IXmlEncryption

The XML encryption provider.

cookiePolicyOptions IOptionsMonitor<CookiePolicyOptions>

The cookie policy options.

licenseManager LicenseManager

The license manager.

loggerFactory ILoggerFactory

The logger factory.

Properties

Events

Gets or sets the optional events associated with SAML SSO and SLO.

public ISamlIdentityProviderEvents Events { get; set; }

Property Value

ISamlIdentityProviderEvents

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.

public override Task ClearSessionAsync(string partnerName = null)

Parameters

partnerName string

The partner name or null if none.

Returns

Task

A task that represents the operation.

Exceptions

SamlException

Thrown when the SAML session state cannot be cleared.

GetStatusAsync()

Returns the current SSO status.

public override Task<ISsoStatus> GetStatusAsync()

Returns

Task<ISsoStatus>

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

Exceptions

SamlException

Thrown when the starts cannot be retrieved.

InitiateSloAsync(string, string)

Initiates single logout from the identity provider to the service providers (ie. IdP-initiated SLO).

A logout request is sent to the service providers that are signed in.

public Task InitiateSloAsync(string logoutReason, string relayState)

Parameters

logoutReason string

The logout reason or null if none.

relayState string

The relay state or null if none.

Returns

Task

A task that represents the operation.

Exceptions

SamlException

Thrown when the single logout fails.

InitiateSsoAsync(string, string, IList<SamlAttribute>, string, string, string)

Initiates single sign-on from the identity provider to the service provider (ie. IdP-initiated SSO).

A SAML response containing a SAML assertion is sent to the service provider.

public Task InitiateSsoAsync(string partnerName, string userID, IList<SamlAttribute> attributes, string relayState, string authnContext, string nameIDFormat)

Parameters

partnerName string

The partner service provider name or null to specify the default.

userID string

The user ID to include in the SAML assertion or null if none.

attributes IList<SamlAttribute>

The attributes to include in the SAML assertion or null if none.

relayState string

The relay state (eg target URL) or null if none.

authnContext string

The authentication context identifying how the user was authenticated or null if the configured value is to be used.

nameIDFormat string

The name identifier format or null if the configured value is to be used.

Returns

Task

A task that represents the operation.

Exceptions

SamlException

Thrown when the single sign-on fails.

See Also

ReceiveSloAsync()

Receives a single logout request (ie. SP-initiated SLO) or single logout response (ie. IdP-initiated SLO) from a service provider.

public Task<ISloResult> ReceiveSloAsync()

Returns

Task<ISloResult>

A task that represents the operation and returns the SLO result.

Exceptions

SamlException

Thrown when the single logout fails.

ReceiveSsoAsync()

Receives a single sign-on request from a service provider (ie. SP-initiated SSO).

An authn request is received from the service provider.

public Task<IIdpSsoResult> ReceiveSsoAsync()

Returns

Task<IIdpSsoResult>

A task that represents the operationand returns the SSO result.

Exceptions

SamlException

Thrown when the single sign-on fails.

ResolveArtifactAsync()

Receives an artifact resolve request and sends an artifact response,.

public override Task ResolveArtifactAsync()

Returns

Task

A task that represents the operation.

Exceptions

SamlException

Thrown when the artifact resolve request cannot be processed.

SendSloAsync(string, string)

Sends a single logout message to a service provider (ie. SP-initiated SLO).

public Task SendSloAsync(string errorMessage, string correlationID)

Parameters

errorMessage string

The error message or null if logout was successful.

correlationID string

The correlation ID identifying the logout request to respond to.

Returns

Task

A task that represents the operation.

Exceptions

SamlException

Thrown when the single logout fails.

SendSsoAsync(Status, string)

Sends a single sign-on error response as part of SP-initiated SSO.

A SAML error response is sent to the service provider.

public Task SendSsoAsync(Status status, string correlationID)

Parameters

status Status

The error status.

correlationID string

The correlation ID identifying the authentication request to respond to.

Returns

Task

A task that represents the operation.

Exceptions

SamlException

Thrown when the single sign-on fails.

SendSsoAsync(string, IList<SamlAttribute>, string, string, string)

Sends a single sign-on response as part of SP-initiated SSO.

A SAML response containing a SAML assertion is sent to the service provider.

public Task SendSsoAsync(string userID, IList<SamlAttribute> attributes, string authnContext, string nameIDFormat, string correlationID)

Parameters

userID string

The user ID to include in the SAML assertion or null if none.

attributes IList<SamlAttribute>

The attributes to include in the SAML assertion or null if none.

authnContext string

The authentication context identifying how the user was authenticated or null if the configured value is to be used.

nameIDFormat string

The name identifier format or null if the configured value is to be used.

correlationID string

The correlation ID identifying the authentication request to respond to.

Returns

Task

A task that represents the operation.

Exceptions

SamlException

Thrown when the single sign-on fails.

See Also