-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
4,796 additions
and
272 deletions.
There are no files selected for viewing
149 changes: 0 additions & 149 deletions
149
...ctors-protocal-shade/src/main/java/org/apache/hadoop/hbase/util/ForeignExceptionUtil.java
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
hbase-connectors-protocal-shade/src/main/protobuf/ErrorHandling.proto
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/http/AdminAuthorizedFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} | ||
} |
Oops, something went wrong.