-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
azasypkin
merged 22 commits into
elastic:master
from
azasypkin:issue-18176-pre-access-message
Apr 28, 2020
Merged
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 13648ac
design adjustments
ryankeairns 10a6048
Merge pull request #1 from ryankeairns/issue-18176-pre-access-message
azasypkin 0f6f189
Remove direct use of EuiModal classes
ryankeairns 0410f17
address feedback
ryankeairns c862669
Merge pull request #2 from ryankeairns/issue-18176-pre-access-message
azasypkin b867f79
Merge branch 'master' into issue-18176-pre-access-message
azasypkin 45c51d6
Update jest snapshot.
azasypkin 663ced3
Merge branch 'master' into issue-18176-pre-access-message
azasypkin 6ba5360
Review#1: rename access_notice files to access_agreement.
azasypkin 3fd22ea
Review#1: replace `notice` with `acknowledgement`.
azasypkin e582328
Review#1: introduce `AuthenticationProvider` common interface.
azasypkin 57d9d2d
Review#1: introduce `AuthenticationProvider` common interface, do not…
azasypkin 258e597
Review#1: introduce `AuthenticationProvider` common interface, do not…
azasypkin b9d4713
Review#1: introduce `AuthenticationProvider` common interface, do not…
azasypkin ab1ed57
Merge branch 'master' into issue-18176-pre-access-message
azasypkin 300877f
Review#1: use `logoElastic` instead of `logoKibana`.
azasypkin 20f24a8
Review#1: re-expose `areAPIKeysEnabled`.
azasypkin be9a7f1
Merge branch 'master' into issue-18176-pre-access-message
azasypkin de10976
Allow access acknowledgement only if license is Gold+.
azasypkin 99332b2
Merge branch 'master' into issue-18176-pre-access-message
azasypkin 3c7cf49
Review#1: return 403 instead of 404 if current license does not suppo…
azasypkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
201 changes: 201 additions & 0 deletions
201
...curity/public/authentication/access_notice/__snapshots__/access_notice_page.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
x-pack/plugins/security/public/authentication/access_notice/_access_notice_page.scss
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,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; | ||
} |
1 change: 1 addition & 0 deletions
1
x-pack/plugins/security/public/authentication/access_notice/_index.scss
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 @@ | ||
@import './access_notice_page'; |
62 changes: 62 additions & 0 deletions
62
x-pack/plugins/security/public/authentication/access_notice/access_notice_app.test.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,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, | ||
}); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
x-pack/plugins/security/public/authentication/access_notice/access_notice_app.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,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, | ||
}); | ||
}, | ||
}); | ||
}, | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?There was a problem hiding this comment.
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.