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

NP Licensing service info endpoint #51188

Merged
merged 5 commits into from
Nov 20, 2019

Conversation

mshustov
Copy link
Contributor

Summary

This PR:

  • adds licensing info endpoint
  • marks all calls to it as system API calls to prevent user session extension. @jportner

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@mshustov mshustov added chore Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes v7.6.0 labels Nov 20, 2019
@mshustov mshustov requested a review from a team as a code owner November 20, 2019 16:48
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@mshustov mshustov mentioned this pull request Nov 20, 2019
12 tasks
const response = await core.http.get(this.infoEndpoint);
const response = await core.http.get(this.infoEndpoint, {
headers: {
'kbn-system-api': 'true',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

right now all calls extend user session. I missed this point in the first PR

Copy link
Member

Choose a reason for hiding this comment

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

Not as part of this PR, but what do you think about introducing "system calls" as a first-class setting on the core http service? I imagine this is something we'll come across in other apps too, wherever background work is performed not related to user actions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@legrego we consider to do this in #43970

@@ -76,18 +77,16 @@ export class LicensingPlugin implements Plugin<LicensingPluginSetup> {
);
this.licenseFetchSubscription = fetchSubscription;

const license$ = update$.pipe(
tap(license => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The laziness tripped me up. We didn't store license and re-fetch a new one because there are no subscribers to license$.

x-pack/plugins/licensing/public/plugin.ts Outdated Show resolved Hide resolved
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mshustov mshustov merged commit d61cef4 into elastic:master Nov 20, 2019
@mshustov mshustov deleted the licensing-service-info-endpoint branch November 20, 2019 20:39
mshustov added a commit to mshustov/kibana that referenced this pull request Nov 20, 2019
* add NP licensing service info endpoint

* call licensing/info and mark it as system to prevent session update

* add integration api test for licensing/info endpoint

* readonly for static data!
mshustov added a commit that referenced this pull request Nov 21, 2019
* add NP licensing service info endpoint

* call licensing/info and mark it as system to prevent session update

* add integration api test for licensing/info endpoint

* readonly for static data!
@sorenlouv
Copy link
Member

I'm not 100% the following is related to this PR but seems at least related to this area so here goes:

I've noticed that for every request made by the APM app a secondary request is made to /api/licensing/info. The responses are completely identical so I assume the requests should be cached?

image

@mshustov
Copy link
Contributor Author

Licensing plugin on the server side polls elasticsearch every 30 sec, to get license data. Based on the data, the plugin calculates a hash sum and injects it in the signature response header. The plugin intercepts all responses on the client-side and compares the signature header value.
The problem is that the NP plugin reads a hash sum from the legacy plugin. NP Licensing plugin needs to use a different header to inject its signature.

@elasticmachine elasticmachine mentioned this pull request Nov 29, 2019
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants