Permalink
Browse files

Clean up extra checks, logging only after I do something...

  • Loading branch information...
1 parent 1d00dc6 commit bcf7b68fee3c9975f32b1d6ed0e88926fe349926 @jghoman jghoman committed Mar 17, 2012
@@ -22,20 +22,13 @@
import java.security.PrivilegedExceptionAction;
import java.util.Properties;
-import static azkaban.util.SecurityUtils.PROXY_KEYTAB_LOCATION;
-import static azkaban.util.SecurityUtils.PROXY_USER;
-import static azkaban.util.SecurityUtils.TO_PROXY;
import static azkaban.util.SecurityUtils.getProxiedUser;
-import static azkaban.util.SecurityUtils.verifySecureProperty;
public class SecurePigWrapper {
public static void main(final String[] args) throws IOException, InterruptedException {
Logger logger = Logger.getRootLogger();
Properties p = new Properties();
- // No need to check if we should should.proxy - if we're called, we should.
- for(String s : new String [] {PROXY_KEYTAB_LOCATION, PROXY_USER, TO_PROXY}) {
- p.put(s, verifySecureProperty(System.getProperties(), s, logger));
- }
+
getProxiedUser(p, logger).doAs(new PrivilegedExceptionAction<Void>() {
@Override
@@ -47,8 +47,8 @@ public static synchronized UserGroupInformation getProxiedUser(String toProxy, P
String proxyUser = verifySecureProperty(prop, PROXY_USER, log);
UserGroupInformation.setConfiguration(new Configuration());
UserGroupInformation.loginUserFromKeytab(proxyUser, keytab);
- log.info("Logged in with user " + loginUser);
loginUser = UserGroupInformation.getLoginUser();
+ log.info("Logged in with user " + loginUser);
} else {
log.info("loginUser (" + loginUser + ") already created, refreshing tgt.");
loginUser.checkTGTAndReloginFromKeytab();

0 comments on commit bcf7b68

Please sign in to comment.