forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- adds API that checks for existence of log events for given dataset
- cleans up some routes
- Loading branch information
Showing
4 changed files
with
92 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
x-pack/plugins/observability_onboarding/server/lib/get_authentication_api_key.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { KibanaRequest } from '@kbn/core-http-server'; | ||
import { HTTPAuthorizationHeader } from '@kbn/security-plugin/server'; | ||
|
||
export const getAuthenticationAPIKey = (request: KibanaRequest) => { | ||
const authorizationHeader = HTTPAuthorizationHeader.parseFromRequest(request); | ||
if (authorizationHeader && authorizationHeader.credentials) { | ||
const apiKey = Buffer.from(authorizationHeader.credentials, 'base64') | ||
.toString() | ||
.split(':'); | ||
return { | ||
apiKeyId: apiKey[0], | ||
apiKey: apiKey[1], | ||
}; | ||
} | ||
throw new Error('Authorization header is missing'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters