Skip to content

Commit 8dad580

Browse files
lcrillyroute443
authored andcommitted
Replace diagram images with Mermaid
1 parent bce5c22 commit 8dad580

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

README.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,24 @@ Reference implementation of NGINX Plus as relying party for OpenID Connect authe
66

77
This repository describes how to enable OpenID Connect integration for [NGINX Plus](https://www.nginx.com/products/nginx/). The solution depends on NGINX Plus components ([auth_jwt module](http://nginx.org/en/docs/http/ngx_http_auth_jwt_module.html) and [key-value store](http://nginx.org/en/docs/http/ngx_http_keyval_module.html)) and as such is not suitable for [open source NGINX](http://www.nginx.org/en).
88

9-
<img src=https://www.nginx.com/wp-content/uploads/2018/04/dia-LC-2018-03-30-OpenID-Connect-authorization-code-flow-NGINX-800x426-03.svg alt="OpenID Connect components" width=500>
10-
9+
```mermaid
10+
flowchart BT
11+
subgraph " "
12+
direction LR
13+
id1(User)==>|Request for app|id2
14+
id2-. Unauthenticated .->id1
15+
id2(NGINX+)-->|Authenticated|id3(Backend app)
16+
end
17+
subgraph IDP
18+
id4(Authorization Server)
19+
end
20+
id1<-. User authenticates directly with IdP .->IDP
21+
IDP<-. NGINX exchanges authorization code for ID token .->id2
22+
style id1 fill:#fff,stroke:#444,stroke-width:3px,color:#222
23+
style id3 fill:#fff,stroke:#444,stroke-width:3px,color:#222
24+
style id2 fill:#009639,stroke:#215732,stroke-width:2px,color:#fff
25+
style id4 fill:#666,stroke:#222,stroke-width:1px,color:#fff
26+
```
1127
`Figure 1. High level components of an OpenID Connect environment`
1228

1329
This implementation assumes the following environment:
@@ -19,7 +35,31 @@ This implementation assumes the following environment:
1935

2036
With this environment, both the client and NGINX Plus communicate directly with the IdP at different stages during the initial authentication event.
2137

22-
![OpenID Connect protocol diagram](https://www.nginx.com/wp-content/uploads/2018/04/dia-LC-2018-03-30-OpenID-Connect-authentication-code-flow-detailed-800x840-03.svg)
38+
```mermaid
39+
sequenceDiagram
40+
autonumber
41+
actor User
42+
participant Browser
43+
participant IdP
44+
participant NGINX Plus
45+
participant Web App
46+
User->>NGINX Plus: Requests protected resource
47+
NGINX Plus->>Browser: Sends redirect to IdP for authentication
48+
Browser->>IdP: Requests login page
49+
User->>IdP: Provides authentication and consent
50+
IdP->>Browser: Sends redirect w/ authZ code
51+
Browser->>NGINX Plus: Redirected for code exchange
52+
NGINX Plus->>IdP: Sends authZ code
53+
IdP->>NGINX Plus: Sends ID(+refresh) token
54+
NGINX Plus-->>NGINX Plus: Validates ID token, stores in keyval, creates session cookie
55+
Note right of NGINX Plus: keyvals zone for ID token (JWT)
56+
Note right of NGINX Plus: keyval zone for refresh token
57+
NGINX Plus->>Browser: Sends redirect to original URI with session cookie
58+
Browser->>NGINX Plus: Requests original URI, supplies session cookie
59+
NGINX Plus-->>NGINX Plus: Obtains ID token from keyval, validates JWT
60+
NGINX Plus->>Web App: Proxies request
61+
Web App->>Browser: Sends resource
62+
```
2363
`Figure 2. OpenID Connect authorization code flow protocol`
2464

2565
NGINX Plus is configured to perform OpenID Connect authentication. Upon a first visit to a protected resource, NGINX Plus initiates the OpenID Connect authorization code flow and redirects the client to the OpenID Connect provider (IdP). When the client returns to NGINX Plus with an authorization code, NGINX Plus exchanges that code for a set of tokens by communicating directly with the IdP.

0 commit comments

Comments
 (0)