Remove unused license check result from LP Security plugin (#66966)

* remove unused license check result

* remove outdated test

* update licensing tests
This commit is contained in:
Mikhail Shustov 2020-05-20 12:54:16 +02:00 committed by GitHub
parent dfa22d17b9
commit a9234ef034
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 22 deletions

View file

@ -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)),

View file

@ -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

View file

@ -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;
}

View file

@ -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();
@ -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']
);
@ -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');