-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Reporting]: Move router + license checks to new platform #66331
Merged
joelgriffith
merged 50 commits into
elastic:master
from
joelgriffith:chore/np-route-migration
May 29, 2020
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
004dd70
WIP: Move routes to new API, license and other checks inbound
938e14a
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
500b933
Move license checks over to np licensing observable
b9cc20c
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
4feb02f
Fix license checks + remove older modules
02394d5
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
2b18fe2
Fixing check_license tests, move to TS/Jest
dfd62f3
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
ac361a8
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
7fab2c6
Fix licensing setup for mocks
48c88f8
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
15ece89
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
d58fc14
Move job.test.ts over to np
6e1667e
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
007dd57
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
ed1ac8c
WIP: move user checks to higher-order func
c08ea7b
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
756551f
Move more handler logic over to Response factory vs Boom
7e6efa2
Major refactor to consolidate types, remove facades, and udpate helpers
82a1767
Fix validation for dates in immediate exports
bb0e7ee
Linter fix on check license test
ec94204
Fix job generation tests
39a1313
Move deps => setupDeps
c7cba25
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
b4e54e1
fix api test
tsullivan ee7db9a
fix jobs test
tsullivan e7262f4
authorized_user_pre_routing and tests
tsullivan d69be5f
Fixing duplicate identifiers
107eca0
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
ca58c89
Merge pull request #1 from tsullivan/chore/np-route-migration
joelgriffith a8f4bcd
Fix licensing implementation changes
54863d0
Merge branch 'chore/np-route-migration' of https://github.com/joelgri…
86920d3
WIP: Moving license over to async/observables
7532d55
Fix disabled-security case
dc57a6f
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
f764bf8
finish auth_user_pre_routing cleanup - no more license check
tsullivan 01fc733
Merge pull request #2 from tsullivan/chore/np-route-migration
874222f
WIP: Fixing final api tests
dce4083
Trying to get schema differences in alignment
76904b7
Merge branch 'chore/np-route-migration' of https://github.com/joelgri…
2a5f9a0
Reverting back to previous generation handler
f7d1134
Fix final API tests
0aca67c
Final API test fixes, few more hardening tests and better error messages
7554127
Merge remote-tracking branch 'upstream/master' into chore/np-route-mi…
27040a9
Simplify lower-level module implementation (core only interface) + te…
8ad57ff
Push some core logic into plugin
4f12c8a
Move some core logic up to plugin
3ab8095
Marking private setupDeps + downstream fixes
1cf1546
revert logger as a param
tsullivan fcf9f58
Merge pull request #3 from tsullivan/chore/np-route-migration
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
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
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 |
---|---|---|
|
@@ -5,33 +5,28 @@ | |
*/ | ||
|
||
import { validateUrls } from '../../../../common/validate_urls'; | ||
import { ReportingCore } from '../../../../server'; | ||
import { cryptoFactory } from '../../../../server/lib'; | ||
import { | ||
ConditionalHeaders, | ||
CreateJobFactory, | ||
ESQueueCreateJobFn, | ||
RequestFacade, | ||
} from '../../../../server/types'; | ||
import { CreateJobFactory, ESQueueCreateJobFn } from '../../../../server/types'; | ||
import { JobParamsPDF } from '../../types'; | ||
|
||
export const createJobFactory: CreateJobFactory<ESQueueCreateJobFn< | ||
JobParamsPDF | ||
>> = function createJobFactoryFn(reporting: ReportingCore) { | ||
>> = function createJobFactoryFn(reporting) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for cleaning up this inferrable types! |
||
const config = reporting.getConfig(); | ||
const setupDeps = reporting.getPluginSetupDeps(); | ||
const crypto = cryptoFactory(config.get('encryptionKey')); | ||
|
||
return async function createJobFn( | ||
{ title, relativeUrls, browserTimezone, layout, objectType }: JobParamsPDF, | ||
headers: ConditionalHeaders['headers'], | ||
request: RequestFacade | ||
context, | ||
req | ||
) { | ||
const serializedEncryptedHeaders = await crypto.encrypt(headers); | ||
const serializedEncryptedHeaders = await crypto.encrypt(req.headers); | ||
|
||
validateUrls(relativeUrls); | ||
|
||
return { | ||
basePath: request.getBasePath(), | ||
basePath: setupDeps.basePath(req), | ||
browserTimezone, | ||
forceNow: new Date().toISOString(), | ||
headers: serializedEncryptedHeaders, | ||
|
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.
This is needed now so we can pass long certain job-status messages (they were incorrectly being sent as application/json, and I think hapi was fixing that under-the-hood)