# User management

The Snow Owl Terminology Server employs two distinct methods for user management. The primary authentication and authorization service is the LDAP Directory Server, while a secondary option is a file-based database strictly utilized for administrative purposes. The following methods can be applied when granting or revoking user access.

## LDAP-based identity provider

{% hint style="info" %}
This is only applicable to the default deployment setup where a co-located OpenLDAP server is used alongside the Terminology Server.
{% endhint %}

There are several ways to access and manage an OpenLDAP server, hereby we will only describe one of them, through the [Apache Directory Studio](https://directory.apache.org/studio/).

Apache Directory Studio is an open-source, free application. It is available for different platforms (Windows, macOS, and Linux).&#x20;

Before accessing the LDAP database there is one technical prerequisite to satisfy. The OpenLDAP server has to be accessible from the machine Apache Directory Studio is installed. The best and most secure way to achieve that is to set up an SSH tunnel. Follow [this link](https://linuxize.com/post/how-to-setup-ssh-tunneling/#set-up-ssh-tunneling-in-windows) to an article that describes how to configure an SSH tunnel using [PuTTY ](https://www.chiark.greenend.org.uk/~sgtatham/putty/)and Windows.

The OpenLDAP server uses port 389 for communication. This is the port that needs to be tunneled through the SSH connection. Here is what the final configuration looks like in PuTTY:

<figure><img src="/files/fiT3FOlsevq9bmEjA9O3" alt=""><figcaption><p>Configure SSH tunnel</p></figcaption></figure>

Once the SSH tunnel works, it's time to set up our connection in Apache DS. Go to *File -> New -> LDAP Connection* and set the following:

<figure><img src="/files/pGPpHY0AImxBpSaVFoFV" alt=""><figcaption><p>Set up LDAP connection</p></figcaption></figure>

Hit the "Check Network Parameter" button to verify the network connection.

Go to the next page of the wizard and provide your credentials. The default Bind DN and Bind password can be found in the Terminology Server release package under `./snow-owl/docker/.env`.

<figure><img src="/files/E1yxOpbF3sDmXRy83uKA" alt=""><figcaption><p>Provide credentials for the LDAP connection</p></figcaption></figure>

Hit the "Check Authentication" button to verify your credentials. Hit Finish to complete the setup procedure.

All users and groups should be browseable now through the LDAP Browser view:

<figure><img src="/files/QOUr2h9mUPPgvhe3ndK4" alt=""><figcaption><p>Browse LDAP users / groups</p></figcaption></figure>

### Grant user access

To grant access to a new user an LDAP entry has to be created. Go to the LDAP Browse view and right-click on the organization node, then *New -> New Entry*:

<figure><img src="/files/FAHX8s8IUasRnCr6GzfI" alt=""><figcaption><p>Create new LDAP entry</p></figcaption></figure>

It is the easiest to use an existing entry as a template:

<figure><img src="/files/w5M3Giqfj6Tks7rYy96s" alt=""><figcaption><p>Select existing user entry as template</p></figcaption></figure>

Leave everything as is on the *Object Classes* page, then hit *Next.* Fill in the new user's credentials:

<figure><img src="/files/xkSNgGeq7FHmH4euCkn8" alt=""><figcaption><p>Configure user details</p></figcaption></figure>

On the final page, double-click on the *userPassword* row and provide the user's password:

<figure><img src="/files/ksZm4BbI1qGu40VUSjTb" alt=""><figcaption><p>Set user credentials</p></figcaption></figure>

Hit *Finish* to add the user to the database.&#x20;

Now we need to assign a role for the user. Before going forward, get ahold of the user's DN using the LDAP Browser view:

<figure><img src="/files/5z30ymLP4DdQaUtEy7ac" alt=""><figcaption><p>Copy the user's DN</p></figcaption></figure>

Select the desired role group in the Browser view and add a new attribute:

<figure><img src="/files/eCKy3NdBSLOSaPIo9wy1" alt=""><figcaption><p>Add new attribute</p></figcaption></figure>

Select the attribute type `uniqueMember` and hit *Finish*:

<figure><img src="/files/1Ow5dMbdG4NjBAxmKDiB" alt=""><figcaption><p>Select attribute type uniqueMember</p></figcaption></figure>

Paste the user's DN as the value of the attribute and hit *Enter* to make your changes permanent:

<figure><img src="/files/ZfKRyLb4gf6m2WFdLZYt" alt=""><figcaption><p>Add new member to role group</p></figcaption></figure>

### Revoke user access

To revoke access the user has to be deleted from the list of users:

<figure><img src="/files/AZEPGVa5USYKFU1ztmG6" alt=""><figcaption><p>Delete user entry</p></figcaption></figure>

And also has to be removed from the role group:

<figure><img src="/files/OtGggvA7ciqFPE8iajgP" alt=""><figcaption><p>Delete role group attribute</p></figcaption></figure>

### Change credentials

To change either the first or last name, or the password of a user, just edit any of the attributes in the user editor:

<figure><img src="/files/4uGnIjtKx5UTZk8ku223" alt=""><figcaption><p>Change user credentials</p></figcaption></figure>

## File-based identity provider

There is a configuration file `./snow-owl/docker/configs/snowowl/users` that contains the list of users with their credentials encrypted. This method of authentication should be used for testing or internal purposes only, users added here will have elevated privileges.

{% hint style="warning" %}
To apply any changes made to the `users` file the Terminology Server has to be restarted afterward.
{% endhint %}

### Grant user access

To grant access the `users` file has to be amended with the new user and its credentials. There are several ways to encrypt a password but here is one that is easy and available on most of the Linux variants. The package called `htpasswd` has to be installed:

```bash
htpasswd -nBC 10 my-new-username | head -n1 | sed 's/$2y/$2a/g' >> ./snow-owl/docker/configs/snowowl/users
```

It will prompt for the password and will amend the file with the new user at the end.

### Revoke user access

Simply remove the user's line from the file and restart the service.

### Change credentials

Remove the user's line from the file and regenerate the credentials according to the [Grant user access](#grant-user-access-1) section.&#x20;


---

# 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://docs.b2ihealthcare.com/snow-owl/setup-and-administration/user-management.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.
