Skip to content

Commit 1748e6a

Browse files
Writing some tests
1 parent ee66c48 commit 1748e6a

File tree

19 files changed

+285
-165
lines changed

19 files changed

+285
-165
lines changed

docs/java-rest/low-level/configuration.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ include-tagged::{doc-tests}/RestClientDocumentation.java[rest-client-config-disa
7676
==== Elasticsearch Token Service tokens
7777

7878
If you want the client to authenticate with an Elasticsearch access token, set the relevant HTTP request header.
79-
If the client makes requests on behalf of a single user only, you can set the necessary `ElasticInferenceServiceAuthorizationHandler` header as a default header as shown
79+
If the client makes requests on behalf of a single user only, you can set the necessary `Authorization` header as a default header as shown
8080
in the following example:
8181

8282
["source","java",subs="attributes,callouts,macros"]
@@ -87,7 +87,7 @@ include-tagged::{doc-tests}/RestClientDocumentation.java[rest-client-auth-bearer
8787
==== Elasticsearch API keys
8888

8989
If you want the client to authenticate with an Elasticsearch API key, set the relevant HTTP request header.
90-
If the client makes requests on behalf of a single user only, you can set the necessary `ElasticInferenceServiceAuthorizationHandler` header as a default header as shown
90+
If the client makes requests on behalf of a single user only, you can set the necessary `Authorization` header as a default header as shown
9191
in the following example:
9292

9393
["source","java",subs="attributes,callouts,macros"]

docs/reference/esql/esql-process-data-with-dissect-grok.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ include::{esql-specs}/docs.csv-spec[tag=dissectAppendWithOrderModifier-result]
178178
====== Named skip key (`?`)
179179
include::../ingest/processors/dissect.asciidoc[tag=named-skip-key]
180180
This can be done with a named skip key using the `{?name}` syntax. In the
181-
following query, `ident` and `auth` are not added to the output table:
181+
following query, `ident` and `authorization` are not added to the output table:
182182

183183
[source.merge.styled,esql]
184184
----

docs/reference/rest-api/security/create-api-keys.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ API key information.
194194
<4> API key credentials which is the Base64-encoding of the UTF-8
195195
representation of the `id` and `api_key` joined by a colon (`:`).
196196

197-
To use the generated API key, send a request with an `ElasticInferenceServiceAuthorizationHandler` header that
197+
To use the generated API key, send a request with an `Authorization` header that
198198
contains an `ApiKey` prefix followed by the API key credentials
199199
(the `encoded` value from the response).
200200

docs/reference/rest-api/security/get-tokens.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ seconds) that the token expires in, and the type:
155155
// TESTRESPONSE[s/superuser/_es_test_root/]
156156

157157
The token returned by this API can be used by sending a request with an
158-
`ElasticInferenceServiceAuthorizationHandler` header with a value having the prefix "Bearer " followed
158+
`Authorization` header with a value having the prefix "Bearer " followed
159159
by the value of the `access_token`.
160160

161161
[source,shell]

docs/reference/security/authentication/token-authentication-services.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ generate access tokens and refresh tokens based on the OAuth2 specification.
4040
The access token is a short-lived token. By default, it expires after 20 minutes
4141
but it can be configured to last a maximum of 1 hour. It can be refreshed by
4242
using a refresh token, which has a lifetime of 24 hours. The access token is a
43-
bearer token. You can use it by sending a request with an `ElasticInferenceServiceAuthorizationHandler`
43+
bearer token. You can use it by sending a request with an `Authorization`
4444
header with a value that has the prefix "Bearer " followed by the value of the
4545
access token. For example:
4646
+
@@ -59,7 +59,7 @@ The API key service uses the
5959
By default, the API keys do not expire. When you make a request to create API
6060
keys, you can specify an expiration and permissions for the API key. The
6161
permissions are limited by the authenticated user's permissions. You can use the
62-
API key by sending a request with an `ElasticInferenceServiceAuthorizationHandler` header with a value that
62+
API key by sending a request with an `Authorization` header with a value that
6363
has the prefix "ApiKey " followed by the credentials. The credentials are the
6464
base64 encoding of the API key ID and the API key joined by a colon. For example:
6565
+

docs/reference/security/ccs-clients-integrations/http.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ es-secondary-authorization: Basic <TOKEN> <1>
6565
<1> The `<TOKEN>` is computed as `base64(USERNAME:PASSWORD)`
6666

6767
The `es-secondary-authorization` header has the same syntax as the
68-
`ElasticInferenceServiceAuthorizationHandler` header. It therefore also supports the use of
68+
`Authorization` header. It therefore also supports the use of
6969
<<token-authentication-services,token-based authentication services>>. For
7070
example:
7171

docs/reference/watcher/actions/email.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ killed by firewalls or load balancers in-between.
149149
means, by default watcher tries to download a dashboard for 10 minutes,
150150
forty times fifteen seconds). The setting `xpack.notification.reporting.interval`
151151
can be configured globally to change the default.
152-
| `auth` | Additional auth configuration for the request, see
152+
| `authorization` | Additional auth configuration for the request, see
153153
{kibana-ref}/automating-report-generation.html#use-watcher[use watcher] for details
154-
| `proxy` | Additional proxy configuration for the request. See <<http-input-attributes>>
154+
| `proxy` | Additional proxy configuration for the request. See <<http-input-attributes>>
155155
on how to configure the values.
156156
|======
157157

@@ -257,7 +257,7 @@ messages can contain basic HTML tags. You can control which groups of tags are
257257
allowed by <<email-html-sanitization, Configuring HTML Sanitization Options>>.
258258

259259
You configure the accounts {watcher} can use to send email in the
260-
`xpack.notification.email` namespace in `elasticsearch.yml`.
260+
`xpack.notification.email` namespace in `elasticsearch.yml`.
261261
The password for the specified SMTP user is stored securely in the
262262
<<secure-settings, {es} keystore>>.
263263

docs/reference/watcher/actions/webhook.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ the values serve as the header values:
165165
| `params` | no | - | The URL query string parameters. The parameter values can be
166166
static text or include Mustache <<templates,templates>>.
167167

168-
| `auth` | no | - | Authentication related HTTP headers. Currently, only basic
168+
| `authorization` | no | - | Authentication related HTTP headers. Currently, only basic
169169
authentication is supported.
170170

171171
| `body` | no | - | The HTTP request body. The body can be static text or include

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferencePlugin.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
import org.elasticsearch.xpack.inference.services.elastic.ElasticInferenceService;
115115
import org.elasticsearch.xpack.inference.services.elastic.ElasticInferenceServiceComponents;
116116
import org.elasticsearch.xpack.inference.services.elastic.ElasticInferenceServiceSettings;
117+
import org.elasticsearch.xpack.inference.services.elastic.authorization.ElasticInferenceServiceAuthorizationHandler;
117118
import org.elasticsearch.xpack.inference.services.elasticsearch.ElasticsearchInternalService;
118119
import org.elasticsearch.xpack.inference.services.googleaistudio.GoogleAiStudioService;
119120
import org.elasticsearch.xpack.inference.services.googlevertexai.GoogleVertexAiService;
@@ -286,13 +287,19 @@ public Collection<?> createComponents(PluginServices services) {
286287
String elasticInferenceUrl = this.getElasticInferenceServiceUrl(inferenceServiceSettings);
287288
elasticInferenceServiceComponents.set(new ElasticInferenceServiceComponents(elasticInferenceUrl));
288289

290+
var authorizationHandler = new ElasticInferenceServiceAuthorizationHandler(
291+
elasticInferenceServiceComponents.get().elasticInferenceServiceUrl(),
292+
services.threadPool()
293+
);
294+
289295
inferenceServices.add(
290296
() -> List.of(
291297
context -> new ElasticInferenceService(
292298
elasicInferenceServiceFactory.get(),
293299
serviceComponents.get(),
294300
elasticInferenceServiceComponents.get(),
295-
modelRegistry
301+
modelRegistry,
302+
authorizationHandler
296303
)
297304
)
298305
);

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/external/http/retry/RetryingHttpSender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
public class RetryingHttpSender implements RequestSender {
3737

38-
static final int MAX_RETIES = 3;
38+
public static final int MAX_RETIES = 3;
3939

4040
private final HttpClient httpClient;
4141
private final ThrottlerManager throttlerManager;

0 commit comments

Comments
 (0)