Skip to content

Commit

Permalink
HBASE-20999 Move hbase-REST to new hbase-connectors repository
Browse files Browse the repository at this point in the history
  • Loading branch information
ben2077 committed May 26, 2020
1 parent 2f551ab commit 75b93ec
Show file tree
Hide file tree
Showing 39 changed files with 4,796 additions and 272 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<description>Shaded protobuf protocol classes used by HBase Connectors internally.</description>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
<!--Version of protobuf that hbase uses internally (we shade our pb)
<!--Version of protobuf that hbase connectors uses internally (we shade our pb)
Must match what is out in hbase-thirdparty include.
-->
<internal.protobuf.version>3.7.1</internal.protobuf.version>
<internal.protobuf.version>3.5.1-1</internal.protobuf.version>
</properties>
<build>
<plugins>
Expand Down Expand Up @@ -189,10 +189,6 @@
<groupId>org.apache.htrace</groupId>
<artifactId>htrace-core4</artifactId>
</dependency>
<dependency>
<groupId>org.apache.yetus</groupId>
<artifactId>audience-annotations</artifactId>
</dependency>
</dependencies>
<profiles>
<!-- Skip the tests in this module -->
Expand Down
7 changes: 2 additions & 5 deletions hbase-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,14 @@
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-protocol-shaded</artifactId>
<artifactId>hbase-connectors-protocol-shaded</artifactId>
<version>${revision}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-hadoop-compat</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.http.ClickjackingPreventionFilter;
import org.apache.hadoop.hbase.http.HttpServerUtil;
import org.apache.hadoop.hbase.http.InfoServer;
import org.apache.hadoop.hbase.http.SecurityHeadersFilter;
import org.apache.hadoop.hbase.log.HBaseMarkers;
import org.apache.hadoop.hbase.rest.filter.AuthFilter;
import org.apache.hadoop.hbase.rest.filter.GzipFilter;
import org.apache.hadoop.hbase.rest.filter.RestCsrfPreventionFilter;
import org.apache.hadoop.hbase.rest.http.ClickjackingPreventionFilter;
import org.apache.hadoop.hbase.rest.http.HttpServerUtil;
import org.apache.hadoop.hbase.rest.http.InfoServer;
import org.apache.hadoop.hbase.rest.http.SecurityHeadersFilter;
import org.apache.hadoop.hbase.security.UserProvider;
import org.apache.hadoop.hbase.util.DNS;
import org.apache.hadoop.hbase.util.Pair;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.rest.util.ConnectionCache;
import org.apache.hadoop.hbase.rest.util.JvmPauseMonitor;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.filter.ParseFilter;
import org.apache.hadoop.hbase.security.UserProvider;
import org.apache.hadoop.hbase.util.ConnectionCache;
import org.apache.hadoop.hbase.util.JvmPauseMonitor;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.authorize.ProxyUsers;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.rest.http;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.authorize.AccessControlList;
import org.apache.yetus.audience.InterfaceAudience;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@InterfaceAudience.Private
public class AdminAuthorizedFilter implements Filter {

private Configuration conf;
private AccessControlList adminsAcl;

@Override public void init(FilterConfig filterConfig) throws ServletException {
adminsAcl = (AccessControlList) filterConfig.getServletContext().getAttribute(
HttpServer.ADMINS_ACL);
conf = (Configuration) filterConfig.getServletContext().getAttribute(
HttpServer.CONF_CONTEXT_ATTRIBUTE);
}

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse)) {
throw new UnsupportedOperationException("Only accepts HTTP");
}
HttpServletRequest httpReq = (HttpServletRequest) request;
HttpServletResponse httpResp = (HttpServletResponse) response;

if (!HttpServer.hasAdministratorAccess(conf, adminsAcl, httpReq, httpResp)) {
return;
}

chain.doFilter(request, response);
}

@Override public void destroy() {}
}
Loading

0 comments on commit 75b93ec

Please sign in to comment.