aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilyakharev <ilyakharev@ydb.tech>2023-10-03 11:24:28 +0300
committerilyakharev <ilyakharev@ydb.tech>2023-10-03 11:54:43 +0300
commitfc96d0ea409e2b5d8ed1f2eef83af992fb5d5822 (patch)
tree0a2cc1941b510ac55a312d4ea21fbf514c6550b5
parentcda0c13f23f6b169fb0a49dc504b40a0aaecea09 (diff)
downloadydb-fc96d0ea409e2b5d8ed1f2eef83af992fb5d5822.tar.gz
Added static authentication
-rw-r--r--ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md1
-rw-r--r--ydb/docs/en/core/reference/ydb-sdk/feature-parity.md4
-rw-r--r--ydb/docs/en/core/reference/ydb-sdk/recipes/auth-static.md29
-rw-r--r--ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md1
-rw-r--r--ydb/docs/ru/core/reference/ydb-sdk/feature-parity.md4
-rw-r--r--ydb/docs/ru/core/reference/ydb-sdk/recipes/auth-static.md29
6 files changed, 62 insertions, 6 deletions
diff --git a/ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md b/ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md
index e7821cf34b..20c43e0a66 100644
--- a/ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md
+++ b/ydb/docs/en/core/reference/ydb-sdk/_includes/auth.md
@@ -80,6 +80,7 @@ You can click any of the methods below to go to the source code of an example in
| Metadata | [MetadataAuthentication()](https://github.com/ydb-platform/ydb-php-sdk#metadata-url) |
| Service Account Key | [JwtWithJsonAuthentication($jsonFilePath)](https://github.com/ydb-platform/ydb-php-sdk#jwt--json-file) or [JwtWithPrivateKeyAuthentication( $key_id, $service_account_id, $privateKeyFile )](https://github.com/ydb-platform/ydb-php-sdk#jwt--private-key) |
| Determined by environment variables | [EnvironCredentials()](https://github.com/ydb-platform/ydb-php-sdk#determined-by-environment-variables) |
+ | Static Credentials | [StaticAuthentication($user, $password)](https://github.com/ydb-platform/ydb-php-sdk#static-credentials) |
{% endlist %}
diff --git a/ydb/docs/en/core/reference/ydb-sdk/feature-parity.md b/ydb/docs/en/core/reference/ydb-sdk/feature-parity.md
index 6f09540c5d..29cc085f2d 100644
--- a/ydb/docs/en/core/reference/ydb-sdk/feature-parity.md
+++ b/ydb/docs/en/core/reference/ydb-sdk/feature-parity.md
@@ -22,7 +22,7 @@
| Load balancing across all nodes of all local DCs | \+ | \+ | \+ | ? | \- | \- | \- |
| **Credentials providers** |
| Anonymous (default) | \+ | \+ | \+ | \+ | \+ | ? | \+ | \+ |
-| Static (user - password) | \+ | \+ | \+ | \+ | \- | \- | \- | \- |
+| Static (user - password) | \+ | \+ | \+ | \+ | \- | \- | \- | \+ |
| Token: IAM, OAuth | \+ | \+ | \+ | \+ | \+ | \+ | \+ | \+ |
| Service account (Yandex.Cloud specific) | \+ | \+ | \+ | \+ | \+ | \+ | \- | \+ |
| Metadata (Yandex.Cloud specific) | \+ | \+ | \+ | \+ | \+ | \+ | \+ | \+ |
@@ -129,7 +129,7 @@
| \* environ | ? | ? | \+ | \+ | \+ | \- | | \+ |
| \* metadata | ? | ? | \+ | \+ | \+ | \+ | | \+ |
| \* service_account | ? | ? | \+ | \+ | \+ | \- | | \+ |
-| \* static (username \+ password) | ? | ? | \+ | \+ | \+ | \- | | \- |
+| \* static (username \+ password) | ? | ? | \+ | \+ | \+ | \- | | \+ |
| Basic (series) | \+ | ? | \+ | \+ | \+ | \+ | \+ | \+ |
| Bulk Upsert | \+/- | ? | \+ | \+ | \+ | \- | | \- |
| Containers (Struct,Variant,List,Tuple) | \- | ? | \+ | \- | \- | \+ | | \- |
diff --git a/ydb/docs/en/core/reference/ydb-sdk/recipes/auth-static.md b/ydb/docs/en/core/reference/ydb-sdk/recipes/auth-static.md
index d4970c2d7c..12e01ea91a 100644
--- a/ydb/docs/en/core/reference/ydb-sdk/recipes/auth-static.md
+++ b/ydb/docs/en/core/reference/ydb-sdk/recipes/auth-static.md
@@ -67,6 +67,33 @@ Below are examples of the code for authentication based on a username and token
- PHP
- {% include [feature is not implemented](_includes/wip.md) %}
+ ```php
+ <?php
+
+ use YdbPlatform\Ydb\Ydb;
+ use YdbPlatform\Ydb\Auth\Implement\StaticAuthentication;
+
+ $config = [
+
+ // Database path
+ 'database' => '/local',
+
+ // Database endpoint
+ 'endpoint' => 'localhost:2136',
+
+ // Auto discovery (dedicated server only)
+ 'discovery' => false,
+
+ // IAM config
+ 'iam_config' => [
+ 'insecure' => true,
+ // 'root_cert_file' => './CA.pem', // Root CA file (uncomment for dedicated server)
+ ],
+
+ 'credentials' => new StaticAuthentication($user, $password)
+ ];
+
+ $ydb = new Ydb($config);
+ ```
{% endlist %}
diff --git a/ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md b/ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md
index 65c3942b15..54e6da3ded 100644
--- a/ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md
+++ b/ydb/docs/ru/core/reference/ydb-sdk/_includes/auth.md
@@ -80,6 +80,7 @@
Metadata | [MetadataAuthentication()](https://github.com/ydb-platform/ydb-php-sdk#metadata-url)
Service Account Key | [JwtWithJsonAuthentication($jsonFilePath)](https://github.com/ydb-platform/ydb-php-sdk#jwt--json-file) или [JwtWithPrivateKeyAuthentication( $key_id, $service_account_id, $privateKeyFile )](https://github.com/ydb-platform/ydb-php-sdk#jwt--private-key)
Определяется по переменным окружения | [EnvironCredentials()](https://github.com/ydb-platform/ydb-php-sdk#determined-by-environment-variables)
+ Static Credentials | [StaticAuthentication($user, $password)](https://github.com/ydb-platform/ydb-php-sdk#static-credentials)
{% endlist %}
diff --git a/ydb/docs/ru/core/reference/ydb-sdk/feature-parity.md b/ydb/docs/ru/core/reference/ydb-sdk/feature-parity.md
index a36ce7feb2..050d920751 100644
--- a/ydb/docs/ru/core/reference/ydb-sdk/feature-parity.md
+++ b/ydb/docs/ru/core/reference/ydb-sdk/feature-parity.md
@@ -23,7 +23,7 @@
|Балансировка среди всех нод всех локального ДЦ|\+|\+|\+|?|\-|\-|\-||
|**Credentials providers**|||||||||
|Anonymous (по умолчанию)|\+|\+|\+|\+|\+|?|\+|\+|
-|Static (user - password)|\+|\+|\+|\+|\-|\-|\-|\-|
+|Static (user - password)|\+|\+|\+|\+|\-|\-|\-|\+|
|Token: IAM, OAuth|\+|\+|\+|\+|\+|\+|\+|\+|
|Service account (Yandex.Cloud specific)|\+|\+|\+|\+|\+|\+|\-|\+|
|Metadata (Yandex.Cloud specific)|\+|\+|\+|\+|\+|\+|\+|\+|
@@ -130,7 +130,7 @@
|\* environ|?|?|\+|\+|\+||\-|\+|
|\* metadata|?|?|\+|\+|\+||\+|\+|
|\* service_account|?|?|\+|\+|\+||\-|\+|
-|\* static (username \+ password)|?|?|\+|\+|\+||\-|\-|
+|\* static (username \+ password)|?|?|\+|\+|\+||\-|\+|
|Basic (series)|\+|?|\+|\+|\+|\+|\+|\+|
|Bulk Upsert|\+/-|?|\+|\+|\+||\-|\+|
|Containers (Struct,Variant,List,Tuple)|\-|?|\+|\-|\-||\+|\-|
diff --git a/ydb/docs/ru/core/reference/ydb-sdk/recipes/auth-static.md b/ydb/docs/ru/core/reference/ydb-sdk/recipes/auth-static.md
index e99d39c47a..d5dff25981 100644
--- a/ydb/docs/ru/core/reference/ydb-sdk/recipes/auth-static.md
+++ b/ydb/docs/ru/core/reference/ydb-sdk/recipes/auth-static.md
@@ -75,6 +75,33 @@
- PHP
- {% include [feature is not implemented](_includes/wip.md) %}
+ ```php
+ <?php
+
+ use YdbPlatform\Ydb\Ydb;
+ use YdbPlatform\Ydb\Auth\Implement\StaticAuthentication;
+
+ $config = [
+
+ // Database path
+ 'database' => '/local',
+
+ // Database endpoint
+ 'endpoint' => 'localhost:2136',
+
+ // Auto discovery (dedicated server only)
+ 'discovery' => false,
+
+ // IAM config
+ 'iam_config' => [
+ 'insecure' => true,
+ // 'root_cert_file' => './CA.pem', // Root CA file (uncomment for dedicated server)
+ ],
+
+ 'credentials' => new StaticAuthentication($user, $password)
+ ];
+
+ $ydb = new Ydb($config);
+ ```
{% endlist %}