> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/local-governance/v2.7/platform/configure-digit/services-overview/core-services/user-services.md).

# User Services

## Overview

User service is responsible for user data management and providing functionality to login and logout into the DIGIT system

## Pre-requisites

Before you proceed with the configuration, make sure the following pre-requisites are met -

* Java 8
* Kafka server is up and running
* Encryption and MDMS services are running
* PSQL server is running and a database
* Redis is running

## Key Functionalities

* Store, update and search user data
* Provide authentication
* Provide login and logout functionality into the DIGIT platform
* Store user data PIIs in encrypted form

## Interaction Diagram

![](/files/-MHHNpz4unN1G1Da-qIi)

## Deployment Details

1. Setup latest version of egov-enc-service and egov-mdms- service
2. Deploy the latest version of egov-user service
3. Add Role-Action mapping for APIs

## Configuration Details

The following application properties file in user service are configurable.

| Property                                  | Value  | Remarks                                            |
| ----------------------------------------- | ------ | -------------------------------------------------- |
| egov.user.search.default.size             | 10     | default search record number limit                 |
| citizen.login.password.otp.enabled        | true   | whether citizen login otp based                    |
| employee.login.password.otp.enabled       | false  | whether employee login otp based                   |
| citizen.login.password.otp.fixed.value    | 123456 | fixed otp for citizen                              |
| citizen.login.password.otp.fixed.enabled  | false  | allow fixed otp for citizen                        |
| otp.validation.register.mandatory         | true   | whether otp compulsory for registration            |
| access.token.validity.in.minutes          | 10080  | validity time of access token                      |
| refresh.token.validity.in.minutes         | 20160  | validity time of refresh token                     |
| default.password.expiry.in.days           | 90     | expiry date of a password                          |
| account.unlock.cool.down.period.minutes   | 60     | unlock time                                        |
| max.invalid.login.attempts.period.minutes | 30     | window size for counting attempts for lock         |
| max.invalid.login.attempts                | 5      | max failed login attempts before account is locked |
| egov.state.level.tenant.id                | pb     |                                                    |

## Integration Details

### Integration Scope

User data management and functionality to login and logout into Digit system using OTP and password.

### Integration Benefits

Providing the following functionality to citizen and employee-type users

* Employee:
  * User registration
  * Search user
  * Update user details
  * Forgot password
  * Change password
  * User role mapping(Single ULB to multiple roles)
  * Enable employees to login into the DIGIT system based on a password.
* Citizen:
  * Create user
  * Update user
  * Search user
  * User registration using OTP
  * OTP based login

### Steps to Integration

* To integrate, the host of egov-user should be overwritten in the helm chart.
* Use /citizen/\_create and /users/\_createnovalidate endpoints for creating users into the system
* Use /v1/\_search and /\_search endpoints to search users in the system depending on various search parameters
* Use /profile/\_update for partial update and /users/\_updatenovalidate for update
* Use /password/nologin/\_update for otp based password reset and /password/\_update for logged in user password reset
* Use /user/oauth/token for generating token, /\_logoutfor logout and /\_details for getting user information from his token

## Reference Docs

### Doc Links

{% file src="/files/-MMu6146UUwLAdiuaVa0" %}
User Data Encryption Promotion Details
{% endfile %}

{% file src="/files/-MMu6148oysAGotoEh-F" %}
Encryption Service
{% endfile %}

### API List

| Description                | Link                                                          |
| -------------------------- | ------------------------------------------------------------- |
| /citizen/\_create          | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /users/\_createnovalidate  | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /\_search                  | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /v1/\_search               | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /\_details                 | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /users/\_updatenovalidate  | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /profile/\_update          | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /password/\_update         | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /password/nologin/\_update | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /\_logout                  | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |
| /user/oauth/token          | <https://www.getpostman.com/collections/15443fcb25c8aacd8897> |

[![Creative Commons License](https://i.creativecommons.org/l/by/4.0/80x15.png)](http://creativecommons.org/licenses/by/4.0/)All content on this page by [eGov Foundation ](https://egov.org.in/)is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.digit.org/local-governance/v2.7/platform/configure-digit/services-overview/core-services/user-services.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
