Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Access Agreement UI. #63563

Merged
merged 22 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5c395ef
Introduce Access Notice UI.
azasypkin Apr 15, 2020
13648ac
design adjustments
ryankeairns Apr 20, 2020
10a6048
Merge pull request #1 from ryankeairns/issue-18176-pre-access-message
azasypkin Apr 20, 2020
0f6f189
Remove direct use of EuiModal classes
ryankeairns Apr 20, 2020
0410f17
address feedback
ryankeairns Apr 20, 2020
c862669
Merge pull request #2 from ryankeairns/issue-18176-pre-access-message
azasypkin Apr 20, 2020
b867f79
Merge branch 'master' into issue-18176-pre-access-message
azasypkin Apr 20, 2020
45c51d6
Update jest snapshot.
azasypkin Apr 20, 2020
663ced3
Merge branch 'master' into issue-18176-pre-access-message
azasypkin Apr 23, 2020
6ba5360
Review#1: rename access_notice files to access_agreement.
azasypkin Apr 23, 2020
3fd22ea
Review#1: replace `notice` with `acknowledgement`.
azasypkin Apr 23, 2020
e582328
Review#1: introduce `AuthenticationProvider` common interface.
azasypkin Apr 23, 2020
57d9d2d
Review#1: introduce `AuthenticationProvider` common interface, do not…
azasypkin Apr 23, 2020
258e597
Review#1: introduce `AuthenticationProvider` common interface, do not…
azasypkin Apr 23, 2020
b9d4713
Review#1: introduce `AuthenticationProvider` common interface, do not…
azasypkin Apr 23, 2020
ab1ed57
Merge branch 'master' into issue-18176-pre-access-message
azasypkin Apr 24, 2020
300877f
Review#1: use `logoElastic` instead of `logoKibana`.
azasypkin Apr 24, 2020
20f24a8
Review#1: re-expose `areAPIKeysEnabled`.
azasypkin Apr 24, 2020
be9a7f1
Merge branch 'master' into issue-18176-pre-access-message
azasypkin Apr 28, 2020
de10976
Allow access acknowledgement only if license is Gold+.
azasypkin Apr 28, 2020
99332b2
Merge branch 'master' into issue-18176-pre-access-message
azasypkin Apr 28, 2020
3c7cf49
Review#1: return 403 instead of 404 if current license does not suppo…
azasypkin Apr 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export interface SessionInfo {
now: number;
idleTimeoutExpiration: number | null;
lifespanExpiration: number | null;
provider: string;
provider: { type: string; name: string };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since we use this { type: string; name: string } in a handful of places, what do you think about creating a named type for it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, we can do that, we have UserRealm in common types, we can have something similar for the provider as well.

}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.secAccessNoticePage .secAuthenticationStatePage__content {
max-width: 600px;
}

.secAccessNoticePage__textWrapper {
overflow-y: hidden;
}

.secAccessNoticePage__text {
@include euiYScrollWithShadows;
max-height: 400px;
padding: $euiSize $euiSizeL 0;
}

.secAccessNoticePage__footer {
padding: $euiSize $euiSizeL $euiSizeL;
}

.secAccessNoticePage__footerInner {
text-align: left;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './access_notice_page';
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

jest.mock('./access_notice_page');

import { AppMount, ScopedHistory } from 'src/core/public';
import { accessNoticeApp } from './access_notice_app';

import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks';

describe('accessNoticeApp', () => {
it('properly registers application', () => {
const coreSetupMock = coreMock.createSetup();

accessNoticeApp.create({
application: coreSetupMock.application,
getStartServices: coreSetupMock.getStartServices,
});

expect(coreSetupMock.application.register).toHaveBeenCalledTimes(1);

const [[appRegistration]] = coreSetupMock.application.register.mock.calls;
expect(appRegistration).toEqual({
id: 'security_access_notice',
chromeless: true,
appRoute: '/security/access_notice',
title: 'Access Notice',
mount: expect.any(Function),
});
});

it('properly renders application', async () => {
const coreSetupMock = coreMock.createSetup();
const coreStartMock = coreMock.createStart();
coreSetupMock.getStartServices.mockResolvedValue([coreStartMock, {}, {}]);
const containerMock = document.createElement('div');

accessNoticeApp.create({
application: coreSetupMock.application,
getStartServices: coreSetupMock.getStartServices,
});

const [[{ mount }]] = coreSetupMock.application.register.mock.calls;
await (mount as AppMount)({
element: containerMock,
appBasePath: '',
onAppLeave: jest.fn(),
history: (scopedHistoryMock.create() as unknown) as ScopedHistory,
});

const mockRenderApp = jest.requireMock('./access_notice_page').renderAccessNoticePage;
expect(mockRenderApp).toHaveBeenCalledTimes(1);
expect(mockRenderApp).toHaveBeenCalledWith(coreStartMock.i18n, containerMock, {
http: coreStartMock.http,
notifications: coreStartMock.notifications,
fatalErrors: coreStartMock.fatalErrors,
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { i18n } from '@kbn/i18n';
import { StartServicesAccessor, ApplicationSetup, AppMountParameters } from 'src/core/public';

interface CreateDeps {
application: ApplicationSetup;
getStartServices: StartServicesAccessor;
}

export const accessNoticeApp = Object.freeze({
id: 'security_access_notice',
create({ application, getStartServices }: CreateDeps) {
application.register({
id: this.id,
title: i18n.translate('xpack.security.accessNoticeAppTitle', {
defaultMessage: 'Access Notice',
}),
chromeless: true,
appRoute: '/security/access_notice',
async mount({ element }: AppMountParameters) {
const [[coreStart], { renderAccessNoticePage }] = await Promise.all([
getStartServices(),
import('./access_notice_page'),
]);
return renderAccessNoticePage(coreStart.i18n, element, {
http: coreStart.http,
notifications: coreStart.notifications,
fatalErrors: coreStart.fatalErrors,
});
},
});
},
});
Loading