-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into max-signals-field-f…
…orm-component
- Loading branch information
Showing
32 changed files
with
276 additions
and
24 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
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
20 changes: 20 additions & 0 deletions
20
.../core/security/core-security-server-internal/src/test_helpers/create_audit_logger.mock.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,20 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { AuditLogger } from '@kbn/core-security-server'; | ||
|
||
export type MockedAuditLogger = jest.Mocked<AuditLogger>; | ||
|
||
export const createAuditLoggerMock = { | ||
create(): MockedAuditLogger { | ||
return { | ||
log: jest.fn(), | ||
enabled: true, | ||
}; | ||
}, | ||
}; |
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
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
35 changes: 35 additions & 0 deletions
35
packages/core/security/core-security-server-mocks/src/audit.mock.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,35 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { KibanaRequest } from '@kbn/core-http-server'; | ||
import type { AuditLogger } from '@kbn/core-security-server'; | ||
|
||
export type MockedAuditLogger = jest.Mocked<AuditLogger>; | ||
|
||
export const auditLoggerMock = { | ||
create(): MockedAuditLogger { | ||
return { | ||
log: jest.fn(), | ||
enabled: true, | ||
}; | ||
}, | ||
}; | ||
|
||
export interface MockedAuditService { | ||
asScoped: (request: KibanaRequest) => MockedAuditLogger; | ||
withoutRequest: MockedAuditLogger; | ||
} | ||
|
||
export const auditServiceMock = { | ||
create(): MockedAuditService { | ||
return { | ||
asScoped: jest.fn().mockReturnValue(auditLoggerMock.create()), | ||
withoutRequest: auditLoggerMock.create(), | ||
}; | ||
}, | ||
}; |
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
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
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,40 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { KibanaRequest } from '@kbn/core-http-server'; | ||
|
||
import type { AuditLogger } from './audit_logging/audit_logger'; | ||
|
||
export interface CoreAuditService { | ||
/** | ||
* Creates an {@link AuditLogger} scoped to the current request. | ||
* | ||
* This audit logger logs events with all required user and session info and should be used for | ||
* all user-initiated actions. | ||
* | ||
* @example | ||
* ```typescript | ||
* const auditLogger = securitySetup.audit.asScoped(request); | ||
* auditLogger.log(event); | ||
* ``` | ||
*/ | ||
asScoped: (request: KibanaRequest) => AuditLogger; | ||
|
||
/** | ||
* {@link AuditLogger} for background tasks only. | ||
* | ||
* This audit logger logs events without any user or session info and should never be used to log | ||
* user-initiated actions. | ||
* | ||
* @example | ||
* ```typescript | ||
* securitySetup.audit.withoutRequest.log(event); | ||
* ``` | ||
*/ | ||
withoutRequest: AuditLogger; | ||
} |
7 changes: 4 additions & 3 deletions
7
...in_types_server/src/audit/audit_events.ts → ...-server/src/audit_logging/audit_events.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
5 changes: 3 additions & 2 deletions
5
...in_types_server/src/audit/audit_logger.ts → ...-server/src/audit_logging/audit_logger.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
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
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 |
---|---|---|
|
@@ -16,5 +16,6 @@ | |
"kbn_references": [ | ||
"@kbn/core-security-common", | ||
"@kbn/core-http-server", | ||
"@kbn/logging", | ||
] | ||
} |
Oops, something went wrong.