You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2013/02/23 03:25:52 UTC
svn commit: r1449263 -
/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java
Author: tedyu
Date: Sat Feb 23 02:25:52 2013
New Revision: 1449263
URL: http://svn.apache.org/r1449263
Log:
HBASE-7913 Secure Rest server should login before getting an instance of Rest servlet (Arpit)
Modified:
hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java
Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java?rev=1449263&r1=1449262&r2=1449263&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java Sat Feb 23 02:25:52 2013
@@ -76,8 +76,17 @@ public class Main implements Constants {
public static void main(String[] args) throws Exception {
Log LOG = LogFactory.getLog("RESTServer");
- VersionInfo.logVersion();
+ VersionInfo.logVersion();
Configuration conf = HBaseConfiguration.create();
+ // login the server principal (if using secure Hadoop)
+ if (User.isSecurityEnabled() && User.isHBaseSecurityEnabled(conf)) {
+ String machineName = Strings.domainNamePointerToHostName(
+ DNS.getDefaultHost(conf.get("hbase.rest.dns.interface", "default"),
+ conf.get("hbase.rest.dns.nameserver", "default")));
+ User.login(conf, "hbase.rest.keytab.file", "hbase.rest.kerberos.principal",
+ machineName);
+ }
+
RESTServlet servlet = RESTServlet.getInstance(conf);
Options options = new Options();
@@ -170,15 +179,6 @@ public class Main implements Constants {
context.addServlet(sh, "/*");
context.addFilter(GzipFilter.class, "/*", 0);
- // login the server principal (if using secure Hadoop)
- if (User.isSecurityEnabled() && User.isHBaseSecurityEnabled(conf)) {
- String machineName = Strings.domainNamePointerToHostName(
- DNS.getDefaultHost(conf.get("hbase.rest.dns.interface", "default"),
- conf.get("hbase.rest.dns.nameserver", "default")));
- User.login(conf, "hbase.rest.keytab.file", "hbase.rest.kerberos.principal",
- machineName);
- }
-
// Put up info server.
int port = conf.getInt("hbase.rest.info.port", 8085);
if (port >= 0) {
@@ -193,4 +193,4 @@ public class Main implements Constants {
server.start();
server.join();
}
-}
+}
\ No newline at end of file