Skip to content

Commit

Permalink
[Security Solutions] Move authentication UI and hooks to 'public/comm…
Browse files Browse the repository at this point in the history
…on' (#128924)

* Move authentication table, server, and hooks to 'public/common'
  • Loading branch information
machadoum authored Apr 4, 2022
1 parent 9b3abe5 commit 9e1fd5e
Show file tree
Hide file tree
Showing 51 changed files with 2,121 additions and 1,065 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

export * from './all';
export * from './authentications';
export * from './common';
export * from './details';
export * from './first_last_seen';
Expand All @@ -15,8 +14,6 @@ export * from './overview';
export * from './uncommon_processes';

export enum HostsQueries {
authentications = 'authentications',
authenticationsEntities = 'authenticationsEntities',
details = 'hostDetails',
firstOrLastSeen = 'firstOrLastSeen',
hosts = 'hosts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
HostDetailsStrategyResponse,
HostDetailsRequestOptions,
HostsOverviewStrategyResponse,
HostAuthenticationsRequestOptions,
HostAuthenticationsStrategyResponse,
HostOverviewRequestOptions,
HostFirstLastSeenStrategyResponse,
HostsQueries,
Expand Down Expand Up @@ -88,12 +86,17 @@ import {
TotalUsersKpiStrategyResponse,
} from './users/kpi/total_users';
import { UsersRequestOptions, UsersStrategyResponse } from './users/all';
import {
UserAuthenticationsRequestOptions,
UserAuthenticationsStrategyResponse,
} from './users/authentications';

export * from './cti';
export * from './hosts';
export * from './risk_score';
export * from './matrix_histogram';
export * from './network';
export * from './users';

export type FactoryQueryTypes =
| HostsQueries
Expand Down Expand Up @@ -132,8 +135,6 @@ export type StrategyResponseType<T extends FactoryQueryTypes> = T extends HostsQ
? HostDetailsStrategyResponse
: T extends HostsQueries.overview
? HostsOverviewStrategyResponse
: T extends HostsQueries.authentications
? HostAuthenticationsStrategyResponse
: T extends HostsQueries.firstOrLastSeen
? HostFirstLastSeenStrategyResponse
: T extends HostsQueries.uncommonProcesses
Expand All @@ -148,6 +149,8 @@ export type StrategyResponseType<T extends FactoryQueryTypes> = T extends HostsQ
? UserDetailsStrategyResponse
: T extends UsersQueries.kpiTotalUsers
? TotalUsersKpiStrategyResponse
: T extends UsersQueries.authentications
? UserAuthenticationsStrategyResponse
: T extends UsersQueries.users
? UsersStrategyResponse
: T extends NetworkQueries.details
Expand Down Expand Up @@ -194,8 +197,6 @@ export type StrategyRequestType<T extends FactoryQueryTypes> = T extends HostsQu
? HostDetailsRequestOptions
: T extends HostsQueries.overview
? HostOverviewRequestOptions
: T extends HostsQueries.authentications
? HostAuthenticationsRequestOptions
: T extends HostsQueries.firstOrLastSeen
? HostFirstLastSeenRequestOptions
: T extends HostsQueries.uncommonProcesses
Expand All @@ -206,6 +207,8 @@ export type StrategyRequestType<T extends FactoryQueryTypes> = T extends HostsQu
? HostsKpiHostsRequestOptions
: T extends HostsKpiQueries.kpiUniqueIps
? HostsKpiUniqueIpsRequestOptions
: T extends UsersQueries.authentications
? UserAuthenticationsRequestOptions
: T extends UsersQueries.details
? UserDetailsRequestOptions
: T extends UsersQueries.kpiTotalUsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { IEsSearchResponse } from '../../../../../../../src/plugins/data/common';
import { AuthenticationHit } from '../hosts';
import { Inspect, Maybe, TimerangeInput } from '../../common';
import { RequestBasicOptions } from '../';
import { AuthenticationHit, RequestBasicOptions } from '../';
import { AlertsGroupData } from './alerts';
import { AnomaliesActionGroupData, AnomalyHit } from './anomalies';
import { DnsHistogramGroupData } from './dns';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@ import {
Hit,
TotalHit,
} from '../../../common';
import { RequestOptionsPaginated } from '../../';
import { RequestOptionsPaginated } from '../..';

export interface HostAuthenticationsStrategyResponse extends IEsSearchResponse {
export interface UserAuthenticationsStrategyResponse extends IEsSearchResponse {
edges: AuthenticationsEdges[];
totalCount: number;
pageInfo: PageInfoPaginated;
inspect?: Maybe<Inspect>;
}

export interface HostAuthenticationsRequestOptions extends RequestOptionsPaginated {
export interface UserAuthenticationsRequestOptions extends RequestOptionsPaginated {
defaultIndex: string[];
stackByField: AuthStackByField;
}

export enum AuthStackByField {
userName = 'user.name',
hostName = 'host.name',
}

export interface AuthenticationsEdges {
Expand All @@ -41,7 +47,7 @@ export interface AuthenticationItem {
_id: string;
failures: number;
successes: number;
user: UserEcs;
stackedValue: UserEcs['name'] | HostEcs['name'];
lastSuccess?: Maybe<LastSourceHost>;
lastFailure?: Maybe<LastSourceHost>;
}
Expand All @@ -58,17 +64,15 @@ export interface AuthenticationHit extends Hit {
lastSuccess?: LastSourceHost;
lastFailure?: LastSourceHost;
};
user: string;
stackedValue: string;
failures: number;
successes: number;
cursor?: string;
sort: StringOrNumber[];
}

export interface AuthenticationBucket {
key: {
user_uid: string;
};
key: string;
doc_count: number;
failures: {
doc_count: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* 2.0.
*/

import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common';

import { Inspect, Maybe, TimerangeInput } from '../../../common';
Expand All @@ -23,7 +22,3 @@ export interface UserDetailsRequestOptions extends Partial<RequestBasicOptions>
timerange: TimerangeInput;
inspect?: Maybe<Inspect>;
}

export interface AggregationRequest {
[aggField: string]: estypes.AggregationsAggregationContainer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@

import { TotalUsersKpiStrategyResponse } from './kpi/total_users';

export * from './all';
export * from './common';
export * from './kpi';
export * from './details';
export * from './authentications';

export enum UsersQueries {
details = 'userDetails',
kpiTotalUsers = 'usersKpiTotalUsers',
users = 'allUsers',
authentications = 'authentications',
authenticationsEntities = 'authenticationsEntities',
}

export type UserskKpiStrategyResponse = Omit<TotalUsersKpiStrategyResponse, 'rawResponse'>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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.
*/

export * from './common';
export * from './total_users';
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* 2.0.
*/

export const AUTHENTICATIONS_TABLE = '[data-test-subj="table-authentications-loading-false"]';
export const AUTHENTICATIONS_TABLE = '[data-test-subj="table-users-authentications-loading-false"]';
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
export const AUTHENTICATIONS_TAB = '[data-test-subj="navigation-authentications"]';
export const HEADER_SUBTITLE = '[data-test-subj="header-panel-subtitle"]';
export const USER_NAME_CELL = '[data-test-subj="render-content-user.name"]';
export const AUTHENTICATIONS_TABLE = '[data-test-subj="table-authentications-loading-false"]';
export const AUTHENTICATIONS_TABLE = '[data-test-subj="table-users-authentications-loading-false"]';
Loading

0 comments on commit 9e1fd5e

Please sign in to comment.