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 |
---|---|---|
Microsoft. |
httpContextAccessor | The HTTP context accessor. |
ISaml |
samlConfigurationNameResolver | The SAML configuration name resolver. |
ISaml |
samlConfigurationResolver | The SAML configuration resolver. |
ICertificate |
certificateManager | The certificate manager. |
ICertificate |
certificateLoader | The certificate loader. |
IIDCache | idCache | The ID cache. |
ISso |
ssoSessionStore | The SSO session store. |
IHttp |
httpPostBinding | The HTTP Post binding. |
IHttp |
httpRedirectBinding | The HTTP Redirect binding. |
IHttp |
httpArtifactBinding | The HTTP Artifact binding. |
IArtifact |
artifactCache | The HTTP Artifact cache. |
ISoap |
soapBinding | The SOAP binding. |
IUrl |
urlUtility | The URL utility. |
ISaml |
samlSchemaValidator | The SAML XML schema validator. |
IXml |
xmlSignature | The XML signature provider. |
IXml |
xmlEncryption | The XML encryption provider. |
Microsoft. |
cookiePolicyOptions | The cookie policy options. |
Microsoft. |
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 |
---|---|
ISaml |
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. |
partnerName | The partner name or |
Returns
Type | Description |
---|---|
System. |
A task that represents the operation. |
Overrides
Exceptions
Type | Condition |
---|---|
Saml |
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. |
A task that represents the operation and returns the current SSO status. |
Overrides
Exceptions
Type | Condition |
---|---|
Saml |
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. |
partnerName | The partner identity provider name. |
System. |
logoutReason | The logout reason or |
System. |
relayState | The relay state or |
Returns
Type | Description |
---|---|
System. |
A task that represents the operation. |
Exceptions
Type | Condition |
---|---|
Saml |
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. |
partnerName | The partner identity provider name. |
System. |
relayState | The relay state or |
ISso |
ssoOptions | The SSO options or |
Returns
Type | Description |
---|---|
System. |
A task that represents the operation. |
Exceptions
Type | Condition |
---|---|
Saml |
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. |
A task that represents the operation and returns the SLO result. |
Exceptions
Type | Condition |
---|---|
Saml |
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. |
A task that represents the operation and returns the SSO result. |
Exceptions
Type | Condition |
---|---|
Saml |
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. |
A task that represents the operation. |
Overrides
Exceptions
Type | Condition |
---|---|
Saml |
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. |
errorMessage | The error message or |
System. |
correlationID | The correlation ID identifying the logout request to respond to. |
Returns
Type | Description |
---|---|
System. |
A task that represents the operation. |
Exceptions
Type | Condition |
---|---|
Saml |
Thrown when the single logout fails. |