# Policy Enforcement Provider (PEP)

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

## Summary

Represents a PEP that receives demands

## Operations

| Operation  | Response/Return | Input/Parameter                                                                                    | Description                                       |
| ---------- | --------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| Demand     | void            | *String* **policyId**                                                                              | Demand access to the policy for the current       |
| Demand     | void            | <p><em>String</em> <strong>policyId</strong><br><em>IPrincipal</em> <strong>principal</strong></p> | Demand access to the policy for the current       |
| SoftDemand | Boolean         | <p><em>String</em> <strong>policyId</strong><br><em>IPrincipal</em> <strong>principal</strong></p> | Demand the specified policy and return the result |

## Implementations

### DefaultPolicyEnforcementService - (SanteDB.Core.Api)

Policy enforcement service

#### Service Registration

```markup
...
<section xsi:type="ApplicationServiceContextConfigurationSection" threadPoolSize="4">
	<serviceProviders>
		...
		<add type="SanteDB.Core.Security.DefaultPolicyEnforcementService, SanteDB.Core.Api, 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 MyPolicyEnforcementService : SanteDB.Core.Security.Services.IPolicyEnforcementService { 
	public String ServiceName => "My own IPolicyEnforcementService service";
	/// <summary>
	/// Demand access to the policy for the current
	/// </summary>
	public void Demand(String policyId){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Demand access to the policy for the current
	/// </summary>
	public void Demand(String policyId,IPrincipal principal){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Demand the specified policy and return the result
	/// </summary>
	public Boolean SoftDemand(String policyId,IPrincipal principal){
		throw new System.NotImplementedException();
	}
}
```

## References

* [IPolicyEnforcementService C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Security_Services_IPolicyEnforcementService.htm)
* [DefaultPolicyEnforcementService C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Security_DefaultPolicyEnforcementService.htm)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.santesuite.org/developers/server-plugins/implementing-.net-features/service-definitions/policy-enforcement-provider-pep.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
