Merge branch 'master' into cleanup/transport_bulk

Original commit: elastic/x-pack-elasticsearch@f0b88369f3
This commit is contained in:
Areek Zillur 2016-10-12 13:12:16 -04:00
commit 1a0802a157
342 changed files with 170 additions and 995 deletions

View File

@ -8,9 +8,6 @@ package org.elasticsearch.license;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class LicensingClient {
private final ElasticsearchClient client;

View File

@ -24,8 +24,6 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
*/
public class XPackInfoResponse extends ActionResponse {
@Nullable private BuildInfo buildInfo;

View File

@ -23,9 +23,6 @@ import java.util.Map;
import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken.BASIC_AUTH_HEADER;
import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
/**
*
*/
public class XPackClient {
private final Client client;

View File

@ -13,9 +13,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
/**
*
*/
public interface XPackFeatureSet {
String name();

View File

@ -24,8 +24,6 @@ import org.elasticsearch.license.XPackInfoResponse.LicenseInfo;
import java.util.Set;
import java.util.stream.Collectors;
/**
*/
public class TransportXPackInfoAction extends HandledTransportAction<XPackInfoRequest, XPackInfoResponse> {
private final LicenseService licenseService;

View File

@ -22,8 +22,6 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
*/
public class TransportXPackUsageAction extends TransportMasterNodeAction<XPackUsageRequest, XPackUsageResponse> {
private final Set<XPackFeatureSet> featureSets;

View File

@ -9,9 +9,6 @@ import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.license.XPackInfoResponse;
/**
*
*/
public class XPackInfoAction extends Action<XPackInfoRequest, XPackInfoResponse, XPackInfoRequestBuilder> {
public static final String NAME = "cluster:monitor/xpack/info";

View File

@ -14,9 +14,6 @@ import java.io.IOException;
import java.util.EnumSet;
import java.util.Locale;
/**
*
*/
public class XPackInfoRequest extends ActionRequest<XPackInfoRequest> {
public enum Category {

View File

@ -11,8 +11,6 @@ import org.elasticsearch.license.XPackInfoResponse;
import java.util.EnumSet;
/**
*/
public class XPackInfoRequestBuilder extends ActionRequestBuilder<XPackInfoRequest, XPackInfoResponse, XPackInfoRequestBuilder> {
public XPackInfoRequestBuilder(ElasticsearchClient client) {

View File

@ -8,9 +8,6 @@ package org.elasticsearch.xpack.action;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class XPackUsageAction extends Action<XPackUsageRequest, XPackUsageResponse, XPackUsageRequestBuilder> {
public static final String NAME = "cluster:monitor/xpack/usage";

View File

@ -8,9 +8,6 @@ package org.elasticsearch.xpack.action;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.MasterNodeRequest;
/**
*
*/
public class XPackUsageRequest extends MasterNodeRequest<XPackUsageRequest> {
@Override

View File

@ -14,8 +14,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
*/
public class XPackUsageResponse extends ActionResponse {
private List<XPackFeatureSet.Usage> usages;

View File

@ -14,8 +14,6 @@ import java.util.Locale;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*/
public enum HttpContentType implements ToXContent {
JSON() {

View File

@ -11,8 +11,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.Locale;
/**
*/
public enum HttpMethod implements ToXContent {
HEAD("HEAD"),

View File

@ -7,9 +7,6 @@ package org.elasticsearch.xpack.common.http.auth;
import org.elasticsearch.common.xcontent.ToXContent;
/**
*
*/
public interface HttpAuth extends ToXContent {
String type();

View File

@ -9,9 +9,6 @@ import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
/**
*
*/
public abstract class HttpAuthFactory<Auth extends HttpAuth, AAuth extends ApplicableHttpAuth<Auth>> {
public abstract String type();

View File

@ -14,9 +14,6 @@ import java.util.Map;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*
*/
public class HttpAuthRegistry {
private final Map<String, HttpAuthFactory> factories;

View File

@ -12,8 +12,6 @@ import java.util.Base64;
import org.elasticsearch.xpack.common.http.auth.ApplicableHttpAuth;
import org.elasticsearch.xpack.security.crypto.CryptoService;
/**
*/
public class ApplicableBasicAuth extends ApplicableHttpAuth<BasicAuth> {
private final String basicAuth;

View File

@ -16,9 +16,6 @@ import org.elasticsearch.xpack.watcher.support.xcontent.WatcherXContentParser;
import java.io.IOException;
/**
*
*/
public class BasicAuth implements HttpAuth {
public static final String TYPE = "basic";

View File

@ -13,9 +13,6 @@ import org.elasticsearch.xpack.security.crypto.CryptoService;
import java.io.IOException;
/**
*
*/
public class BasicAuthFactory extends HttpAuthFactory<BasicAuth, ApplicableBasicAuth> {
private final CryptoService cryptoService;

View File

@ -12,9 +12,6 @@ import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.xpack.security.crypto.CryptoService;
/**
*
*/
public class Secret implements ToXContent {
protected final char[] text;

View File

@ -16,9 +16,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class XContentUtils {
private XContentUtils() {

View File

@ -16,9 +16,6 @@ import org.elasticsearch.xpack.XPackFeatureSet;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.xpack.XPackSettings;
/**
*
*/
public class GraphFeatureSet implements XPackFeatureSet {
private final boolean enabled;

View File

@ -21,9 +21,6 @@ import org.elasticsearch.xpack.XPackSettings;
import org.elasticsearch.xpack.monitoring.exporter.Exporter;
import org.elasticsearch.xpack.monitoring.exporter.Exporters;
/**
*
*/
public class MonitoringFeatureSet implements XPackFeatureSet {
private final boolean enabled;

View File

@ -28,9 +28,6 @@ import java.util.concurrent.atomic.AtomicReference;
import static java.util.Collections.emptyMap;
/**
*
*/
public class Exporters extends AbstractLifecycleComponent implements Iterable<Exporter> {
private final Map<String, Exporter.Factory> factories;

View File

@ -56,9 +56,6 @@ import java.util.stream.StreamSupport;
import static org.elasticsearch.common.Strings.collectionToCommaDelimitedString;
/**
*
*/
public class LocalExporter extends Exporter implements ClusterStateListener, CleanerService.Listener {
private static final Logger logger = Loggers.getLogger(LocalExporter.class);

View File

@ -24,9 +24,6 @@ import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Properties;
/**
*
*/
public class Account {
static final String SMTP_PROTOCOL = "smtp";

View File

@ -13,9 +13,6 @@ import org.elasticsearch.xpack.security.crypto.CryptoService;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
public class Accounts {
private final String defaultAccountName;

View File

@ -28,9 +28,6 @@ import java.nio.file.Path;
import static javax.mail.Part.ATTACHMENT;
import static javax.mail.Part.INLINE;
/**
*
*/
public abstract class Attachment extends BodyPartSource {
private final boolean inline;

View File

@ -9,9 +9,6 @@ import org.elasticsearch.xpack.common.secret.Secret;
import java.util.Objects;
/**
*
*/
public class Authentication {
private final String user;

View File

@ -20,9 +20,6 @@ import java.util.Map;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*
*/
public enum DataAttachment implements ToXContent {
YAML() {

View File

@ -32,9 +32,6 @@ import java.util.Map;
import static java.util.Collections.unmodifiableMap;
/**
*
*/
public class Email implements ToXContent {
final String id;

View File

@ -19,9 +19,6 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Locale;
/**
*
*/
public class HtmlSanitizer {
static final String[] FORMATTING_TAGS = new String[] {

View File

@ -15,9 +15,6 @@ import javax.mail.internet.MimeBodyPart;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
*
*/
public abstract class BodyPartSource implements ToXContent {
protected static FileTypeMap fileTypeMap;

View File

@ -20,9 +20,6 @@ import java.io.IOException;
import java.util.Locale;
import java.util.Map;
/**
*
*/
public abstract class HipChatAccount {
public static final String AUTH_TOKEN_SETTING = "auth_token";

View File

@ -14,9 +14,6 @@ import org.elasticsearch.xpack.notification.hipchat.HipChatAccount.Profile;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
public class HipChatAccounts {
private final Map<String, HipChatAccount> accounts;

View File

@ -433,9 +433,6 @@ public class HipChatMessage implements ToXContent {
}
}
/**
*
*/
public enum Format implements ToXContent {
TEXT,

View File

@ -8,9 +8,6 @@ package org.elasticsearch.xpack.notification.hipchat;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.common.http.HttpRequest;
/**
*
*/
public class HipChatServer {
public static final String HOST_SETTING = "host";

View File

@ -30,9 +30,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*/
public class IntegrationAccount extends HipChatAccount {
public static final String TYPE = "integration";

View File

@ -17,9 +17,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Locale;
/**
*
*/
public class SentMessages implements ToXContent, Iterable<SentMessages.SentMessage> {
private String accountName;

View File

@ -30,9 +30,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*/
public class UserAccount extends HipChatAccount {
public static final String TYPE = "user";

View File

@ -25,9 +25,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*/
public class V1Account extends HipChatAccount {
public static final String TYPE = "v1";

View File

@ -15,9 +15,6 @@ import org.elasticsearch.xpack.watcher.watch.Payload;
import java.io.IOException;
/**
*
*/
public class PagerDutyAccount {
public static final String SERVICE_KEY_SETTING = "service_api_key";

View File

@ -13,9 +13,6 @@ import org.elasticsearch.xpack.common.http.HttpClient;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
public class PagerDutyAccounts {
private final Map<String, PagerDutyAccount> accounts;

View File

@ -22,9 +22,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
*
*/
public class SentEvent implements ToXContent {
final IncidentEvent event;

View File

@ -17,9 +17,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
*
*/
public class SentMessages implements ToXContent, Iterable<SentMessages.SentMessage> {
private String accountName;

View File

@ -27,9 +27,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
*
*/
public class SlackAccount {
public static final String URL_SETTING = "url";

View File

@ -13,9 +13,6 @@ import org.elasticsearch.xpack.common.http.HttpClient;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
public class SlackAccounts {
private final Map<String, SlackAccount> accounts;

View File

@ -18,9 +18,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*/
public class DynamicAttachments implements MessageElement {
private String listPath;

View File

@ -8,9 +8,6 @@ package org.elasticsearch.xpack.notification.slack.message;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.xcontent.ToXContent;
/**
*
*/
public interface MessageElement extends ToXContent {
interface XField {

View File

@ -9,9 +9,6 @@ import org.elasticsearch.common.settings.Settings;
import java.util.Arrays;
/**
*
*/
public class SlackMessageDefaults {
public static final String FROM_SETTING = SlackMessage.XField.FROM.getPreferredName();

View File

@ -22,9 +22,6 @@ import java.util.stream.Collectors;
import static java.util.Collections.unmodifiableMap;
/**
*
*/
public class SchedulerEngine {
public static class Job {

View File

@ -8,9 +8,6 @@ package org.elasticsearch.xpack.security.action.realm;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class ClearRealmCacheAction extends Action<ClearRealmCacheRequest, ClearRealmCacheResponse, ClearRealmCacheRequestBuilder> {
public static final ClearRealmCacheAction INSTANCE = new ClearRealmCacheAction();

View File

@ -12,9 +12,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
/**
*
*/
public class ClearRealmCacheRequest extends BaseNodesRequest<ClearRealmCacheRequest> {
String[] realms;

View File

@ -8,9 +8,6 @@ package org.elasticsearch.xpack.security.action.realm;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class ClearRealmCacheRequestBuilder extends NodesOperationRequestBuilder<ClearRealmCacheRequest, ClearRealmCacheResponse,
ClearRealmCacheRequestBuilder> {

View File

@ -19,9 +19,6 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import java.io.IOException;
import java.util.List;
/**
*
*/
public class ClearRealmCacheResponse extends BaseNodesResponse<ClearRealmCacheResponse.Node> implements ToXContent {
public ClearRealmCacheResponse() {

View File

@ -21,9 +21,6 @@ import org.elasticsearch.transport.TransportService;
import java.util.List;
/**
*
*/
public class TransportClearRealmCacheAction extends TransportNodesAction<ClearRealmCacheRequest, ClearRealmCacheResponse,
ClearRealmCacheRequest.Node, ClearRealmCacheResponse.Node> {

View File

@ -18,9 +18,6 @@ import org.elasticsearch.transport.TransportService;
import java.util.List;
/**
*
*/
public class TransportClearRolesCacheAction extends TransportNodesAction<ClearRolesCacheRequest, ClearRolesCacheResponse,
ClearRolesCacheRequest.Node, ClearRolesCacheResponse.Node> {

View File

@ -8,9 +8,6 @@ package org.elasticsearch.xpack.security.action.user;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class AuthenticateAction extends Action<AuthenticateRequest, AuthenticateResponse, AuthenticateRequestBuilder> {
public static final String NAME = "cluster:admin/xpack/security/user/authenticate";

View File

@ -15,9 +15,6 @@ import java.io.IOException;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
*
*/
public class AuthenticateRequest extends ActionRequest<AuthenticateRequest> implements UserRequest {
private String username;

View File

@ -8,8 +8,6 @@ package org.elasticsearch.xpack.security.action.user;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class AuthenticateRequestBuilder
extends ActionRequestBuilder<AuthenticateRequest, AuthenticateResponse, AuthenticateRequestBuilder> {

View File

@ -12,8 +12,6 @@ import org.elasticsearch.xpack.security.user.User;
import java.io.IOException;
/**
*/
public class AuthenticateResponse extends ActionResponse {
private User user;

View File

@ -8,8 +8,6 @@ package org.elasticsearch.xpack.security.action.user;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ChangePasswordAction extends Action<ChangePasswordRequest, ChangePasswordResponse, ChangePasswordRequestBuilder> {
public static final ChangePasswordAction INSTANCE = new ChangePasswordAction();

View File

@ -7,8 +7,6 @@ package org.elasticsearch.xpack.security.action.user;
import org.elasticsearch.action.ActionResponse;
/**
*/
public class ChangePasswordResponse extends ActionResponse {
public ChangePasswordResponse() {}

View File

@ -19,8 +19,6 @@ import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.security.user.XPackUser;
/**
*/
public class TransportAuthenticateAction extends HandledTransportAction<AuthenticateRequest, AuthenticateResponse> {
private final SecurityContext securityContext;

View File

@ -18,8 +18,6 @@ import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.security.user.XPackUser;
/**
*/
public class TransportChangePasswordAction extends HandledTransportAction<ChangePasswordRequest, ChangePasswordResponse> {
private final NativeUsersStore nativeUsersStore;

View File

@ -13,9 +13,6 @@ import org.elasticsearch.transport.TransportMessage;
import java.net.InetAddress;
/**
*
*/
public interface AuditTrail {
String name();

View File

@ -22,9 +22,6 @@ import org.elasticsearch.xpack.security.authc.AuthenticationToken;
import org.elasticsearch.xpack.security.transport.filter.SecurityIpFilterRule;
import org.elasticsearch.xpack.security.user.User;
/**
*
*/
public class AuditTrailService extends AbstractComponent implements AuditTrail {
public static final Map<String, Object> DISABLED_USAGE_STATS = Collections.singletonMap("enabled", false);

View File

@ -17,9 +17,6 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
*
*/
public class AuditUtil {
public static String restRequestContent(RestRequest request) {

View File

@ -57,9 +57,6 @@ import static org.elasticsearch.xpack.security.audit.AuditLevel.parse;
import static org.elasticsearch.xpack.security.audit.AuditUtil.indices;
import static org.elasticsearch.xpack.security.audit.AuditUtil.restRequestContent;
/**
*
*/
public class LoggingAuditTrail extends AbstractComponent implements AuditTrail {
public static final String NAME = "logfile";

View File

@ -10,9 +10,6 @@ import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
/**
*
*/
public class RealmConfig {
final String name;

View File

@ -30,9 +30,6 @@ import static org.elasticsearch.xpack.security.authc.ldap.support.LdapUtils.OBJE
import static org.elasticsearch.xpack.security.authc.ldap.support.LdapUtils.search;
import static org.elasticsearch.xpack.security.authc.ldap.support.LdapUtils.searchForEntry;
/**
*
*/
public class ActiveDirectoryGroupsResolver implements GroupsResolver {
private final String baseDn;

View File

@ -12,9 +12,6 @@ import org.elasticsearch.xpack.security.authc.ldap.support.SessionFactory;
import org.elasticsearch.xpack.security.authc.support.DnRoleMapper;
import org.elasticsearch.xpack.ssl.SSLService;
/**
*
*/
public class ActiveDirectoryRealm extends AbstractLdapRealm {
public static final String TYPE = "active_directory";

View File

@ -14,9 +14,6 @@ import org.elasticsearch.xpack.security.authc.support.RefreshListener;
import org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken;
import org.elasticsearch.xpack.security.user.User;
/**
*
*/
public class FileRealm extends CachingUsernamePasswordRealm {
public static final String TYPE = "file";

View File

@ -9,9 +9,6 @@ import com.unboundid.ldap.sdk.SearchScope;
import java.util.Locale;
/**
*
*/
public enum LdapSearchScope {
BASE(SearchScope.BASE),

View File

@ -14,9 +14,6 @@ import java.util.Base64;
import java.util.Locale;
import java.util.Random;
/**
*
*/
public enum Hasher {
BCRYPT() {

View File

@ -5,9 +5,6 @@
*/
package org.elasticsearch.xpack.security.authc.support;
/**
*
*/
public interface RefreshListener {
RefreshListener NOOP = () -> {};

View File

@ -10,9 +10,6 @@ import org.elasticsearch.xpack.security.authc.AuthenticationToken;
import org.elasticsearch.xpack.security.authc.Realm;
import org.elasticsearch.xpack.security.authc.RealmConfig;
/**
*
*/
public abstract class UsernamePasswordRealm extends Realm {
public UsernamePasswordRealm(String type, RealmConfig config) {

View File

@ -15,9 +15,6 @@ import java.util.Objects;
import static org.elasticsearch.xpack.security.support.Exceptions.authenticationError;
/**
*
*/
public class UsernamePasswordToken implements AuthenticationToken {
public static final String BASIC_AUTH_HEADER = "Authorization";

View File

@ -53,6 +53,7 @@ import org.elasticsearch.xpack.security.user.XPackUser;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -61,9 +62,6 @@ import java.util.function.Predicate;
import static org.elasticsearch.xpack.security.Security.setting;
import static org.elasticsearch.xpack.security.support.Exceptions.authorizationError;
/**
*
*/
public class AuthorizationService extends AbstractComponent {
public static final Setting<Boolean> ANONYMOUS_AUTHORIZATION_EXCEPTION_SETTING =
@ -140,7 +138,7 @@ public class AuthorizationService extends AbstractComponent {
}
}
if (XPackUser.is(user) == false) {
if (XPackUser.is(user) == false && Arrays.binarySearch(user.roles(), SuperuserRole.NAME) < 0) {
// we should filter out the .security index from wildcards
if (indicesAndAliases.remove(SecurityTemplateService.SECURITY_INDEX_NAME)) {
logger.debug("removed [{}] from user [{}] list of authorized indices",
@ -308,19 +306,20 @@ public class AuthorizationService extends AbstractComponent {
}
private GlobalPermission permission(String[] roleNames) {
final String[] anonymousRoles = isAnonymousEnabled ? anonymousUser.roles() : Strings.EMPTY_ARRAY;
if (roleNames.length == 0) {
return DefaultRole.INSTANCE;
}
if (roleNames.length == 1) {
Role role = rolesStore.role(roleNames[0]);
return role == null ? DefaultRole.INSTANCE : GlobalPermission.Compound.builder().add(DefaultRole.INSTANCE).add(role).build();
if (anonymousRoles.length == 0) {
assert isAnonymousEnabled == false : "anonymous is only enabled when the anonymous user has roles";
return DefaultRole.INSTANCE;
}
}
// we'll take all the roles and combine their associated permissions
final Set<String> uniqueNames = new HashSet<>(Arrays.asList(roleNames));
uniqueNames.addAll(Arrays.asList(anonymousRoles));
GlobalPermission.Compound.Builder roles = GlobalPermission.Compound.builder().add(DefaultRole.INSTANCE);
for (String roleName : roleNames) {
for (String roleName : uniqueNames) {
Role role = rolesStore.role(roleName);
if (role != null) {
roles.add(role);

View File

@ -13,9 +13,6 @@ import org.elasticsearch.xpack.security.support.Automatons;
import java.util.function.Predicate;
/**
*
*/
public final class AuthorizationUtils {
private static final Predicate<String> INTERNAL_PREDICATE = new AutomatonPredicate(Automatons.patterns("internal:*"));

View File

@ -30,9 +30,6 @@ import java.util.List;
import java.util.Set;
import java.util.SortedMap;
/**
*
*/
public class DefaultIndicesAndAliasesResolver implements IndicesAndAliasesResolver<TransportRequest> {
private final AuthorizationService authzService;

View File

@ -11,9 +11,6 @@ import org.elasticsearch.transport.TransportRequest;
import java.util.Set;
/**
*
*/
public interface IndicesAndAliasesResolver<Request extends TransportRequest> {
Class<Request> requestType();

View File

@ -11,9 +11,6 @@ import org.elasticsearch.xpack.security.authz.privilege.ClusterPrivilege;
import org.elasticsearch.xpack.security.authz.privilege.Privilege.Name;
import org.elasticsearch.xpack.security.support.MetadataUtils;
/**
*
*/
public class KibanaRole extends Role {
private static final String[] CLUSTER_PRIVILEGES = new String[] { "monitor", MonitoringBulkAction.NAME};

View File

@ -15,9 +15,6 @@ import org.elasticsearch.xpack.security.authz.privilege.Privilege;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class Role extends GlobalPermission {
private final String name;

View File

@ -11,9 +11,6 @@ import org.elasticsearch.xpack.security.authz.privilege.GeneralPrivilege;
import org.elasticsearch.xpack.security.authz.privilege.Privilege.Name;
import org.elasticsearch.xpack.security.support.MetadataUtils;
/**
*
*/
public class SuperuserRole extends Role {
public static final String NAME = "superuser";

View File

@ -14,9 +14,6 @@ import java.util.function.Predicate;
import static org.elasticsearch.xpack.security.support.Automatons.patterns;
/**
*
*/
@SuppressWarnings("unchecked")
abstract class AbstractAutomatonPrivilege<P extends AbstractAutomatonPrivilege<P>> extends Privilege<P> {

View File

@ -18,9 +18,6 @@ import java.util.function.Predicate;
import static org.elasticsearch.xpack.security.support.Automatons.minusAndDeterminize;
import static org.elasticsearch.xpack.security.support.Automatons.patterns;
/**
*
*/
public class ClusterPrivilege extends AbstractAutomatonPrivilege<ClusterPrivilege> {
// shared automatons

View File

@ -8,9 +8,6 @@ package org.elasticsearch.xpack.security.authz.privilege;
import dk.brics.automaton.Automaton;
import dk.brics.automaton.BasicAutomata;
/**
*
*/
public class GeneralPrivilege extends AbstractAutomatonPrivilege<GeneralPrivilege> {
public static final GeneralPrivilege NONE = new GeneralPrivilege(Name.NONE, BasicAutomata.makeEmpty());

View File

@ -5,9 +5,6 @@
*/
package org.elasticsearch.xpack.security.authz.privilege;
/**
*
*/
public class HealthAndStatsPrivilege extends GeneralPrivilege {
public static final HealthAndStatsPrivilege INSTANCE = new HealthAndStatsPrivilege();

View File

@ -31,9 +31,6 @@ import java.util.function.Predicate;
import static org.elasticsearch.xpack.security.support.Automatons.patterns;
import static org.elasticsearch.xpack.security.support.Automatons.unionAndDeterminize;
/**
*
*/
public class IndexPrivilege extends AbstractAutomatonPrivilege<IndexPrivilege> {
private static final Automaton ALL_AUTOMATON = patterns("indices:*");

View File

@ -16,9 +16,6 @@ import static java.util.Collections.singleton;
import static java.util.Collections.unmodifiableSet;
import static org.elasticsearch.common.util.set.Sets.newHashSet;
/**
*
*/
public abstract class Privilege<P extends Privilege<P>> {
protected final Name name;

View File

@ -11,9 +11,6 @@ import java.util.function.Predicate;
import static org.elasticsearch.xpack.security.support.Automatons.patterns;
/**
*
*/
public class SystemPrivilege extends Privilege<SystemPrivilege> {
public static SystemPrivilege INSTANCE = new SystemPrivilege();

View File

@ -135,7 +135,7 @@ public class NativeRolesStore extends AbstractComponent implements RolesStore, C
this.client = client;
this.roleCache = CacheBuilder.<String, RoleAndVersion>builder()
.setMaximumWeight(CACHE_SIZE_SETTING.get(settings))
.setExpireAfterWrite(CACHE_TTL_SETTING.get(settings).getMillis())
.setExpireAfterWrite(CACHE_TTL_SETTING.get(settings).getNanos())
.build();
this.isTribeNode = settings.getGroups("tribe", true).isEmpty() == false;
}
@ -354,6 +354,9 @@ public class NativeRolesStore extends AbstractComponent implements RolesStore, C
@Override
public Role role(String roleName) {
if (state() != State.STARTED) {
return null;
}
RoleAndVersion roleAndVersion = getRoleAndVersion(roleName);
return roleAndVersion == null ? null : roleAndVersion.getRole();
}
@ -443,6 +446,10 @@ public class NativeRolesStore extends AbstractComponent implements RolesStore, C
}
private RoleAndVersion getRoleAndVersion(final String roleId) {
if (securityIndexExists == false) {
return null;
}
RoleAndVersion roleAndVersion = null;
final AtomicReference<GetResponse> getRef = new AtomicReference<>(null);
final CountDownLatch latch = new CountDownLatch(1);

View File

@ -27,9 +27,6 @@ import org.elasticsearch.xpack.security.user.KibanaUser;
import org.elasticsearch.xpack.security.user.SystemUser;
import org.elasticsearch.xpack.security.user.User;
/**
*
*/
public class ReservedRolesStore implements RolesStore {
private static final User DEFAULT_ENABLED_KIBANA_USER = new KibanaUser(true);

View File

@ -11,9 +11,6 @@ import org.elasticsearch.rest.RestRequest;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
/**
*
*/
public class RemoteHostHeader {
static final String KEY = "_rest_remote_address";

View File

@ -34,9 +34,6 @@ import java.security.cert.X509Certificate;
import static org.elasticsearch.xpack.XPackSettings.HTTP_SSL_ENABLED;
/**
*
*/
public class SecurityRestFilter extends RestFilter {
private final AuthenticationService service;

View File

@ -8,9 +8,6 @@ package org.elasticsearch.xpack.security.rest;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.security.support.AbstractSecurityModule;
/**
*
*/
public class SecurityRestModule extends AbstractSecurityModule.Node {
public SecurityRestModule(Settings settings) {

View File

@ -19,9 +19,6 @@ import java.io.IOException;
import static org.elasticsearch.rest.RestRequest.Method.POST;
/**
*
*/
public class RestClearRolesCacheAction extends BaseRestHandler {
@Inject

View File

@ -26,8 +26,6 @@ import java.io.IOException;
import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.RestRequest.Method.PUT;
/**
*/
public class RestChangePasswordAction extends BaseRestHandler {
private final SecurityContext securityContext;

Some files were not shown because too many files have changed in this diff Show More