|
| 1 | +# Layered Solution: Authentication |
| 2 | + |
| 3 | +```json |
| 4 | +//[doc-nav] |
| 5 | +{ |
| 6 | + "Previous": { |
| 7 | + "Name": "Built-In Features", |
| 8 | + "Path": "solution-templates/layered-web-application/built-in-features" |
| 9 | + }, |
| 10 | + "Next": { |
| 11 | + "Name": "Database configurations in the Layered solution", |
| 12 | + "Path": "solution-templates/layered-web-application/database-configurations" |
| 13 | + } |
| 14 | +} |
| 15 | +``` |
| 16 | + |
| 17 | +> Some of the features mentioned in this document may not be available in the free version. We're using the **\*** symbol to indicate that a feature is available in the **[Team](https://abp.io/pricing)** and **[Higher](https://abp.io/pricing)** licenses. |
| 18 | +
|
| 19 | +The [Layered solution template](index.md) is fully configured for authentication. All the services and applications are configured to use the [OpenIddict](https://documentation.openiddict.com) library for authentication. They are configured in a common way for authentication. This document explains that common authentication structure. |
| 20 | + |
| 21 | +If you choose the *Tiered* option while [creating](../../get-started/layered-web-application.md#creating-a-new-solution) the solution, the solution will have the `*.AuthServer` project. |
| 22 | + |
| 23 | +## OpenIddict |
| 24 | + |
| 25 | +[OpenIddict](https://documentation.openiddict.com) is an open-source library that provides a simple and easy way to implement an OpenID Connect server in your application. ABP has built-in modules ([OpenIddict](../../modules/openiddict.md), [OpenIddict UI **\***](../../modules/openiddict-pro.md)) to integrate OpenIddict into the solution. |
| 26 | + |
| 27 | +## Domain Layer |
| 28 | + |
| 29 | +The layered solution template *Domain* layer is the responsible for the OpenIddict definitions (Applications, Scopes, etc.). Also, it provides the *OpenIddictDataSeedContributor* class to seed the initial data. It creates the default clients (applications) and scopes for the solution. |
| 30 | + |
| 31 | +The [OpenIddict UI **\***](../../modules/openiddict-pro.md) module is added only if you choose the OpenIddict UI module while creating the solution. |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +The OpenIddict UI **\*** module provides a user interface to manage the OpenIddict entities such as applications, scopes, etc. You can manage these entities from the application UI. |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +## The Authentication Application |
| 40 | + |
| 41 | +The solution may include an external authentication server (`auth-server`) application if you select the *Tiered* option during solution creation. Otherwise, the authentication server is integrated into one of the [Web Applications](web-applications.md). |
| 42 | + |
| 43 | +The authentication server handles token generation, validation, and user account management (e.g., login, registration). It uses the [Account](../../modules/account.md) or [Account Pro **\***](../../modules/account-pro.md) module. The [Account Pro **\***](../../modules/account-pro.md) module additionally supports [social logins](../../modules/account-pro.md#social--external-logins) (e.g., Google, Facebook). Social logins can be enabled, disabled, and configured directly from the application's user interface. |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +## Authentication Flows |
| 48 | + |
| 49 | +Applications in the solution use different authentication flows depending on the application type: |
| 50 | + |
| 51 | +- **MVC UI Web Application**: |
| 52 | + Uses the [Hybrid Flow](https://openid.net/specs/openid-connect-core-1_0.html#HybridFlowAuth) (OpenID Connect Authentication) for user authentication. |
| 53 | +- **SPA and Swagger Applications**: |
| 54 | + Use the [Authorization Code Flow](https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth) to authenticate users. |
| 55 | + |
| 56 | +Once a user logs into the system and obtains a token from the authentication server, the `*.HttpApi.Host` application use [JWT Bearer Authentication](https://jwt.io/introduction/) to authorize the user's actions. |
0 commit comments