# Managing Applications

In SanteDB the a security application represents a piece of software code which is authorized to access data within the SanteDB iCDR environment. In OpenID nomenclature, an application in SanteDB represents an authenticated client (`client_id`/`client_secret`).

## Application List

The application list screen shows a listing of all registered security applications (and profiles) in the implementation of SanteDB.&#x20;

![](https://3421852694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ0_pjgTp_kx4hqTZ3a%2Fuploads%2FuvlE37VyBGDV5pq2MXWs%2Fimage.png?alt=media\&token=ae7d8c4d-9876-4485-aa3a-08c40e2fc97d)

* Create Application Identity: Used to establish a new authenticated application.
* Details / Edit : Used to view the security details of the authenticated application and change if needed.
* Delete : Deactivates the application in the SanteDB server instance so no authentications or lookups will be resolved.
* Lock Application: Prevents the application or any user on that application from gaining access.

## Create Application

Creating a new application in the administrative portal establishes a new identity registration in the application identity provider. Data collected to create a new security application includes:

* Name: A unique name for the application in the SanteDB identity provider. The name is equivalent to the `client_id` in the oauth request.
* Software Name: A descriptive name of the software to which this application belongs.
* Software Vendor: A description of the software vendor/support contact&#x20;
* Software Version: The version of the software that owns this application credential

{% hint style="info" %}
If creating a security application for HL7 Version 2.x trading partners, the name of the application should be in format `MSH-4` format.
{% endhint %}

### Generate an Application Secret

Once created, the administrative interface will show the created application. The administrator must generate an application secret using the **Reset** option.

![](https://3421852694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ0_pjgTp_kx4hqTZ3a%2Fuploads%2FxPK5FQMlSKSM0UCLbi6a%2Fimage.png?alt=media\&token=a3d2c1ff-1dfb-4876-a4de-22f5c150c99f)

The application secret should be saved and sent to the integration partner or application developer.

## Editing Applications

When editing an application from the application list or after creating an application, the properties of the device can be modified.

![](https://3421852694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ0_pjgTp_kx4hqTZ3a%2Fuploads%2Fxsy1fKfhpdpuBYahLzAQ%2Fimage.png?alt=media\&token=134f541d-d4f0-4fe8-9958-2826eccc99b2)

### Resetting Security State

Applications, like users and devices, can become locked if they fail to authenticate properly after a specified amount of time. This could be due to mis-configuration of the client or the security settings.&#x20;

Each time an application authentication attempt fails, the invalid authentication counter will be incremented until the application locks.&#x20;

![](https://3421852694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ0_pjgTp_kx4hqTZ3a%2Fuploads%2F74V0UIuPxiyBjp5QIXOk%2Fimage.png?alt=media\&token=2fee36ca-c500-4a93-8cdb-fc18bb183276)

An administrator the security settings:

1. Invalid Authentication attempts shows the number of the client application authentications that have failed. If the configured maximum authentication fails is exceeded by this counter the application account is locked.
2. Lockout shows the time until which time the application is locked. No authentication attempts will be permitted while the application is locked. (users may complain of applications not working or credentials not working). Unlocking the application will allow authentications with the credential.
3. Application secret allows for the changing of the application secret. The application secret is randomly generated, and should shared with the known development staff of the client application.

## Assigning Policies

By default a new application will copy its policies from the `APPLICATIONS` group. After creation policies can be customized using the policies panel. New policies are added by first searching for the policy and then pressing the `+` button.&#x20;

![](https://3421852694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ0_pjgTp_kx4hqTZ3a%2Fuploads%2FB9V5uFzjfuct49G1jHTV%2Fimage.png?alt=media\&token=dc059ac6-f353-4cc8-9e6e-d272944939ac)

By default an application will be assigned the policy with a GRANT permission. You can alter these by clicking the permission type.

![](https://3421852694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ0_pjgTp_kx4hqTZ3a%2Fuploads%2FTVmYMvzGfBZfw5JqcWBU%2Fimage.png?alt=media\&token=d62217f4-242c-4d58-aad8-7a872a2f7e6b)

The permission types in SanteDB are:

* Grant - The application will be granted access to any action or data carrying the policy
* Deny - The application is not permitted to access any action or data carrying the policy.
* Elevate - The application is, by default, DENY the request, and the server will send a authentication challenge back to the requestor. Users may be required to provide a reason for override and must provide their password.

Policies can be removed from an application by clicking the `Remove` button. When a policy is removed, it means that the application (or any device or user using it) has no specific grant applied to the policy (i.e. if the user is in a group its grant will apply, otherwise the default of DENY is applied).
