Skip to content

Commit

Permalink
Merge pull request #21648 from abpframework/doc/startup-template
Browse files Browse the repository at this point in the history
Startup template `Layered Solution` revisions
  • Loading branch information
EngincanV authored Dec 17, 2024
2 parents d9dd819 + 56c4645 commit 3a67f27
Show file tree
Hide file tree
Showing 50 changed files with 1,858 additions and 493 deletions.
16 changes: 16 additions & 0 deletions docs/en/get-started/microservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@
In this quick start guide, you will learn how to create and run a microservice solution using [ABP Studio](../studio/index.md).

## Setup your development environment

First things first! Let's setup your development environment before creating the first project.

### Pre-requirements

The following tools should be installed on your development machine:

* [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) or another IDE that supports .NET development
* [.NET 9.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
* [Node v22.11+](https://nodejs.org/)
* [Docker Desktop with Kubernetes](https://www.docker.com/products/docker-desktop/)
* [helm](https://helm.sh/docs/intro/install/)
* [NGINX Ingress Controller](https://kubernetes.github.io/ingress-nginx/deploy/)
* [mkcert](https://github.com/FiloSottile/mkcert#installation)

## Creating a New Solution

> 🛈 This document uses [ABP Studio](../studio/index.md) to create new ABP solutions. **ABP Studio** is in the beta version now. If you have any issues, you can use the [ABP CLI](../cli/index.md) to create new solutions. You can also use the [getting started page](https://abp.io/get-started) to easily build ABP CLI commands for new project creations.
Expand Down
465 changes: 465 additions & 0 deletions docs/en/solution-templates/layered-web-application/_index.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Layered Solution: Authentication

```json
//[doc-nav]
{
"Previous": {
"Name": "Built-In Features",
"Path": "solution-templates/layered-web-application/built-in-features"
},
"Next": {
"Name": "Database configurations in the Layered solution",
"Path": "solution-templates/layered-web-application/database-configurations"
}
}
```

> 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.
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.

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.

## OpenIddict

[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.

## Domain Layer

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.

The [OpenIddict UI **\***](../../modules/openiddict-pro.md) module is added only if you choose the OpenIddict UI module while creating the solution.

![new-solution-openiddict-module](images/new-solution-openiddict-module.png)

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.

![openiddict-ui](images/openiddict-ui.png)

## The Authentication Application

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).

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.

![account-external-provider](images/account-external-provider.png)

## Authentication Flows

Applications in the solution use different authentication flows depending on the application type:

- **MVC UI Web Application**:
Uses the [Hybrid Flow](https://openid.net/specs/openid-connect-core-1_0.html#HybridFlowAuth) (OpenID Connect Authentication) for user authentication.
- **SPA and Swagger Applications**:
Use the [Authorization Code Flow](https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth) to authenticate users.

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.
49 changes: 49 additions & 0 deletions docs/en/solution-templates/layered-web-application/blob-storing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Layered Solution: BLOB Storing

```json
//[doc-nav]
{
"Previous": {
"Name": "Multi-Tenancy",
"Path": "solution-templates/layered-web-application/multi-tenancy"
},
"Next": {
"Name": "CORS Configuration",
"Path": "solution-templates/layered-web-application/cors-configuration"
}
}
```

> 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.
This document explains how to store BLOBs (Binary Large Objects) in a layered solution. It is common to store files, images, videos, and other large objects in a distributed system. You can learn more about BLOB storage in the [BLOB Storing System](../../framework/infrastructure/blob-storing/index.md) documentation.

In the layered solution template, the [Database Provider](../../framework/infrastructure/blob-storing/database.md) is used to store BLOBs in the database. The `Volo.Abp.BlobStoring.Database.EntityFrameworkCore` or `Volo.Abp.BlobStoring.Database.MongoDB` package provides the necessary implementations to store and retrieve BLOBs in the database. This setup is integrated into the layered solution template and is used in all related projects. You can change the database configuration in the `appsettings.json` file of the related project.

You can use the `IBlobContainer` or `IBlobContainer<T>` service to store and retrieve BLOBs. Here is an example of storing a BLOB:

```csharp
public class MyService : ITransientDependency
{
private readonly IBlobContainer _blobContainer;

public MyService(IBlobContainer blobContainer)
{
_blobContainer = blobContainer;
}

public async Task SaveBytesAsync(byte[] bytes)
{
await _blobContainer.SaveAsync("my-blob-1", bytes);
}

public async Task<byte[]> GetBytesAsync()
{
return await _blobContainer.GetAllBytesOrNullAsync("my-blob-1");
}
}
```

The *File Management* module is optional and can be added to the solution during the creation process. It provides a user interface to manage folders and files. You can learn more about the module in the [File Management *](../../modules/file-management.md) document.

![file-management](images/file-management-index-page.png)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Layered Solution: Built-In Features

```json
//[doc-nav]
{
"Previous": {
"Name": "Mobile Applications",
"Path": "solution-templates/layered-web-application/mobile-applications"
},
"Next": {
"Name": "Authentication",
"Path": "solution-templates/layered-web-application/authentication"
}
}
```

The Layered solution template includes several built-in features to help you get started with your layered web application. These features are designed to provide a solid foundation for your application and help you focus on your business logic. This document provides an overview of the built-in features included in the Layered solution template. The following documents explains these features in details:

* [Authentication](authentication.md)
* [Database configurations](database-configurations.md)
* [Logging (with Serilog)](logging.md)
* [Swagger integration](swagger-integration.md)
* [Multi-Tenancy](multi-tenancy.md)
* [BLOB storing](blob-storing.md)
* [CORS configuration](cors-configuration.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Layered Solution: CORS Configuration

```json
//[doc-nav]
{
"Previous": {
"Name": "BLOB Storing",
"Path": "solution-templates/layered-web-application/blob-storing"
},
"Next": {
"Name": "Helm Charts and Kubernetes",
"Path": "solution-templates/layered-web-application/helm-charts-and-kubernetes"
}
}
```

Cross-Origin Resource Sharing (CORS) is a security feature that allows web applications to make requests to a different domain than the one that served the web page.

In the layered solution template, CORS configuration is applied in the following cases:
- If you select the [Tiered solution](solution-structure.md#tiered-structure-).
- If you choose [Angular](web-applications.md#angular) as the web application type.
- If you choose [No UI](web-applications.md#no-ui) as the web application type.

The CORS settings are configured in the `appsettings.json` file of the corresponding project. Typically, the web application serves as the entry point for front-end applications, so it must be configured to accept requests from different origins.

The default configuration in `appsettings.json` is as follows:

```json
{
"App": {
"CorsOrigins": "https://*.MyProjectName.com"
}
}
```

You can modify the `CorsOrigins` property to include additional domains or wildcard subdomains as required by your application.
Loading

0 comments on commit 3a67f27

Please sign in to comment.