You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by co...@apache.org on 2016/09/28 09:33:08 UTC
[15/19] incubator-ranger git commit: Removing spaces before semicolons
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/eb21ea6a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/RemoteUnixLoginModule.java
----------------------------------------------------------------------
diff --git a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/RemoteUnixLoginModule.java b/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/RemoteUnixLoginModule.java
index c0f136c..4b47ea7 100644
--- a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/RemoteUnixLoginModule.java
+++ b/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/RemoteUnixLoginModule.java
@@ -73,7 +73,7 @@ public class RemoteUnixLoginModule implements LoginModule {
private char[] password;
private Subject subject;
private CallbackHandler callbackHandler;
- private boolean debug = true ;
+ private boolean debug = true;
private String remoteHostName;
private int remoteHostAuthServicePort;
@@ -88,9 +88,9 @@ public class RemoteUnixLoginModule implements LoginModule {
private boolean SSLEnabled = false;
- private boolean serverCertValidation = true ;
+ private boolean serverCertValidation = true;
- private boolean remoteLoginEnabled = true ;
+ private boolean remoteLoginEnabled = true;
public RemoteUnixLoginModule() {
log("Created RemoteUnixLoginModule");
@@ -129,24 +129,24 @@ public class RemoteUnixLoginModule implements LoginModule {
this.subject = subject;
this.callbackHandler = callbackHandler;
- log("RemoteUnixLoginModule::initialize() has been called with callbackhandler: " + this.callbackHandler) ;
+ log("RemoteUnixLoginModule::initialize() has been called with callbackhandler: " + this.callbackHandler);
if (this.callbackHandler == null) {
this.callbackHandler = new ConsolePromptCallbackHandler();
}
/*
- Properties config = null ;
+ Properties config = null;
String val = (String) options.get(REMOTE_UNIX_AUTHENICATION_CONFIG_FILE_PARAM);
- log("Remote Unix Auth Configuration file [" + val + "]") ;
+ log("Remote Unix Auth Configuration file [" + val + "]");
if (val != null) {
- InputStream in = null ;
+ InputStream in = null;
try {
- in = getFileInputStream(val) ;
+ in = getFileInputStream(val);
if (in != null) {
try {
- config = new Properties() ;
+ config = new Properties();
// config.load(in);
DocumentBuilderFactory xmlDocumentBuilderFactory = DocumentBuilderFactory
.newInstance();
@@ -204,21 +204,21 @@ public class RemoteUnixLoginModule implements LoginModule {
}
catch(Throwable t) {
- logError("Unable to load REMOTE_UNIX_AUTHENICATION_CONFIG_FILE_PARAM [" + val + "]") ;
+ logError("Unable to load REMOTE_UNIX_AUTHENICATION_CONFIG_FILE_PARAM [" + val + "]");
}
}
if (config == null) {
- logError("Remote Unix Auth Configuration is being loaded from XML configuration - not Properties") ;
- config = new Properties() ;
+ logError("Remote Unix Auth Configuration is being loaded from XML configuration - not Properties");
+ config = new Properties();
config.putAll(options);
}
*/
- Properties config = new Properties() ;
- config.putAll(options) ;
- initParams(config) ;
+ Properties config = new Properties();
+ config.putAll(options);
+ initParams(config);
}
@@ -226,17 +226,17 @@ public class RemoteUnixLoginModule implements LoginModule {
public void initParams(Properties options) {
- String val = (String) options.get(JAAS_ENABLED_PARAM) ;
+ String val = (String) options.get(JAAS_ENABLED_PARAM);
if (val != null) {
- remoteLoginEnabled = val.trim().equalsIgnoreCase("true") ;
+ remoteLoginEnabled = val.trim().equalsIgnoreCase("true");
if (! remoteLoginEnabled) {
- System.err.println("Skipping RemoteLogin - [" + JAAS_ENABLED_PARAM + "] => [" + val + "]") ;
- return ;
+ System.err.println("Skipping RemoteLogin - [" + JAAS_ENABLED_PARAM + "] => [" + val + "]");
+ return;
}
}
else {
- remoteLoginEnabled = true ;
+ remoteLoginEnabled = true;
}
val = (String) options.get(DEBUG_PARAM);
@@ -244,7 +244,7 @@ public class RemoteUnixLoginModule implements LoginModule {
debug = true;
}
else {
- debug = false ;
+ debug = false;
}
remoteHostName = (String) options.get(REMOTE_LOGIN_HOST_PARAM);
@@ -257,8 +257,8 @@ public class RemoteUnixLoginModule implements LoginModule {
log("remoteHostAuthServicePort:" + remoteHostAuthServicePort);
- val = (String)options.get(SSL_ENABLED_PARAM) ;
- SSLEnabled = (val != null) && val.trim().equalsIgnoreCase("true") ;
+ val = (String)options.get(SSL_ENABLED_PARAM);
+ SSLEnabled = (val != null) && val.trim().equalsIgnoreCase("true");
log("SSLEnabled:" + SSLEnabled);
if (SSLEnabled) {
@@ -283,9 +283,9 @@ public class RemoteUnixLoginModule implements LoginModule {
log("keyStorePathPassword:*****");
}
- String certValidationFlag = (String) options.get(SERVER_CERT_VALIDATION_PARAM) ;
- serverCertValidation = (! (certValidationFlag != null && ("false".equalsIgnoreCase(certValidationFlag.trim().toLowerCase())))) ;
- log("Server Cert Validation : " + serverCertValidation) ;
+ String certValidationFlag = (String) options.get(SERVER_CERT_VALIDATION_PARAM);
+ serverCertValidation = (! (certValidationFlag != null && ("false".equalsIgnoreCase(certValidationFlag.trim().toLowerCase()))));
+ log("Server Cert Validation : " + serverCertValidation);
}
}
@@ -306,12 +306,12 @@ public class RemoteUnixLoginModule implements LoginModule {
userName = nameCallback.getName();
- String modifiedUserName = userName ;
+ String modifiedUserName = userName;
if (userName != null) {
- int atStartsAt = userName.indexOf("@") ;
+ int atStartsAt = userName.indexOf("@");
if ( atStartsAt > -1) {
- modifiedUserName = userName.substring(0, atStartsAt) ;
+ modifiedUserName = userName.substring(0, atStartsAt);
}
}
@@ -405,7 +405,7 @@ public class RemoteUnixLoginModule implements LoginModule {
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- TrustManager[] tm = null ;
+ TrustManager[] tm = null;
if (serverCertValidation) {
@@ -449,7 +449,7 @@ public class RemoteUnixLoginModule implements LoginModule {
}
};
- tm = new TrustManager[] {ignoreValidationTM} ;
+ tm = new TrustManager[] {ignoreValidationTM};
}
SecureRandom random = new SecureRandom();
@@ -510,7 +510,7 @@ public class RemoteUnixLoginModule implements LoginModule {
}
if (ret == null) {
- ret = ClassLoader.getSystemClassLoader().getResourceAsStream(path) ;
+ ret = ClassLoader.getSystemClassLoader().getResourceAsStream(path);
if (ret == null) {
if (! path.startsWith("/")) {
ret = ClassLoader.getSystemResourceAsStream("/" + path);
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/eb21ea6a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixGroupPrincipal.java
----------------------------------------------------------------------
diff --git a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixGroupPrincipal.java b/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixGroupPrincipal.java
index 5c2e838..ecc416b 100644
--- a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixGroupPrincipal.java
+++ b/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixGroupPrincipal.java
@@ -26,15 +26,15 @@ public class UnixGroupPrincipal implements Principal, Serializable {
private static final long serialVersionUID = 8137147441841439754L;
- private String groupName ;
+ private String groupName;
public UnixGroupPrincipal(String groupName) {
- this.groupName = groupName ;
+ this.groupName = groupName;
}
@Override
public String getName() {
- return groupName ;
+ return groupName;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/eb21ea6a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixUserPrincipal.java
----------------------------------------------------------------------
diff --git a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixUserPrincipal.java b/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixUserPrincipal.java
index e71a965..84cb6c3 100644
--- a/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixUserPrincipal.java
+++ b/unixauthclient/src/main/java/org/apache/ranger/authentication/unix/jaas/UnixUserPrincipal.java
@@ -26,15 +26,15 @@ public class UnixUserPrincipal implements Principal, Serializable {
private static final long serialVersionUID = -3568658536591178268L;
- private String userName ;
+ private String userName;
public UnixUserPrincipal(String userName) {
- this.userName = userName ;
+ this.userName = userName;
}
@Override
public String getName() {
- return userName ;
+ return userName;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/eb21ea6a/unixauthclient/src/test/com/xasecure/test/authentication/UnixAuthenticationTester.java
----------------------------------------------------------------------
diff --git a/unixauthclient/src/test/com/xasecure/test/authentication/UnixAuthenticationTester.java b/unixauthclient/src/test/com/xasecure/test/authentication/UnixAuthenticationTester.java
index 2dd2804..41317f6 100644
--- a/unixauthclient/src/test/com/xasecure/test/authentication/UnixAuthenticationTester.java
+++ b/unixauthclient/src/test/com/xasecure/test/authentication/UnixAuthenticationTester.java
@@ -28,10 +28,10 @@ public class UnixAuthenticationTester {
}
public void run() throws Throwable {
- LoginContext loginContext = new LoginContext("PolicyManager") ;
- System.err.println("After login ...") ;
+ LoginContext loginContext = new LoginContext("PolicyManager");
+ System.err.println("After login ...");
loginContext.login();
- System.err.println("Subject:" + loginContext.getSubject() ) ;
+ System.err.println("Subject:" + loginContext.getSubject() );
loginContext.logout();
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/eb21ea6a/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java
----------------------------------------------------------------------
diff --git a/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java b/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java
index dd0e7d5..8801611 100644
--- a/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java
+++ b/unixauthservice/src/main/java/org/apache/ranger/authentication/PasswordValidator.java
@@ -31,76 +31,76 @@ import org.apache.log4j.Logger;
public class PasswordValidator implements Runnable {
- private static final Logger LOG = Logger.getLogger(PasswordValidator.class) ;
+ private static final Logger LOG = Logger.getLogger(PasswordValidator.class);
- private static String validatorProgram = null ;
+ private static String validatorProgram = null;
- private static List<String> adminUserList ;
+ private static List<String> adminUserList;
- private static String adminRoleNames ;
+ private static String adminRoleNames;
- private Socket client ;
+ private Socket client;
public PasswordValidator(Socket client) {
- this.client = client ;
+ this.client = client;
}
@Override
public void run() {
- BufferedReader reader = null ;
+ BufferedReader reader = null;
PrintWriter writer = null;
- String userName = null ;
+ String userName = null;
try {
- reader = new BufferedReader(new InputStreamReader(client.getInputStream())) ;
- writer = new PrintWriter(new OutputStreamWriter(client.getOutputStream())) ;
- String request = reader.readLine() ;
+ reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
+ writer = new PrintWriter(new OutputStreamWriter(client.getOutputStream()));
+ String request = reader.readLine();
if (request.startsWith("LOGIN:")) {
- String line = request.substring(6).trim() ;
- int passwordAt = line.indexOf(' ') ;
+ String line = request.substring(6).trim();
+ int passwordAt = line.indexOf(' ');
if (passwordAt != -1) {
- userName = line.substring(0,passwordAt).trim() ;
+ userName = line.substring(0,passwordAt).trim();
}
}
if (validatorProgram == null) {
- String res = "FAILED: Unable to validate credentials." ;
- writer.println(res) ;
+ String res = "FAILED: Unable to validate credentials.";
+ writer.println(res);
writer.flush();
- LOG.error("Response [" + res + "] for user: " + userName + " as ValidatorProgram is not defined in configuration.") ;
+ LOG.error("Response [" + res + "] for user: " + userName + " as ValidatorProgram is not defined in configuration.");
}
else {
- BufferedReader pReader = null ;
+ BufferedReader pReader = null;
PrintWriter pWriter = null;
Process p = null;
try {
- p = Runtime.getRuntime().exec(validatorProgram) ;
+ p = Runtime.getRuntime().exec(validatorProgram);
- pReader = new BufferedReader(new InputStreamReader(p.getInputStream())) ;
+ pReader = new BufferedReader(new InputStreamReader(p.getInputStream()));
- pWriter = new PrintWriter(new OutputStreamWriter(p.getOutputStream())) ;
+ pWriter = new PrintWriter(new OutputStreamWriter(p.getOutputStream()));
- pWriter.println(request) ; pWriter.flush();
+ pWriter.println(request); pWriter.flush();
- String res = pReader.readLine() ;
+ String res = pReader.readLine();
if (res != null && res.startsWith("OK")) {
if (adminRoleNames != null && adminUserList != null) {
if (adminUserList.contains(userName)) {
- res = res + " " + adminRoleNames ;
+ res = res + " " + adminRoleNames;
}
}
}
LOG.info("Response [" + res + "] for user: " + userName);
- writer.println(res) ; writer.flush();
+ writer.println(res); writer.flush();
}
finally {
if (p != null) {
@@ -112,8 +112,8 @@ public class PasswordValidator implements Runnable {
}
catch(Throwable t) {
if (userName != null && writer != null ) {
- String res = "FAILED: unable to validate due to error " + t ;
- writer.println(res) ;
+ String res = "FAILED: unable to validate due to error " + t;
+ writer.println(res);
LOG.error("Response [" + res + "] for user: " + userName, t);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/eb21ea6a/unixauthservice/src/main/java/org/apache/ranger/authentication/UnixAuthenticationService.java
----------------------------------------------------------------------
diff --git a/unixauthservice/src/main/java/org/apache/ranger/authentication/UnixAuthenticationService.java b/unixauthservice/src/main/java/org/apache/ranger/authentication/UnixAuthenticationService.java
index 86a56f3..99a38db 100644
--- a/unixauthservice/src/main/java/org/apache/ranger/authentication/UnixAuthenticationService.java
+++ b/unixauthservice/src/main/java/org/apache/ranger/authentication/UnixAuthenticationService.java
@@ -54,43 +54,43 @@ import org.w3c.dom.NodeList;
public class UnixAuthenticationService {
- private static final Logger LOG = Logger.getLogger(UnixAuthenticationService.class) ;
+ private static final Logger LOG = Logger.getLogger(UnixAuthenticationService.class);
- private static final String serviceName = "UnixAuthenticationService" ;
+ private static final String serviceName = "UnixAuthenticationService";
- private static final String SSL_ALGORITHM = "TLS" ;
- private static final String REMOTE_LOGIN_AUTH_SERVICE_PORT_PARAM = "ranger.usersync.port" ;
+ private static final String SSL_ALGORITHM = "TLS";
+ private static final String REMOTE_LOGIN_AUTH_SERVICE_PORT_PARAM = "ranger.usersync.port";
- private static final String SSL_KEYSTORE_PATH_PARAM = "ranger.usersync.keystore.file" ;
- private static final String SSL_TRUSTSTORE_PATH_PARAM = "ranger.usersync.truststore.file" ;
+ private static final String SSL_KEYSTORE_PATH_PARAM = "ranger.usersync.keystore.file";
+ private static final String SSL_TRUSTSTORE_PATH_PARAM = "ranger.usersync.truststore.file";
- private static final String SSL_KEYSTORE_PATH_PASSWORD_ALIAS = "usersync.ssl.key.password" ;
- private static final String SSL_TRUSTSTORE_PATH_PASSWORD_ALIAS = "usersync.ssl.truststore.password" ;
+ private static final String SSL_KEYSTORE_PATH_PASSWORD_ALIAS = "usersync.ssl.key.password";
+ private static final String SSL_TRUSTSTORE_PATH_PASSWORD_ALIAS = "usersync.ssl.truststore.password";
- private static final String CRED_VALIDATOR_PROG = "ranger.usersync.passwordvalidator.path" ;
- private static final String ADMIN_USER_LIST_PARAM = "admin.users" ;
- private static final String ADMIN_ROLE_LIST_PARAM = "admin.roleNames" ;
- private static final String SSL_ENABLED_PARAM = "ranger.usersync.ssl" ;
+ private static final String CRED_VALIDATOR_PROG = "ranger.usersync.passwordvalidator.path";
+ private static final String ADMIN_USER_LIST_PARAM = "admin.users";
+ private static final String ADMIN_ROLE_LIST_PARAM = "admin.roleNames";
+ private static final String SSL_ENABLED_PARAM = "ranger.usersync.ssl";
- private static final String CREDSTORE_FILENAME_PARAM = "ranger.usersync.credstore.filename" ;
+ private static final String CREDSTORE_FILENAME_PARAM = "ranger.usersync.credstore.filename";
- private String keyStorePath ;
- private String keyStorePathPassword ;
- private String trustStorePath ;
- private String trustStorePathPassword ;
- private List<String> adminUserList = new ArrayList<String>() ;
- private String adminRoleNames ;
+ private String keyStorePath;
+ private String keyStorePathPassword;
+ private String trustStorePath;
+ private String trustStorePathPassword;
+ private List<String> adminUserList = new ArrayList<String>();
+ private String adminRoleNames;
- private int portNum ;
+ private int portNum;
- private boolean SSLEnabled = false ;
+ private boolean SSLEnabled = false;
static private boolean enableUnixAuth = false;
- private static final String[] UGSYNC_CONFIG_XML_FILES = { "ranger-ugsync-default.xml", "ranger-ugsync-site.xml" } ;
- private static final String PROPERTY_ELEMENT_TAGNAME = "property" ;
- private static final String NAME_ELEMENT_TAGNAME = "name" ;
- private static final String VALUE_ELEMENT_TAGNAME = "value" ;
+ private static final String[] UGSYNC_CONFIG_XML_FILES = { "ranger-ugsync-default.xml", "ranger-ugsync-site.xml" };
+ private static final String PROPERTY_ELEMENT_TAGNAME = "property";
+ private static final String NAME_ELEMENT_TAGNAME = "name";
+ private static final String VALUE_ELEMENT_TAGNAME = "value";
public static void main(String[] args) {
if (args.length > 0) {
@@ -101,8 +101,8 @@ public class UnixAuthenticationService {
}
}
}
- UnixAuthenticationService service = new UnixAuthenticationService() ;
- service.run() ;
+ UnixAuthenticationService service = new UnixAuthenticationService();
+ service.run();
}
public UnixAuthenticationService() {
@@ -112,11 +112,11 @@ public class UnixAuthenticationService {
public void run() {
try {
LOG.info("Starting User Sync Service!");
- startUnixUserGroupSyncProcess() ;
+ startUnixUserGroupSyncProcess();
if (enableUnixAuth) {
LOG.info("Enabling Unix Auth Service!");
- init() ;
- startService() ;
+ init();
+ startService();
} else {
LOG.info("Unix Auth Service Disabled!");
}
@@ -133,8 +133,8 @@ public class UnixAuthenticationService {
//
// Start the synchronization service ...
//
- UserGroupSync syncProc = new UserGroupSync() ;
- Thread newSyncProcThread = new Thread(syncProc) ;
+ UserGroupSync syncProc = new UserGroupSync();
+ Thread newSyncProcThread = new Thread(syncProc);
newSyncProcThread.setName("UnixUserSyncThread");
newSyncProcThread.setDaemon(false);
newSyncProcThread.start();
@@ -143,11 +143,11 @@ public class UnixAuthenticationService {
//TODO: add more validation code
private void init() throws Throwable {
- Properties prop = new Properties() ;
+ Properties prop = new Properties();
for (String fn : UGSYNC_CONFIG_XML_FILES ) {
- InputStream in = getFileInputStream(fn) ;
+ InputStream in = getFileInputStream(fn);
if (in != null) {
try {
@@ -185,7 +185,7 @@ public class UnixAuthenticationService {
//LOG.info("Adding Property:[" + propertyName + "] Value:["+ propertyValue + "]");
if (prop.get(propertyName) != null ) {
- prop.remove(propertyName) ;
+ prop.remove(propertyName);
}
prop.put(propertyName, propertyValue);
}
@@ -202,15 +202,15 @@ public class UnixAuthenticationService {
}
}
- String credStoreFileName = prop.getProperty(CREDSTORE_FILENAME_PARAM) ;
+ String credStoreFileName = prop.getProperty(CREDSTORE_FILENAME_PARAM);
- keyStorePath = prop.getProperty(SSL_KEYSTORE_PATH_PARAM) ;
+ keyStorePath = prop.getProperty(SSL_KEYSTORE_PATH_PARAM);
if (credStoreFileName == null) {
- throw new RuntimeException("Credential file is not defined. param = [" + CREDSTORE_FILENAME_PARAM + "]") ;
+ throw new RuntimeException("Credential file is not defined. param = [" + CREDSTORE_FILENAME_PARAM + "]");
}
- File credFile = new File(credStoreFileName) ;
+ File credFile = new File(credStoreFileName);
if (! credFile.exists()) {
throw new RuntimeException("Credential file [" + credStoreFileName + "]: does not exists." );
@@ -220,37 +220,37 @@ public class UnixAuthenticationService {
throw new RuntimeException("Credential file [" + credStoreFileName + "]: can not be read." );
}
- keyStorePathPassword = CredentialReader.getDecryptedString(credStoreFileName, SSL_KEYSTORE_PATH_PASSWORD_ALIAS) ;
- trustStorePathPassword = CredentialReader.getDecryptedString(credStoreFileName,SSL_TRUSTSTORE_PATH_PASSWORD_ALIAS) ;
+ keyStorePathPassword = CredentialReader.getDecryptedString(credStoreFileName, SSL_KEYSTORE_PATH_PASSWORD_ALIAS);
+ trustStorePathPassword = CredentialReader.getDecryptedString(credStoreFileName,SSL_TRUSTSTORE_PATH_PASSWORD_ALIAS);
- trustStorePath = prop.getProperty(SSL_TRUSTSTORE_PATH_PARAM) ;
- portNum = Integer.parseInt(prop.getProperty(REMOTE_LOGIN_AUTH_SERVICE_PORT_PARAM)) ;
- String validatorProg = prop.getProperty(CRED_VALIDATOR_PROG) ;
+ trustStorePath = prop.getProperty(SSL_TRUSTSTORE_PATH_PARAM);
+ portNum = Integer.parseInt(prop.getProperty(REMOTE_LOGIN_AUTH_SERVICE_PORT_PARAM));
+ String validatorProg = prop.getProperty(CRED_VALIDATOR_PROG);
if (validatorProg != null) {
PasswordValidator.setValidatorProgram(validatorProg);
}
- String adminUsers = prop.getProperty(ADMIN_USER_LIST_PARAM) ;
+ String adminUsers = prop.getProperty(ADMIN_USER_LIST_PARAM);
if (adminUsers != null && adminUsers.trim().length() > 0) {
for(String u : adminUsers.split(",")) {
LOG.info("Adding Admin User:" + u.trim());
- adminUserList.add(u.trim()) ;
+ adminUserList.add(u.trim());
}
PasswordValidator.setAdminUserList(adminUserList);
}
- adminRoleNames = prop.getProperty(ADMIN_ROLE_LIST_PARAM) ;
+ adminRoleNames = prop.getProperty(ADMIN_ROLE_LIST_PARAM);
if (adminRoleNames != null) {
LOG.info("Adding Admin Group:" + adminRoleNames);
- PasswordValidator.setAdminRoleNames(adminRoleNames) ;
+ PasswordValidator.setAdminRoleNames(adminRoleNames);
}
- String SSLEnabledProp = prop.getProperty(SSL_ENABLED_PARAM) ;
+ String SSLEnabledProp = prop.getProperty(SSL_ENABLED_PARAM);
- SSLEnabled = (SSLEnabledProp != null && (SSLEnabledProp.equalsIgnoreCase("true"))) ;
+ SSLEnabled = (SSLEnabledProp != null && (SSLEnabledProp.equalsIgnoreCase("true")));
// LOG.info("Key:" + keyStorePath);
// LOG.info("KeyPassword:" + keyStorePathPassword);
@@ -264,20 +264,20 @@ public class UnixAuthenticationService {
public void startService() throws Throwable {
- SSLContext context = SSLContext.getInstance(SSL_ALGORITHM) ;
+ SSLContext context = SSLContext.getInstance(SSL_ALGORITHM);
- KeyManager[] km = null ;
+ KeyManager[] km = null;
if (keyStorePath != null && ! keyStorePath.isEmpty()) {
- KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()) ;
+ KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
- InputStream in = null ;
+ InputStream in = null;
- in = getFileInputStream(keyStorePath) ;
+ in = getFileInputStream(keyStorePath);
try {
if (keyStorePathPassword == null) {
- keyStorePathPassword = "" ;
+ keyStorePathPassword = "";
}
ks.load(in, keyStorePathPassword.toCharArray());
}
@@ -287,26 +287,26 @@ public class UnixAuthenticationService {
}
}
- KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()) ;
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(ks, keyStorePathPassword.toCharArray());
- km = kmf.getKeyManagers() ;
+ km = kmf.getKeyManagers();
}
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- KeyStore trustStoreKeyStore = null ;
+ KeyStore trustStoreKeyStore = null;
if (trustStorePath != null && ! trustStorePath.isEmpty()) {
- trustStoreKeyStore = KeyStore.getInstance(KeyStore.getDefaultType()) ;
+ trustStoreKeyStore = KeyStore.getInstance(KeyStore.getDefaultType());
- InputStream in = null ;
+ InputStream in = null;
- in = getFileInputStream(trustStorePath) ;
+ in = getFileInputStream(trustStorePath);
try {
if (trustStorePathPassword == null) {
- trustStorePathPassword = "" ;
+ trustStorePathPassword = "";
}
trustStoreKeyStore.load(in, trustStorePathPassword.toCharArray());
}
@@ -319,24 +319,24 @@ public class UnixAuthenticationService {
trustManagerFactory.init(trustStoreKeyStore);
- TrustManager[] tm = trustManagerFactory.getTrustManagers() ;
+ TrustManager[] tm = trustManagerFactory.getTrustManagers();
- SecureRandom random = new SecureRandom() ;
+ SecureRandom random = new SecureRandom();
context.init(km, tm, random);
- SSLServerSocketFactory sf = context.getServerSocketFactory() ;
+ SSLServerSocketFactory sf = context.getServerSocketFactory();
- ServerSocket socket = (SSLEnabled ? sf.createServerSocket(portNum) : new ServerSocket(portNum) ) ;
+ ServerSocket socket = (SSLEnabled ? sf.createServerSocket(portNum) : new ServerSocket(portNum) );
if (SSLEnabled) {
- SSLServerSocket secureSocket = (SSLServerSocket) socket ;
- String[] protocols = secureSocket.getEnabledProtocols() ;
- Set<String> allowedProtocols = new HashSet<String>() ;
+ SSLServerSocket secureSocket = (SSLServerSocket) socket;
+ String[] protocols = secureSocket.getEnabledProtocols();
+ Set<String> allowedProtocols = new HashSet<String>();
for(String ep : protocols) {
if (! ep.toUpperCase().startsWith("SSLV3")) {
LOG.info("Enabling Protocol: [" + ep + "]");
- allowedProtocols.add(ep) ;
+ allowedProtocols.add(ep);
}
else {
LOG.info("Disabling Protocol: [" + ep + "]");
@@ -349,12 +349,12 @@ public class UnixAuthenticationService {
}
- Socket client = null ;
+ Socket client = null;
try {
while ( (client = socket.accept()) != null ) {
- Thread clientValidatorThread = new Thread(new PasswordValidator(client)) ;
+ Thread clientValidatorThread = new Thread(new PasswordValidator(client));
clientValidatorThread.start();
}
} catch (IOException e) {
@@ -368,19 +368,19 @@ public class UnixAuthenticationService {
InputStream ret = null;
- File f = new File(path) ;
+ File f = new File(path);
if (f.exists()) {
- ret = new FileInputStream(f) ;
+ ret = new FileInputStream(f);
}
else {
- ret = getClass().getResourceAsStream(path) ;
+ ret = getClass().getResourceAsStream(path);
if (ret == null) {
- ret = getClass().getResourceAsStream("/" + path) ;
+ ret = getClass().getResourceAsStream("/" + path);
}
}
- return ret ;
+ return ret;
}
}