Class SamlServiceProvider
- Namespace
- ComponentSpace.Saml2
- Assembly
- ComponentSpace.Saml2.dll
Provides Service Provider (SP) support for web browser single sign-on.
public class SamlServiceProvider : SamlProvider, ISamlServiceProvider, ISamlProvider, IArtifactResolver
- Inheritance
-
SamlServiceProvider
- Implements
- Inherited Members
Constructors
SamlServiceProvider(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 SamlServiceProvider class.
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, LicenseManager licenseManager, ILoggerFactory loggerFactory)
Parameters
httpContextAccessorIHttpContextAccessorThe HTTP context accessor.
samlConfigurationNameResolverISamlConfigurationNameResolverThe SAML configuration name resolver.
samlConfigurationResolverISamlConfigurationResolverThe SAML configuration resolver.
certificateManagerICertificateManagerThe certificate manager.
certificateLoaderICertificateLoaderThe certificate loader.
idCacheIIDCacheThe ID cache.
ssoSessionStoreISsoSessionStoreThe SSO session store.
httpPostBindingIHttpPostBindingThe HTTP Post binding.
httpRedirectBindingIHttpRedirectBindingThe HTTP Redirect binding.
httpArtifactBindingIHttpArtifactBindingThe HTTP Artifact binding.
artifactCacheIArtifactCacheThe HTTP Artifact cache.
soapBindingISoapBindingThe SOAP binding.
urlUtilityIUrlUtilityThe URL utility.
samlSchemaValidatorISamlSchemaValidatorThe SAML XML schema validator.
xmlSignatureIXmlSignatureThe XML signature provider.
xmlEncryptionIXmlEncryptionThe XML encryption provider.
cookiePolicyOptionsIOptionsMonitor<CookiePolicyOptions>The cookie policy options.
licenseManagerLicenseManagerThe license manager.
loggerFactoryILoggerFactoryThe logger factory.
Properties
Events
Gets or sets the optional events associated with SAML SSO and SLO.
public ISamlServiceProviderEvents Events { get; set; }
Property Value
- 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.
public override Task ClearSessionAsync(string partnerName = null)
Parameters
partnerNamestringThe partner name or
nullif 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, 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.
public Task InitiateSloAsync(string partnerName, string logoutReason, string relayState)
Parameters
partnerNamestringThe partner identity provider name.
logoutReasonstringThe logout reason or
nullif none.relayStatestringThe relay state or
nullif none.
Returns
- Task
A task that represents the operation.
Exceptions
- 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.
public Task InitiateSsoAsync(string partnerName, string relayState, ISsoOptions ssoOptions)
Parameters
partnerNamestringThe partner identity provider name.
relayStatestringThe relay state or
nullif none.ssoOptionsISsoOptionsThe SSO options or
nullif none.
Returns
- Task
A task that represents the operation.
Exceptions
- 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.
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 response from the identity provider (ie. IdP-initiated or SP-initiated SSO).
public Task<ISpSsoResult> ReceiveSsoAsync()
Returns
- Task<ISpSsoResult>
A task that represents the operation and 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 response to the identity provider (ie IdP-initiated SLO).
public Task SendSloAsync(string errorMessage, string correlationID)
Parameters
errorMessagestringThe error message or
nullif logout was successful.correlationIDstringThe 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.