Skip to content

Commit e26bab6

Browse files
committed
created empty documents
1 parent 4d6ce67 commit e26bab6

4 files changed

+237
-0
lines changed

docs/en/Infrastructure-Core-Angular-Identity-Server4-Integration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Identity Server 4 Integration
22

3+
**\*\*IMPORTANT NOTICE\*\***
4+
Identity Server 4 maintainance stopped on November 2022, see [official announcement](https://identityserver4.readthedocs.io/en/latest/). Because of that, it is removed from ASP.NET Zero. We suggest migrating to OpenIddict. Check out ASP.NET Zero's [OpenIddict integration document](Infrastructure-Core-Angular-OpenIddict-Integration.md).
5+
36
[IdentityServer4](http://identityserver.io/) is an OpenID Connect and OAuth 2.0 framework for ASP.NET Core. ASP.NET Zero is integrated to IdentityServer4. It's **disabled by default**. Its located in `*.Web.Host` project.
47

58
## Configuration
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Identity Server 4 Integration
2+
3+
**\*\*IMPORTANT NOTICE\*\***
4+
Identity Server 4 maintainance stopped on November 2022, see [official announcement](https://identityserver4.readthedocs.io/en/latest/). Because of that, it is removed from ASP.NET Zero. We suggest migrating to OpenIddict. Check out ASP.NET Zero's [OpenIddict integration document](Infrastructure-Core-Angular-OpenIddict-Integration.md).
5+
6+
[IdentityServer4](http://identityserver.io/) is an OpenID Connect and OAuth 2.0 framework for ASP.NET Core. ASP.NET Zero is integrated to IdentityServer4. It's **disabled by default**. Its located in `*.Web.Host` project.
7+
8+
## Configuration
9+
10+
You can enable/disable or configure it from **appsettings.json** file
11+
12+
```json
13+
"IdentityServer": {
14+
"IsEnabled": "false",
15+
"Clients": [
16+
{
17+
"ClientId": "client",
18+
"AllowedGrantTypes": [ "password" ],
19+
"ClientSecrets": [
20+
{
21+
"Value": "def2edf7-5d42-4edc-a84a-30136c340e13"
22+
}
23+
],
24+
"AllowedScopes": [ "default-api" ]
25+
},
26+
{
27+
"ClientId": "demo",
28+
"ClientName": "MVC Client Demo",
29+
"AllowedGrantTypes": [ "hybrid", "client_credentials" ],
30+
"RequireConsent": "true",
31+
"ClientSecrets": [
32+
{
33+
"Value": "def2edf7-5d42-4edc-a84a-30136c340e13"
34+
}
35+
],
36+
"RedirectUris": [ "http://openidclientdemo.com:8001/signin-oidc" ],
37+
"PostLogoutRedirectUris": [ "http://openidclientdemo.com:8001/signout-callback-oidc" ],
38+
"AllowedScopes": [ "openid", "profile", "email", "phone", "default-api" ],
39+
"AllowOfflineAccess": "true"
40+
}
41+
]
42+
}
43+
```
44+
45+
## Testing with Client
46+
47+
ASP.NET Zero solution has a sample console application (ConsoleApiClient) that can connects to the application, authenticates through IdentityServer4 and calls an API.
48+
49+
50+
51+
## Testing with MVC Client
52+
53+
You can use [aspnet-zero-samples](https://github.com/aspnetzero/aspnet-zero-samples) -> `IdentityServerClient` project to test identity server with MVC client.
54+
55+
Add a new client to `*.Web.Host` appsettings.json
56+
57+
```json
58+
...
59+
{
60+
"ClientId": "mvcdemo",
61+
"ClientName": "MVC Client Demo 2",
62+
"AllowedGrantTypes": [ "implicit", "client_credentials" ],
63+
"RequireConsent": "true",
64+
"ClientSecrets": [
65+
{
66+
"Value": "mysecret"
67+
}
68+
],
69+
"RedirectUris": [ "http://localhost:62964/signin-oidc" ],
70+
"PostLogoutRedirectUris": [ "http://localhost:62964/signout-callback-oidc" ],
71+
"AllowedScopes": [ "openid", "profile", "email", "phone", "default-api" ],
72+
"AllowOfflineAccess": "true"
73+
}
74+
...
75+
```
76+
77+
Download the `IdentityServerClient` project and open it's `Startup.cs` and modify `AddOpenIdConnect` area as seen below
78+
79+
```csharp
80+
...
81+
.AddOpenIdConnect("oidc", options =>
82+
{
83+
options.SignInScheme = "Cookies";
84+
85+
options.Authority = "https://localhost:44301";//change with your project url
86+
options.RequireHttpsMetadata = false;
87+
88+
options.ClientId = "mvcdemo";
89+
options.ClientSecret = "mysecret";
90+
91+
options.SaveTokens = true;
92+
});
93+
...
94+
```
95+
96+
97+
98+
That is all. Now you can test it.
99+
100+
Run both projects. Go to `IdentityServerClient` project's secure. <img src="images/identity-server-4-test-mvc-secure.png">
101+
102+
It will redirect you to the login page.
103+
104+
<img src="images/identity-server-4-test-host-login.png">
105+
106+
After you successfully login, you will see the consent page. <img src="images/identity-server-4-test-host-consent.png">
107+
108+
After you allow consents, you will redirect to the secure page and get user claims. <img src="images/identity-server-4-test-mvc-secure-after-login.png">
109+
110+
## OpenId Connect Integration
111+
112+
Once IdentityServer4 integration is enabled Web.Mvc application becomes an OpenId Connect server. That means another web application can use standard OpenId Connect protocol to authenticate users with your
113+
application and get permission to share their information (a.k.a. consent screen).
114+
115+
## More
116+
117+
See [IdentityServer4's own documentation](http://docs.identityserver.io/en/latest/) to understand and configure IdentityServer4.

docs/en/Infrastructure-Core-Mvc-Identity-Server4-Integration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Identity Server 4 Integration
22

3+
**\*\*IMPORTANT NOTICE\*\***
4+
Identity Server 4 maintainance stopped on November 2022, see [official announcement](https://identityserver4.readthedocs.io/en/latest/). Because of that, it is removed from ASP.NET Zero. We suggest migrating to OpenIddict. Check out ASP.NET Zero's [OpenIddict integration document](Infrastructure-Core-Mvc-OpenIddict-Integration.md).
5+
36
[IdentityServer4](http://identityserver.io/) is an OpenID Connect and OAuth 2.0 framework for ASP.NET Core. ASP.NET Zero is integrated to IdentityServer4. It's **enabled by default**.
47

58
## Configuration
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Identity Server 4 Integration
2+
3+
[OpenIddict](https://documentation.openiddict.com/) aims at providing a versatile solution to implement OpenID Connect client, server and token validation support in any ASP.NET Core 2.1 (and higher) application.
4+
5+
## Configuration
6+
7+
You can enable/disable or configure it from **appsettings.json** file
8+
9+
```json
10+
"OpenIddict": {
11+
"IsEnabled": "true",
12+
"Applications": [{
13+
"ClientId": "client",
14+
"ClientSecret": "def2edf7-5d42-4edc-a84a-30136c340e13",
15+
"DisplayName": "AbpZeroTemplate_App",
16+
"ConsentType": "Explicit",
17+
"RedirectUris": ["https://oauthdebugger.com/debug"],
18+
"PostLogoutRedirectUris": [],
19+
"Scopes": [
20+
"default-api",
21+
"profile"
22+
],
23+
"Permissions": [
24+
"ept:token",
25+
"ept:authorization",
26+
"gt:password",
27+
"gt:client_credentials",
28+
"gt:authorization_code",
29+
"rst:code",
30+
"rst:code id_token"
31+
]
32+
}]
33+
}
34+
```
35+
36+
## Testing with Client
37+
38+
ASP.NET Zero solution has a sample console application (ConsoleApiClient) that can connects to the application, authenticates through IdentityServer4 and calls an API.
39+
40+
41+
42+
## Testing with MVC Client
43+
44+
You can use [aspnet-zero-samples](https://github.com/aspnetzero/aspnet-zero-samples) -> `IdentityServerClient` project to test identity server with mvc client.
45+
46+
Add a new client to `*.Web.Mvc` appsettings.json
47+
48+
```json
49+
...
50+
{
51+
"ClientId": "mvcdemo",
52+
"ClientName": "MVC Client Demo 2",
53+
"AllowedGrantTypes": [ "implicit", "client_credentials" ],
54+
"RequireConsent": "true",
55+
"ClientSecrets": [
56+
{
57+
"Value": "mysecret"
58+
}
59+
],
60+
"RedirectUris": [ "http://localhost:62964/signin-oidc" ],
61+
"PostLogoutRedirectUris": [ "http://localhost:62964/signout-callback-oidc" ],
62+
"AllowedScopes": [ "openid", "profile", "email", "phone", "default-api" ],
63+
"AllowOfflineAccess": "true"
64+
}
65+
...
66+
```
67+
68+
Download the `IdentityServerClient` project and open it's `Startup.cs` and modify `AddOpenIdConnect` area as seen below
69+
70+
```csharp
71+
...
72+
.AddOpenIdConnect("oidc", options =>
73+
{
74+
options.SignInScheme = "Cookies";
75+
76+
options.Authority = "https://localhost:44302";//change with your project url
77+
options.RequireHttpsMetadata = false;
78+
79+
options.ClientId = "mvcdemo";
80+
options.ClientSecret = "mysecret";
81+
82+
options.SaveTokens = true;
83+
});
84+
...
85+
```
86+
87+
88+
89+
That is all. Now you can test it.
90+
91+
Run both projects. Go to `IdentityServerClient `project's secure .
92+
93+
<img src="images/identity-server-4-test-mvc-secure.png">
94+
95+
It will redirect you to the login page.
96+
97+
<img src="images/identity-server-4-test-mvc-login.png">
98+
99+
After you successfully, login you will see the consent page.
100+
101+
<img src="images/identity-server-4-test-mvc-consent.png">
102+
103+
After you allow consents, you will redirect to secure page and get user claims.
104+
105+
<img src="images/identity-server-4-test-mvc-secure-after-login.png">
106+
107+
## OpenId Connect Integration
108+
109+
Once IdentityServer4 integration is enabled Web.Mvc application becomes an OpenId Connect server. That means another web application can use standard OpenId Connect protocol to authenticate users with your
110+
application and get permission to share their information (a.k.a. consent screen).
111+
112+
## More
113+
114+
See [IdentityServer4's own documentation](http://docs.identityserver.io/en/latest/) to understand and configure IdentityServer4.

0 commit comments

Comments
 (0)