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

Remove unused license check result from LP Security plugin #66966

Merged
merged 3 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 0 additions & 8 deletions x-pack/legacy/plugins/security/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ export const security = (kibana: Record<string, any>) =>
auditLogger: new AuditLogger(server, 'security', server.config(), xpackInfo),
});

// Legacy xPack Info endpoint returns whatever we return in a callback for `registerLicenseCheckResultsGenerator`
// and the result is consumed by the legacy plugins all over the place, so we should keep it here for now. We assume
// that when legacy callback is called license has been already propagated to the new platform security plugin and
// features are up to date.
xpackInfo
.feature(this.id)
.registerLicenseCheckResultsGenerator(() => securityPlugin.license.getFeatures());

server.expose({
getUser: async (request: LegacyRequest) =>
securityPlugin.authc.getCurrentUser(KibanaRequest.from(request)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,6 @@ describe('replaceInjectedVars uiExport', () => {
},
});
});

it('sends the originalInjectedVars if the license check result is not available', async () => {
const originalInjectedVars = { a: 1 };
const request = buildRequest();
const server = mockServer();
server.plugins.xpack_main.info.feature().getLicenseCheckResults.returns(undefined);

const newVars = await replaceInjectedVars(originalInjectedVars, request, server);
expect(newVars).to.eql(originalInjectedVars);
});
});

// creates a mock server object that defaults to being authenticated with a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function replaceInjectedVars(originalInjectedVars, request, server)
}

// not enough license info to make decision one way or another
if (!xpackInfo.isAvailable() || !xpackInfo.feature('security').getLicenseCheckResults()) {
if (!xpackInfo.isAvailable()) {
return originalInjectedVars;
}

Expand Down
3 changes: 0 additions & 3 deletions x-pack/test/licensing_plugin/legacy/updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default function(ftrContext: FtrProviderContext) {
} = await supertest.get('/api/xpack/v1/info').expect(200);

expect(legacyInitialLicense.license?.type).to.be('basic');
expect(legacyInitialLicense.features).to.have.property('security');
expect(legacyInitialLicenseHeaders['kbn-xpack-sig']).to.be.a('string');

await scenario.startTrial();
Expand All @@ -42,7 +41,6 @@ export default function(ftrContext: FtrProviderContext) {
.expect(200);

expect(legacyTrialLicense.license?.type).to.be('trial');
expect(legacyTrialLicense.features).to.have.property('security');
expect(legacyTrialLicenseHeaders['kbn-xpack-sig']).to.not.be(
legacyInitialLicenseHeaders['kbn-xpack-sig']
);
Expand All @@ -52,7 +50,6 @@ export default function(ftrContext: FtrProviderContext) {

const { body: legacyBasicLicense } = await supertest.get('/api/xpack/v1/info').expect(200);
expect(legacyBasicLicense.license?.type).to.be('basic');
expect(legacyBasicLicense.features).to.have.property('security');

// banner shown only when license expired not just deleted
await testSubjects.missingOrFail('licenseExpiredBanner');
Expand Down