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

Enforce license expiration #79671

Merged
merged 2 commits into from
Oct 26, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public boolean check(XPackLicenseState state) {
* A Persistent feature is one that is tracked starting when the license is checked, and later may be untracked.
*/
public static class Persistent extends LicensedFeature {
private Persistent(String family, String name, License.OperationMode minimumOperationMode, boolean needsActive) {
super(family, name, minimumOperationMode, needsActive);
private Persistent(String family, String name, License.OperationMode minimumOperationMode) {
super(family, name, minimumOperationMode, true);
}

/**
Expand Down Expand Up @@ -111,7 +111,7 @@ public static Momentary momentary(String family, String name, License.OperationM

/** Create a persistent feature for the given license level */
public static Persistent persistent(String family, String name, License.OperationMode licenseLevel) {
return new Persistent(family, name, licenseLevel, true);
return new Persistent(family, name, licenseLevel);
}

/**
Expand All @@ -123,15 +123,6 @@ public static Momentary momentaryLenient(String family, String name, License.Ope
return new Momentary(family, name, licenseLevel, false);
}

/**
* Creates a persistent feature, but one that is lenient as
* to whether the license needs to be active to allow the feature.
*/
@Deprecated
public static Persistent persistentLenient(String family, String name, License.OperationMode licenseLevel) {
return new Persistent(family, name, licenseLevel, false);
}

/**
* Returns whether the feature is allowed by the current license
* without affecting feature tracking.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public final class SecurityField {
// Document and Field Level Security are Platinum+
private static final String DLS_FLS_FEATURE_FAMILY = "security-dls-fls";
public static final LicensedFeature.Momentary DOCUMENT_LEVEL_SECURITY_FEATURE =
LicensedFeature.momentaryLenient(DLS_FLS_FEATURE_FAMILY, "dls", License.OperationMode.PLATINUM);
LicensedFeature.momentary(DLS_FLS_FEATURE_FAMILY, "dls", License.OperationMode.PLATINUM);
public static final LicensedFeature.Momentary FIELD_LEVEL_SECURITY_FEATURE =
LicensedFeature.momentaryLenient(DLS_FLS_FEATURE_FAMILY, "fls", License.OperationMode.PLATINUM);
LicensedFeature.momentary(DLS_FLS_FEATURE_FAMILY, "fls", License.OperationMode.PLATINUM);


private SecurityField() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,29 +359,29 @@ public class Security extends Plugin implements SystemIndexPlugin, IngestPlugin,
public static final LicensedFeature.Momentary IP_FILTERING_FEATURE =
LicensedFeature.momentaryLenient(null, "security-ip-filtering", License.OperationMode.GOLD);
public static final LicensedFeature.Momentary AUDITING_FEATURE =
LicensedFeature.momentaryLenient(null, "security-auditing", License.OperationMode.GOLD);
LicensedFeature.momentary(null, "security-auditing", License.OperationMode.GOLD);
public static final LicensedFeature.Momentary TOKEN_SERVICE_FEATURE =
LicensedFeature.momentaryLenient(null, "security-token-service", License.OperationMode.STANDARD);
LicensedFeature.momentary(null, "security-token-service", License.OperationMode.STANDARD);

private static final String REALMS_FEATURE_FAMILY = "security-realms";
// Builtin realms (file/native) realms are Basic licensed, so don't need to be checked or tracked
// Some realms (LDAP, AD, PKI) are Gold+
public static final LicensedFeature.Persistent LDAP_REALM_FEATURE =
LicensedFeature.persistentLenient(REALMS_FEATURE_FAMILY, "ldap", License.OperationMode.GOLD);
LicensedFeature.persistent(REALMS_FEATURE_FAMILY, "ldap", License.OperationMode.GOLD);
public static final LicensedFeature.Persistent AD_REALM_FEATURE =
LicensedFeature.persistentLenient(REALMS_FEATURE_FAMILY, "active-directory", License.OperationMode.GOLD);
LicensedFeature.persistent(REALMS_FEATURE_FAMILY, "active-directory", License.OperationMode.GOLD);
public static final LicensedFeature.Persistent PKI_REALM_FEATURE =
LicensedFeature.persistentLenient(REALMS_FEATURE_FAMILY, "pki", License.OperationMode.GOLD);
LicensedFeature.persistent(REALMS_FEATURE_FAMILY, "pki", License.OperationMode.GOLD);
// SSO realms are Platinum+
public static final LicensedFeature.Persistent SAML_REALM_FEATURE =
LicensedFeature.persistentLenient(REALMS_FEATURE_FAMILY, "saml", License.OperationMode.PLATINUM);
LicensedFeature.persistent(REALMS_FEATURE_FAMILY, "saml", License.OperationMode.PLATINUM);
public static final LicensedFeature.Persistent OIDC_REALM_FEATURE =
LicensedFeature.persistentLenient(REALMS_FEATURE_FAMILY, "oidc", License.OperationMode.PLATINUM);
LicensedFeature.persistent(REALMS_FEATURE_FAMILY, "oidc", License.OperationMode.PLATINUM);
public static final LicensedFeature.Persistent KERBEROS_REALM_FEATURE =
LicensedFeature.persistentLenient(REALMS_FEATURE_FAMILY, "kerberos", License.OperationMode.PLATINUM);
LicensedFeature.persistent(REALMS_FEATURE_FAMILY, "kerberos", License.OperationMode.PLATINUM);
// Custom realms are Platinum+
public static final LicensedFeature.Persistent CUSTOM_REALMS_FEATURE =
LicensedFeature.persistentLenient(REALMS_FEATURE_FAMILY, "custom", License.OperationMode.PLATINUM);
LicensedFeature.persistent(REALMS_FEATURE_FAMILY, "custom", License.OperationMode.PLATINUM);

public static final LicensedFeature.Momentary DELEGATED_AUTHORIZATION_FEATURE =
LicensedFeature.momentary(null, "security-delegated-authorization", License.OperationMode.PLATINUM);
Expand Down