> For the complete documentation index, see [llms.txt](https://help.santesuite.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.santesuite.org/developers/server-plugins/implementing-.net-features/service-definitions/security-challenge-storage-provider.md).

# Security Challenge Storage Provider

`ISecurityChallengeService` in assembly SanteDB.Core.Api version 3.0.1980.0

## Summary

Represents an interface that allows for the retrieval of pre-configured security challenges

## Operations

| Operation | Response/Return                 | Input/Parameter                                                                                                                                                                                | Description                                                           |
| --------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| Get       | IEnumerable\<SecurityChallenge> | <p><em>String</em> <strong>userName</strong><br><em>IPrincipal</em> <strong>principal</strong></p>                                                                                             | Gets the challenges current registered for the user (not the answers) |
| Get       | IEnumerable\<SecurityChallenge> | <p><em>Guid</em> <strong>userKey</strong><br><em>IPrincipal</em> <strong>principal</strong></p>                                                                                                | Gets the challenges current registered for the user (not the answers) |
| Set       | void                            | <p><em>String</em> <strong>userName</strong><br><em>Guid</em> <strong>challengeKey</strong><br><em>String</em> <strong>response</strong><br><em>IPrincipal</em> <strong>principal</strong></p> | Add a challenge to the current registered user                        |
| Remove    | void                            | <p><em>String</em> <strong>userName</strong><br><em>Guid</em> <strong>challengeKey</strong><br><em>IPrincipal</em> <strong>principal</strong></p>                                              | Removes or clears the specified challenge                             |

## Implementations

### UpstreamSecurityChallengeProvider - (SanteDB.Client)

Remote security challenge provider repository

#### Service Registration

```markup
...
<section xsi:type="ApplicationServiceContextConfigurationSection" threadPoolSize="4">
	<serviceProviders>
		...
		<add type="SanteDB.Client.Upstream.Repositories.UpstreamSecurityChallengeProvider, SanteDB.Client, Version=3.0.1980.0, Culture=neutral, PublicKeyToken=null" />
		...
	</serviceProviders>
```

### AdoSecurityChallengeProvider - (SanteDB.Persistence.Data)

Represents a callenge service which uses the ADO.NET tables

#### Service Registration

```markup
...
<section xsi:type="ApplicationServiceContextConfigurationSection" threadPoolSize="4">
	<serviceProviders>
		...
		<add type="SanteDB.Persistence.Data.Services.AdoSecurityChallengeProvider, SanteDB.Persistence.Data, Version=3.0.1980.0, Culture=neutral, PublicKeyToken=null" />
		...
	</serviceProviders>
```

## Example Implementation

```csharp
/// Example Implementation
using SanteDB.Core.Security.Services;
/// Other usings here
public class MySecurityChallengeService : SanteDB.Core.Security.Services.ISecurityChallengeService { 
	public String ServiceName => "My own ISecurityChallengeService service";
	/// <summary>
	/// Gets the challenges current registered for the user (not the answers)
	/// </summary>
	public IEnumerable<SecurityChallenge> Get(String userName,IPrincipal principal){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Gets the challenges current registered for the user (not the answers)
	/// </summary>
	public IEnumerable<SecurityChallenge> Get(Guid userKey,IPrincipal principal){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Add a challenge to the current registered user
	/// </summary>
	public void Set(String userName,Guid challengeKey,String response,IPrincipal principal){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Removes or clears the specified challenge
	/// </summary>
	public void Remove(String userName,Guid challengeKey,IPrincipal principal){
		throw new System.NotImplementedException();
	}
}
```

## References

* [ISecurityChallengeService C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Security_Services_ISecurityChallengeService.htm)
* [UpstreamSecurityChallengeProvider C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Client_Upstream_Repositories_UpstreamSecurityChallengeProvider.htm)
* [AdoSecurityChallengeProvider C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Persistence_Data_Services_AdoSecurityChallengeProvider.htm)
