You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/admin/admin-ui/auth-server-interaction.md
+59-44Lines changed: 59 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,63 +91,78 @@ Gluu Flex Admin UI->>Gluu Flex Admin UI: extract & store claims from UJWT
91
91
92
92
```
93
93
94
-
## API Protection and Scopes
95
-
96
-
To ensure security and access control, Gluu Flex Admin UI leverages API protection and scopes:
94
+
## Accessing Config-API Endpoints
97
95
98
-
1. The Jans Config API's endpoints are protected and can only be accessed using a token (`AT2`) with the required scopes.
99
-
2. To generate an AT2, the frontend requests the Token Server via the backend. **The Token Server and Authorization Server can be the same or different.**
100
-
3. The Token Server employs an update-token script that validates the UJWT and refers to the role-scope mapping in the Token Server persistence.
101
-
4. The update-token script validates the UJWT and includes the appropriate scopes in AT2 based on the user's role.
102
-
5. The frontend receives AT2 and associated scopes from the backend.
103
-
6. The scopes provided in AT2 determine which Config API–protected endpoints the Admin UI can access. Refer this [doc](./access-control.md) for GUI access control.
96
+
To access Config API endpoints, Admin UI Backend generates client_credentials token by following below steps:
97
+
98
+
1. Admin UI Frontend calls **POST**`/session` endpoint of Admin UI Backend by passing User-Info JWT (UJWT) as parameter.
99
+
2. The Admin UI backend verifies the signature of the UJWT. If the signature is valid, it creates session cookie with a random Session ID. Store the mapping of Session ID and UJWT along with created_date and expiry_date into the Jans persistence (in `adminUISession` table).
100
+
3. The session cookie is sent back to Admin UI Frontend in response and is stored in browser.
101
+
4. For making any request to Config API endpoints the Admin UI Frontend (Browser) will call Config API endpoint. The session cookie will be automatically paired with the request.
102
+
5. The Admin UI Backend will intercept the request. It will check if the valid session cookie is present in request.
103
+
6. Admin UI Backend will verify the cookie's Session ID presence in `adminUISession` table. Also fetch UJWT of the record from table.
104
+
7. If the session cookie is valid then Admin UI Backend will generate client_credentials token (AT2).
105
+
8. To generate an AT2, the backend requests the Token Server. **The Token Server and Authorization Server can be the same or different.**
106
+
9. The Token Server employs an `update-token script` that validates the UJWT and refers to the role-scope mapping in the persistence.
107
+
10. The update-token script validates the UJWT and includes the appropriate scopes in AT2 based on the user's role.
108
+
11. The AT2 will be used to call Config API endpoint.
109
+
12. The response obtained from Config API will be sent back to the Admin UI Frontend (Browser).
110
+
13. If the cookie's Session ID is not presence in `adminUISession` table, send **403-Forbidden** error in response asking Admin UI to force logout.
104
111
105
112
```mermaid
106
-
107
113
sequenceDiagram
108
-
title License Verification
109
-
autonumber
110
-
actor User
114
+
title Accessing Config API Endpoints
115
+
autonumber
116
+
117
+
actor User
118
+
participant Browser as Admin UI (Browser)
119
+
participant Backend as Admin UI Backend
120
+
participant ConfigAPI as Config API
121
+
122
+
User->>Browser: Login
123
+
Browser->>Backend: POST /session
124
+
Note right of Browser: userinfo JWT (UJWT)
125
+
126
+
Backend->>Backend: Verify UJWT
127
+
Backend->>Backend: Create session cookie with opaque SessionID
128
+
Backend->>Backend: Persist mapping of SessionID ↔ UJWT
129
+
Backend->>Browser: Set session cookie
130
+
Note right of Browser: Cookie stored in browser
131
+
132
+
Browser->>Backend: Call Config API endpoints
133
+
Note right of Browser: Session cookie
134
+
Backend->>Backend: check if session cookie is present in request
135
+
Backend->>Backend: clear expired Admin UI sessions from persistence (ran after at least 5 minutes)
136
+
Backend->>Backend: checks presence of session in cache or database
Jans Token Server->>Jans Token Server: Verify ujwt
115
-
Jans Token Server->>Jans Token Server: Add scopes to token based on role (AT2)
116
-
Jans Token Server->>Admin UI Backend: AT2
117
-
Admin UI Backend->>Gluu Flex Admin UI: AT2
118
-
Gluu Flex Admin UI->>Gluu Flex Admin UI:extracts scopes from AT2
119
-
Gluu Flex Admin UI->>Gluu Flex Admin UI: AT2 determine which Config API–protected endpoints the Admin UI can access
120
147
```
121
-
## Accessing Config-API Endpoints
122
-
123
-
To access config-api endpoints, the following steps are taken:
124
-
125
-
1. The Admin UI frontend requests AT2 from the Token Server through the backend.
126
-
2. Armed with AT2, the frontend sends a request to the desired Jans Config API endpoint. AT2 is included in the authorization header, along with other request parameters.
127
-
3. At the Jans Config API, AT2 is validated, and the provided scopes are verified to ensure the necessary scope for the requested endpoint is present.
128
-
4. If the above steps are successful, the requested data is fetched from the Jans Config API and forwarded to the frontend.
129
148
130
149
```mermaid
131
150
132
151
sequenceDiagram
133
-
title License Verification
152
+
title Details of generation of AT2
134
153
autonumber
135
154
actor User
155
+
participant Backend as Admin UI Backend
156
+
participant JansServer as Jans Token Server
157
+
participant Script as Update Token Script
158
+
159
+
Backend->>JansServer: /token
160
+
Note right of Backend: UJWT
161
+
JansServer->>Script: Verify UJWT
162
+
Script->>Script: Add scopes to token based on role (AT2)
0 commit comments