use of edu.uiuc.ncsa.security.core.util.MyLoggingFacade in project OA4MP by ncsa.
the class MyProxyLogon method main.
/**
* Provides a simple command-line interface.
*/
public static void main(String[] args) {
try {
Logger logger = Logger.getLogger(MyProxyLogon.class.getName());
logger.setUseParentHandlers(false);
MyLoggingFacade facade = new MyLoggingFacade(logger);
MyProxyLogon m = new MyProxyLogon(facade);
// MyLoggingFacade myLoggingFacade = new MyLoggingFacade(MyProxyLogon.class.getName());
// MyProxyLogon m = new MyProxyLogon(myLoggingFacade);
// Console cons = System.console();
String passphrase = null;
X509Certificate[] CAcerts;
X509CRL[] CRLs;
// MyProxyLogon.logger.setLevel(Level.ALL);
// Turn on for debugging if needed.
// if (cons != null) {
// char[] pass = cons.readPassword("[%s]", "MyProxy Passphrase:
// ");
// if (pass != null) {
// passphrase = new String(pass);
// }
// } else {
System.out.println("Warning: terminal will echo passphrase as you type.");
System.out.print("MyProxy Passphrase: ");
passphrase = m.readLine(System.in);
// }
if (passphrase == null) {
System.err.println("Error reading passphrase.");
System.exit(1);
}
m.setPassphrase(passphrase);
m.requestTrustRoots(true);
m.getCredentials();
m.writeProxyFile();
System.out.println("Credential written successfully.");
CAcerts = m.getTrustedCAs();
if (CAcerts != null) {
System.out.println(Integer.toString(CAcerts.length) + " CA certificates received.");
}
CRLs = m.getCRLs();
if (CRLs != null) {
System.out.println(Integer.toString(CRLs.length) + " CRLs received.");
}
if (m.writeTrustRoots()) {
System.out.println("Wrote trust roots to " + MyProxyLogon.getTrustRootPath() + ".");
} else {
System.out.println("Received no trust roots from MyProxy server.");
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
use of edu.uiuc.ncsa.security.core.util.MyLoggingFacade in project OA4MP by ncsa.
the class OA4MPServletInitializer method setupNotifiers.
public void setupNotifiers() throws IOException {
// do this once or you will have a message sent for each listener!
if (notifiersSet)
return;
MyProxyDelegationServlet mps = (MyProxyDelegationServlet) getServlet();
ServiceEnvironmentImpl env = (ServiceEnvironmentImpl) getEnvironment();
MyLoggingFacade logger = env.getMyLogger();
// debugging this...
NewClientNotifier newClientNotifier = createNewClientNotifier(env.getMailUtil(), logger);
MyProxyDelegationServlet.addNotificationListener(newClientNotifier);
MailUtil x = new MailUtil(env.getMailUtil().getMailEnvironment());
String fName = mps.getServletContext().getInitParameter(ERROR_NOTIFICATION_SUBJECT_KEY);
if (fName == null) {
logger.info("No error notification subject set. Skipping...");
notifiersSet = true;
return;
} else {
logger.info("Set error notification subject to " + fName);
}
x.setSubjectTemplate(getTemplate(new File(fName)));
fName = mps.getServletContext().getInitParameter(ERROR_NOTIFICATION_BODY_KEY);
if (fName == null) {
logger.info("No error notification message body set. Skipping...");
notifiersSet = true;
return;
} else {
logger.info("Set error notification message body to " + fName);
}
x.setMessageTemplate(getTemplate(new File(fName)));
ExceptionEventNotifier exceptionNotifier = new ExceptionEventNotifier(x, logger);
MyProxyDelegationServlet.addNotificationListener(exceptionNotifier);
notifiersSet = true;
}
use of edu.uiuc.ncsa.security.core.util.MyLoggingFacade in project OA4MP by ncsa.
the class AbstractClientBootstrapper method getConfigurationLoader.
@Override
public ConfigurationLoader getConfigurationLoader(ServletContext servletContext) throws Exception {
MyLoggingFacade logger = new MyLoggingFacade(getClass().getSimpleName());
logger.info("Starting to load configuration");
try {
ConfigurationLoader x = getConfigurationLoader(ServletConfigUtil.findConfigurationNode(servletContext, getOa4mpConfigFileKey(), getOa4mpConfigNameKey(), ClientXMLTags.COMPONENT));
logger.info("Loaded configuration named " + servletContext.getInitParameter(getOa4mpConfigNameKey()) + " from file " + servletContext.getInitParameter(getOa4mpConfigFileKey()));
return x;
} catch (MyConfigurationException ce) {
logger.info("Did not find a configuration via the servlet context:" + ce.getMessage());
}
logger.info("No configuration found in servlet context. Trying default locations");
// That didn't work, so try to look for it in a few other places.
String configName = servletContext.getInitParameter(getOa4mpConfigNameKey());
ConfigurationLoader loader = loadFromDefaultLocations(logger, configName);
if (loader != null) {
return loader;
}
MyConfigurationException cx = new MyConfigurationException("Error: No configuration found anyplace. OA4MP client startup aborted!");
logger.error(cx);
throw cx;
}
use of edu.uiuc.ncsa.security.core.util.MyLoggingFacade in project OA4MP by ncsa.
the class OA2ConfigurationLoader method getMLDAP.
protected MultiLDAPStoreProvider getMLDAP() {
if (mldap == null) {
mldap = new MultiLDAPStoreProvider(cn, isDefaultStoreDisabled(), (MyLoggingFacade) loggerProvider.get(), null, null, LDAPStoreProviderUtil.getLdapEntryProvider());
mldap.addListener(LDAPStoreProviderUtil.getM(cn));
mldap.addListener(LDAPStoreProviderUtil.getFSP(cn));
mldap.addListener(LDAPStoreProviderUtil.getMariaDB(cn, getMariaDBConnectionPoolProvider()));
mldap.addListener(LDAPStoreProviderUtil.getMysql(cn, getMySQLConnectionPoolProvider()));
mldap.addListener(LDAPStoreProviderUtil.getPG(cn, getPgConnectionPoolProvider()));
}
return mldap;
}
use of edu.uiuc.ncsa.security.core.util.MyLoggingFacade in project OA4MP by ncsa.
the class ServiceConfigTest method testClientApprovalStoreProvider.
public void testClientApprovalStoreProvider() throws Exception {
ConfigurationNode cn = getConfig("postgresql config");
MultiDSClientApprovalStoreProvider dap = new MultiDSClientApprovalStoreProvider(cn, true, new MyLoggingFacade("test"), null, null);
ClientApproverConverter cp = new ClientApproverConverter(new ClientApprovalProvider());
dap.addListener(new DSFSClientApprovalStoreProvider(cn, cp));
dap.addListener(new DSSQLClientApprovalStoreProvider(cn, new MySQLConnectionPoolProvider("oauth", "oauth"), MYSQL_STORE, cp));
dap.addListener(new DSSQLClientApprovalStoreProvider(cn, new PGConnectionPoolProvider("oauth", "oauth"), POSTGRESQL_STORE, cp));
ClientApprovalStore<ClientApproval> as = (ClientApprovalStore<ClientApproval>) dap.get();
}
Aggregations