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/tutorials/2.devops/2.auth-and-access-control/0.api-keys.md
+46-8Lines changed: 46 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,20 @@
2
2
3
3
## Introduction
4
4
5
-
API Keys can be used by external applications to access DIAL Core resources such as models, applications, toolsets and routes. DIAL Core uses them for server-to-server authentication and access control. In this document, you can learn how to define API keys, give access to resources in DIAL and define access limits.
5
+
API Keys can be used by external applications to access DIAL Core resources such as models, applications, toolsets and routes. DIAL Core uses them for server-to-server authentication and access control.
6
+
7
+
You can define API key in DIAL Admin and via a direct configuration of DIAL Core. This document describes how to add and configure API keys in DIAL Core.
8
+
9
+
> * Refer to [DIAL Admin](/docs/tutorials/3.admin/access-management-keys.md) to learn how to add and manage API keys via the administrator UI.
10
+
> * Refer to [DIAL Core](https://github.com/epam/ai-dial-core/blob/development/docs/dynamic-settings/keys.md) to see the complete configuration example.
6
11
7
12
## Step 1: Define API Keys
8
13
9
14
To use API keys, you need to define them. API keys can be defined in DIAL Core dynamic settings and by DIAL administrators in [DIAL Admin](/docs/tutorials/3.admin/access-management-keys.md).
10
15
11
16
##### DIAL Core configuration
12
17
13
-
API keys can be defined in the `keys.<core_key>` section in the [DIAL Core configuration file](https://github.com/epam/ai-dial-core/blob/development/docs/dynamic-settings/keys.md).
18
+
API keys can be defined in the `keys.<core_key>` section in the [aidial.config.json](https://github.com/epam/ai-dial-core/blob/development/sample/aidial.config.json) configuration file.
14
19
15
20
> Refer to [DIAL Core documentation](https://github.com/epam/ai-dial-core/blob/development/docs/dynamic-settings/keys.md) to get familiar with the description of the configuration parameters of API keys.
16
21
@@ -39,16 +44,14 @@ Access control in DIAL rests upon the concept of Objects of access (what we prot
39
44
40
45
API Keys are Subjects used by external applications to access DIAL Core resources. DIAL Core uses them for server-to-server authentication and access control.
41
46
47
+
The configuration in the previous step gives access to a private space of API key and resources in the public space that are not limited by roles or available for a role `"myRole"`.
48
+
42
49
> * Refer to [Authentication](/docs/platform/3.core/1.auth-intro.md) to learn more about authentication in DIAL.
43
50
> * Refer to [Access Control](/docs/platform/3.core/2.access-control-intro.md) to learn more about access control in DIAL.
44
51
45
-
The configuration in the previous step gives access to for a private space of API key and resources in the public space that are not limited by roles or available for a role `"myRole"`.
46
-
47
-
> Refer to [Access Control](/docs/platform/3.core/2.access-control-intro.md) to learn more about access control in DIAL.
48
-
49
52
##### DIAL Core configuration
50
53
51
-
To provide access to additional resources in DIAL Core, you need to associate the role assigned to the API key with specific resources. You can do this by adding the API key role to the `userRoles` parameter of a corresponding deployment in DIAL Core configuration.
54
+
To provide access to additional resources in DIAL Core, you need to associate the role assigned to the API key with specific resources. You can do this by adding the API key role to the `userRoles` parameter of a corresponding deployment (e.g. application or AI model) in DIAL Core configuration.
52
55
53
56
In the following example, the `"myRole"` role is granted access to the `chat-gpt-35-turbo` language model. Using the same pattern, you can define user access to [applications](https://github.com/epam/ai-dial-core/blob/development/docs/dynamic-settings/applications.md), [toolset](https://github.com/epam/ai-dial-core/blob/development/docs/dynamic-settings/toolsets.md) and [routes](https://github.com/epam/ai-dial-core/blob/development/docs/dynamic-settings/routes.md).
54
57
@@ -284,6 +287,40 @@ Sharing limits can be defined in the `roles.<role_name>.share` section of the DI
284
287
}
285
288
}
286
289
```
290
+
### IP Address Range
291
+
292
+
For security purposes, you can restrict the usage of API keys to certain networks by defining `allowedIpAddressRanges` with a list of allowed IP addresses in the `keys.<key_name>` section of the DIAL Core dynamic settings.
293
+
294
+
295
+
##### DIAL Core configuration
296
+
297
+
> Refer to [DIAL Core documentation](https://github.com/epam/ai-dial-core/blob/development/docs/dynamic-settings/keys.md) to see configuration guidelines.
298
+
299
+
A list of allowed IP addresses can be defined in the `keys.<key_name>.allowedIpAddressRanges` section of the DIAL Core dynamic settings.
300
+
301
+
Any provided IP address (IPv4 or IPv6) must follow a CIDR notation in form of: `ip_address/prefix`, where
302
+
303
+
*`ip_address`: string representation of IP address.
304
+
*`prefix`: number of consecutive leading 1 bits in the network mask.
***undefined**: Client from any IP address can use the API key.
319
+
*`null ` (default): Client from any IP address can use the API key.
320
+
***empty list**: API key is not usable from any IP address.
321
+
***a list is defined**: Client from the specified IP addresses can use the API key.
322
+
323
+
If a client tries to access DIAL Core using the API key from an IP address which is out of the range, DIAL Core returns HTTP error code: `403(Forbidden) Access is forbidden from IP address {}`
287
324
288
325
## Full Configuration Example
289
326
@@ -292,7 +329,8 @@ Sharing limits can be defined in the `roles.<role_name>.share` section of the DI
0 commit comments