Part of changes to switch from using System.err.println to using log4j.

This commit is contained in:
Juan Carlos Luciani 2007-02-15 18:16:52 +00:00
parent 76e1078be0
commit e1e74055b5
23 changed files with 344 additions and 273 deletions

View File

@ -31,6 +31,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.helpers.XMLReaderFactory;
import org.apache.log4j.Logger;
/** /**
* AuthMechConfig Class. * AuthMechConfig Class.
@ -40,6 +41,8 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/ */
public final class AuthMechConfig public final class AuthMechConfig
{ {
private static final Logger m_log = Logger.getLogger(AuthMechConfig.class);
// Well known authentication token configuration settings // Well known authentication token configuration settings
public final static String ClassName = "ClassName"; public final static String ClassName = "ClassName";
public final static String RelativeClassPath = "RelativeClassPath"; public final static String RelativeClassPath = "RelativeClassPath";
@ -56,7 +59,7 @@ public final class AuthMechConfig
*/ */
public AuthMechConfig() public AuthMechConfig()
{ {
System.err.println("AuthMechConfig()- Default"); m_log.debug("AuthMechConfig()- Default");
// Create a map to keep track of the token settings // Create a map to keep track of the token settings
m_mechSettingsMap = new HashMap<String, String>(); m_mechSettingsMap = new HashMap<String, String>();
@ -70,7 +73,7 @@ public final class AuthMechConfig
*/ */
public AuthMechConfig(String mechSettingsFileName) throws Exception public AuthMechConfig(String mechSettingsFileName) throws Exception
{ {
System.err.println("AuthMechConfig()-"); m_log.debug("AuthMechConfig()-");
// Create a map to keep track of the token settings // Create a map to keep track of the token settings
m_mechSettingsMap = new HashMap<String, String>(); m_mechSettingsMap = new HashMap<String, String>();
@ -93,22 +96,22 @@ public final class AuthMechConfig
} }
catch (SAXException e) catch (SAXException e)
{ {
System.err.println("AuthMechConfig()- " + mechSettingsFileName + " format error, exception: " + e.toString()); m_log.warn("AuthMechConfig()- " + mechSettingsFileName + " format error, exception: " + e.toString());
throw new Exception("AuthMechConfig()- authtoken.settings format error", e); throw new Exception("AuthMechConfig()- authtoken.settings format error", e);
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("AuthMechConfig()- SecurityException accessing " + mechSettingsFileName + " Exception=" + e.toString()); m_log.warn("AuthMechConfig()- SecurityException accessing " + mechSettingsFileName + " Exception=" + e.toString());
throw new Exception("AuthMechConfig()- Not able to access file", e); throw new Exception("AuthMechConfig()- Not able to access file", e);
} }
catch (FileNotFoundException e) catch (FileNotFoundException e)
{ {
System.err.println("AuthMechConfig()- File " + mechSettingsFileName + " not found"); m_log.warn("AuthMechConfig()- File " + mechSettingsFileName + " not found");
throw new Exception("AuthMechConfig()- File not found", e); throw new Exception("AuthMechConfig()- File not found", e);
} }
catch (IOException e) catch (IOException e)
{ {
System.err.println("AuthMechConfig()- IOException accessing " + mechSettingsFileName + " Exception=" + e.toString()); m_log.warn("AuthMechConfig()- IOException accessing " + mechSettingsFileName + " Exception=" + e.toString());
throw new Exception("AuthMechConfig()- Read error", e); throw new Exception("AuthMechConfig()- Read error", e);
} }
finally finally
@ -140,14 +143,14 @@ public final class AuthMechConfig
if (value == null) if (value == null)
{ {
System.err.println("AuthMechConfig.getSetting()- Did not find setting " + settingName); m_log.info("AuthMechConfig.getSetting()- Did not find setting " + settingName);
// The setting is not in our map, check if it is one to // The setting is not in our map, check if it is one to
// which we have defaults. // which we have defaults.
if (settingName.equals(Krb5ServicePrincipalName)) if (settingName.equals(Krb5ServicePrincipalName))
{ {
value = m_defaultKrb5ServicePrincipalNameValue; value = m_defaultKrb5ServicePrincipalNameValue;
System.err.println("AuthMechConfig.getSetting()- Assigning default value " + value); m_log.info("AuthMechConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_mechSettingsMap.put(Krb5ServicePrincipalName, m_defaultKrb5ServicePrincipalNameValue); m_mechSettingsMap.put(Krb5ServicePrincipalName, m_defaultKrb5ServicePrincipalNameValue);
@ -155,8 +158,8 @@ public final class AuthMechConfig
} }
else else
{ {
System.err.println("AuthMechConfig.getSetting()- Found setting " + settingName); m_log.info("AuthMechConfig.getSetting()- Found setting " + settingName);
System.err.println("AuthMechConfig.getSetting()- Setting value = " + value); m_log.info("AuthMechConfig.getSetting()- Setting value = " + value);
} }
return value; return value;

View File

@ -31,6 +31,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.helpers.XMLReaderFactory;
import org.apache.log4j.Logger;
/** /**
@ -50,6 +51,7 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/ */
public final class AuthReqMsg public final class AuthReqMsg
{ {
private static final Logger m_log = Logger.getLogger(AuthReqMsg.class);
protected String m_realm = null; protected String m_realm = null;
protected char[] m_authMechToken = null; protected char[] m_authMechToken = null;
@ -100,7 +102,7 @@ public final class AuthReqMsg
// Verify that we obtained all of the required elements // Verify that we obtained all of the required elements
if (m_state != DONE_PARSING) if (m_state != DONE_PARSING)
{ {
System.err.println("AuthReqMsg SAXHandler.endDocument()- Missing element"); m_log.error("AuthReqMsg SAXHandler.endDocument()- Missing element");
throw new SAXException("Missing element"); throw new SAXException("Missing element");
} }
} }
@ -128,7 +130,7 @@ public final class AuthReqMsg
} }
else else
{ {
System.err.println("AuthReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("AuthReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -142,7 +144,7 @@ public final class AuthReqMsg
} }
else else
{ {
System.err.println("AuthReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("AuthReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -156,7 +158,7 @@ public final class AuthReqMsg
} }
else else
{ {
System.err.println("AuthReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("AuthReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -170,13 +172,13 @@ public final class AuthReqMsg
} }
else else
{ {
System.err.println("AuthReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("AuthReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
default: default:
System.err.println("AuthReqMsg SAXHandler.startElement()- State error"); m_log.error("AuthReqMsg SAXHandler.startElement()- State error");
throw new SAXException("State error"); throw new SAXException("State error");
} }
} }
@ -203,7 +205,7 @@ public final class AuthReqMsg
} }
else else
{ {
System.err.println("AuthReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("AuthReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -217,7 +219,7 @@ public final class AuthReqMsg
} }
else else
{ {
System.err.println("AuthReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("AuthReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -231,7 +233,7 @@ public final class AuthReqMsg
} }
else else
{ {
System.err.println("AuthReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("AuthReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -245,13 +247,13 @@ public final class AuthReqMsg
} }
else else
{ {
System.err.println("AuthReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("AuthReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
default: default:
System.err.println("AuthReqMsg SAXHandler.endElement()- State error"); m_log.error("AuthReqMsg SAXHandler.endElement()- State error");
throw new SAXException("State error"); throw new SAXException("State error");
} }
} }
@ -361,7 +363,7 @@ public final class AuthReqMsg
} }
catch (SAXException e) catch (SAXException e)
{ {
System.err.println("AuthReqMsg()- Parse exception: " + e.toString()); m_log.error("AuthReqMsg()- Parse exception: " + e.toString());
throw new Exception("Protocol error", e); throw new Exception("Protocol error", e);
} }
} }

View File

@ -24,6 +24,8 @@
package com.novell.casa.authtoksvc; package com.novell.casa.authtoksvc;
import org.apache.log4j.Logger;
/** /**
* AuthRespMsg Class. * AuthRespMsg Class.
* *
@ -51,6 +53,7 @@ package com.novell.casa.authtoksvc;
*/ */
public final class AuthRespMsg public final class AuthRespMsg
{ {
private static final Logger m_log = Logger.getLogger(AuthRespMsg.class);
final String m_msg; final String m_msg;

View File

@ -33,6 +33,7 @@ import org.apache.axis.configuration.NullProvider;
import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPBody; import org.apache.axis.message.SOAPBody;
import org.apache.axis.message.MessageElement; import org.apache.axis.message.MessageElement;
import org.apache.log4j.Logger;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import java.io.*; import java.io.*;
@ -56,6 +57,8 @@ import java.io.*;
*/ */
public final class AuthToken public final class AuthToken
{ {
private static final Logger m_log = Logger.getLogger(AuthToken.class);
private String m_token; private String m_token;
private String m_lifetime = ""; private String m_lifetime = "";
private String m_lifetimeShorter = ""; private String m_lifetimeShorter = "";
@ -138,8 +141,8 @@ public final class AuthToken
} }
catch (Exception e) catch (Exception e)
{ {
// tbd m_log.error("AuthToken()- Exception: " + e.toString());
System.err.println("AuthToken()- Exception: " + e.toString()); throw e;
} }
finally finally
{ {
@ -158,6 +161,7 @@ public final class AuthToken
} }
else else
{ {
m_log.error("AuthToken()- Error: Missing authentication token config for " + targetService);
throw new Exception("Error: Missing authentication token config for " + targetService); throw new Exception("Error: Missing authentication token config for " + targetService);
} }
} }
@ -189,7 +193,7 @@ public final class AuthToken
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("AuthToken()- Exception caught creating message, msg: " + e.getMessage()); m_log.warn("AuthToken()- Exception caught creating message, msg: " + e.getMessage());
throw new Exception("Invalid Authentication Token", e); throw new Exception("Invalid Authentication Token", e);
} }
finally finally
@ -233,14 +237,14 @@ public final class AuthToken
if (m_identityToken == null || m_identityTokenType == null) if (m_identityToken == null || m_identityTokenType == null)
{ {
System.out.println("AuthToken()- Required data missing from authentication token"); m_log.warn("AuthToken()- Required data missing from authentication token");
throw new Exception("Error: Required data missing from Authentication Token"); throw new Exception("Error: Required data missing from Authentication Token");
} }
} }
else else
{ {
// Message verification failed // Message verification failed
System.err.println("AuthToken()- Invalid Authentication Token"); m_log.warn("AuthToken()- Invalid Authentication Token");
throw new Exception("Invalid Authentication Token"); throw new Exception("Invalid Authentication Token");
} }
} }
@ -298,7 +302,7 @@ public final class AuthToken
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("AuthToken.getMessage() - Exception caught building message, error: " + e.getMessage()); m_log.error("AuthToken.getMessage() - Exception caught building message, error: " + e.getMessage());
secureMessage = null; secureMessage = null;
} }
if (inStream != null) if (inStream != null)
@ -340,7 +344,7 @@ public final class AuthToken
// Throw exeption if the lifetime parameter is not set // Throw exeption if the lifetime parameter is not set
if (m_lifetime.length() == 0) if (m_lifetime.length() == 0)
{ {
System.out.println("AuthToken.getLifetime() - Called when lifetime is not set"); m_log.error("AuthToken.getLifetime() - Called when lifetime is not set");
throw new Exception("Error: Called getLifetime while not set"); throw new Exception("Error: Called getLifetime while not set");
} }
@ -379,7 +383,8 @@ public final class AuthToken
*/ */
public static String validate(String authTokenString) public static String validate(String authTokenString)
{ {
System.err.println("AuthToken.validate()- Start"); m_log.debug("AuthToken.validate()- Start");
// Instantiate the AuthToken, this validates the token itself. // Instantiate the AuthToken, this validates the token itself.
try try
{ {
@ -387,15 +392,14 @@ public final class AuthToken
// If we are here is because the token validation succeeded, // If we are here is because the token validation succeeded,
// return the identity token string. // return the identity token string.
System.err.println("AuthToken.validate()- Returning identity token"); m_log.debug("AuthToken.validate()- Returning identity token");
return authToken.getIdentityToken(); return authToken.getIdentityToken();
} }
catch (Exception e) catch (Exception e)
{ {
// The validation of one of the tokens failed // The validation of one of the tokens failed
// tbd - Log m_log.warn("AuthToken.validate()- Exception caught during token validation, msg: " + e.getMessage());
System.err.println("AuthToken.validate()- Exception caught during token processing, msg: " + e.getMessage());
return null; return null;
} }

View File

@ -31,6 +31,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.helpers.XMLReaderFactory;
import org.apache.log4j.Logger;
/** /**
* AuthTokenConfig Class. * AuthTokenConfig Class.
@ -40,6 +41,8 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/ */
public final class AuthTokenConfig public final class AuthTokenConfig
{ {
private static final Logger m_log = Logger.getLogger(AuthTokenConfig.class);
// Well known authentication token configuration settings // Well known authentication token configuration settings
public final static String TokenLifetime = "TokenLifetime"; public final static String TokenLifetime = "TokenLifetime";
public final static String LifetimeShorter = "LifetimeShorter"; public final static String LifetimeShorter = "LifetimeShorter";
@ -62,7 +65,7 @@ public final class AuthTokenConfig
*/ */
public AuthTokenConfig() public AuthTokenConfig()
{ {
System.err.println("AuthTokenConfig()- Default"); m_log.debug("AuthTokenConfig()- Default");
// Create a map to keep track of the token settings // Create a map to keep track of the token settings
m_tokenSettingsMap = new HashMap<String, String>(); m_tokenSettingsMap = new HashMap<String, String>();
@ -81,7 +84,7 @@ public final class AuthTokenConfig
*/ */
public AuthTokenConfig(String authTokenSettingsFileName) throws Exception public AuthTokenConfig(String authTokenSettingsFileName) throws Exception
{ {
System.err.println("AuthTokenConfig()-"); m_log.debug("AuthTokenConfig()-");
// Create a map to keep track of the token settings // Create a map to keep track of the token settings
m_tokenSettingsMap = new HashMap<String, String>(); m_tokenSettingsMap = new HashMap<String, String>();
@ -109,7 +112,7 @@ public final class AuthTokenConfig
tokenLifetime = Integer.valueOf(getSetting(TokenLifetime)).intValue(); tokenLifetime = Integer.valueOf(getSetting(TokenLifetime)).intValue();
if (tokenLifetime < m_minimumTokenLifetimeValue) if (tokenLifetime < m_minimumTokenLifetimeValue)
{ {
System.err.println("AuthTokenConfig()- Configured token lifetime too small, defaulting to " m_log.info("AuthTokenConfig()- Configured token lifetime too small, defaulting to "
+ Integer.toString(m_minimumTokenLifetimeValue) + " seconds"); + Integer.toString(m_minimumTokenLifetimeValue) + " seconds");
tokenLifetime = m_minimumTokenLifetimeValue; tokenLifetime = m_minimumTokenLifetimeValue;
@ -119,7 +122,7 @@ public final class AuthTokenConfig
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
System.err.println("AuthTokenConfig()- Invalid configured token lifetime value, defaulting to " m_log.info("AuthTokenConfig()- Invalid configured token lifetime value, defaulting to "
+ Integer.toString(m_minimumTokenLifetimeValue) + " seconds"); + Integer.toString(m_minimumTokenLifetimeValue) + " seconds");
tokenLifetime = m_minimumTokenLifetimeValue; tokenLifetime = m_minimumTokenLifetimeValue;
@ -133,7 +136,7 @@ public final class AuthTokenConfig
lifetimeShorter = Integer.valueOf(getSetting(LifetimeShorter)).intValue(); lifetimeShorter = Integer.valueOf(getSetting(LifetimeShorter)).intValue();
if (lifetimeShorter < m_minimumLifetimeShorterValue) if (lifetimeShorter < m_minimumLifetimeShorterValue)
{ {
System.err.println("AuthTokenConfig()- Configured lifetime shorter too small, defaulting to " m_log.info("AuthTokenConfig()- Configured lifetime shorter too small, defaulting to "
+ Integer.toString(m_minimumLifetimeShorterValue) + " seconds"); + Integer.toString(m_minimumLifetimeShorterValue) + " seconds");
lifetimeShorter = m_minimumLifetimeShorterValue; lifetimeShorter = m_minimumLifetimeShorterValue;
@ -143,7 +146,7 @@ public final class AuthTokenConfig
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
System.err.println("AuthTokenConfig()- Invalid configured lifetime shorter value, defaulting to " m_log.info("AuthTokenConfig()- Invalid configured lifetime shorter value, defaulting to "
+ Integer.toString(m_minimumLifetimeShorterValue) + " seconds"); + Integer.toString(m_minimumLifetimeShorterValue) + " seconds");
lifetimeShorter = m_minimumLifetimeShorterValue; lifetimeShorter = m_minimumLifetimeShorterValue;
@ -154,7 +157,7 @@ public final class AuthTokenConfig
if (lifetimeShorter > tokenLifetime if (lifetimeShorter > tokenLifetime
|| (tokenLifetime - lifetimeShorter) < m_minimumLifetimeShorterDifferential) || (tokenLifetime - lifetimeShorter) < m_minimumLifetimeShorterDifferential)
{ {
System.err.println("AuthTokenConfig()- Invalid lifetime shorter value, defaulting to " m_log.info("AuthTokenConfig()- Invalid lifetime shorter value, defaulting to "
+ Integer.toString(m_minimumLifetimeShorterValue) + " seconds"); + Integer.toString(m_minimumLifetimeShorterValue) + " seconds");
// Update the map with the new value for the setting // Update the map with the new value for the setting
@ -163,22 +166,22 @@ public final class AuthTokenConfig
} }
catch (SAXException e) catch (SAXException e)
{ {
System.err.println("AuthTokenConfig()- " + authTokenSettingsFileName + " format error, exception: " + e.toString()); m_log.warn("AuthTokenConfig()- " + authTokenSettingsFileName + " format error, exception: " + e.toString());
throw new Exception("AuthTokenConfig()- authtoken.settings format error", e); throw new Exception("AuthTokenConfig()- authtoken.settings format error", e);
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("AuthTokenConfig()- SecurityException accessing " + authTokenSettingsFileName + " Exception=" + e.toString()); m_log.warn("AuthTokenConfig()- SecurityException accessing " + authTokenSettingsFileName + " Exception=" + e.toString());
throw new Exception("AuthTokenConfig()- Not able to access file", e); throw new Exception("AuthTokenConfig()- Not able to access file", e);
} }
catch (FileNotFoundException e) catch (FileNotFoundException e)
{ {
System.err.println("AuthTokenConfig()- File " + authTokenSettingsFileName + " not found"); m_log.warn("AuthTokenConfig()- File " + authTokenSettingsFileName + " not found");
throw new Exception("AuthTokenConfig()- File not found", e); throw new Exception("AuthTokenConfig()- File not found", e);
} }
catch (IOException e) catch (IOException e)
{ {
System.err.println("AuthTokenConfig()- IOException accessing " + authTokenSettingsFileName + " Exception=" + e.toString()); m_log.warn("AuthTokenConfig()- IOException accessing " + authTokenSettingsFileName + " Exception=" + e.toString());
throw new Exception("AuthTokenConfig()- Read error", e); throw new Exception("AuthTokenConfig()- Read error", e);
} }
finally finally
@ -209,14 +212,14 @@ public final class AuthTokenConfig
String value = m_tokenSettingsMap.get(settingName); String value = m_tokenSettingsMap.get(settingName);
if (value == null) if (value == null)
{ {
System.err.println("AuthTokenConfig.getSetting()- Did not find setting " + settingName); m_log.info("AuthTokenConfig.getSetting()- Did not find setting " + settingName);
// The setting is not in our map, check if it is one to // The setting is not in our map, check if it is one to
// which we have defaults. // which we have defaults.
if (settingName.equalsIgnoreCase(TokenLifetime)) if (settingName.equalsIgnoreCase(TokenLifetime))
{ {
value = m_defaultTokenLifetimeValue; value = m_defaultTokenLifetimeValue;
System.err.println("AuthTokenConfig.getSetting()- Assigning default value " + value); m_log.info("AuthTokenConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_tokenSettingsMap.put(TokenLifetime, m_defaultTokenLifetimeValue); m_tokenSettingsMap.put(TokenLifetime, m_defaultTokenLifetimeValue);
@ -224,7 +227,7 @@ public final class AuthTokenConfig
else if (settingName.equalsIgnoreCase(LifetimeShorter)) else if (settingName.equalsIgnoreCase(LifetimeShorter))
{ {
value = m_defaultLifetimeShorterValue; value = m_defaultLifetimeShorterValue;
System.err.println("AuthTokenConfig.getSetting()- Assigning default value " + value); m_log.info("AuthTokenConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_tokenSettingsMap.put(LifetimeShorter, m_defaultLifetimeShorterValue); m_tokenSettingsMap.put(LifetimeShorter, m_defaultLifetimeShorterValue);
@ -232,7 +235,7 @@ public final class AuthTokenConfig
else if (settingName.equalsIgnoreCase(IdentityTokenType)) else if (settingName.equalsIgnoreCase(IdentityTokenType))
{ {
value = m_defaultLifetimeShorterValue; value = m_defaultLifetimeShorterValue;
System.err.println("AuthTokenConfig.getSetting()- Assigning default value " + value); m_log.info("AuthTokenConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_tokenSettingsMap.put(IdentityTokenType, m_defaultIdentityTokenTypeValue); m_tokenSettingsMap.put(IdentityTokenType, m_defaultIdentityTokenTypeValue);
@ -240,8 +243,8 @@ public final class AuthTokenConfig
} }
else else
{ {
System.err.println("AuthTokenConfig.getSetting()- Found setting " + settingName); m_log.info("AuthTokenConfig.getSetting()- Found setting " + settingName);
System.err.println("AuthTokenConfig.getSetting()- Setting value = " + value); m_log.info("AuthTokenConfig.getSetting()- Setting value = " + value);
} }
return value; return value;

View File

@ -24,6 +24,8 @@
package com.novell.casa.authtoksvc; package com.novell.casa.authtoksvc;
import org.apache.log4j.Logger;
import java.util.*; import java.util.*;
import java.io.*; import java.io.*;
@ -45,6 +47,8 @@ import java.net.URLClassLoader;
*/ */
public final class Authenticate implements RpcMethod public final class Authenticate implements RpcMethod
{ {
private static final Logger m_log = Logger.getLogger(Authenticate.class);
private static final String m_mechanismSettingsFileName = "mechanism.settings"; private static final String m_mechanismSettingsFileName = "mechanism.settings";
private final Map<String,AuthMechanism> m_authMechanismMap; private final Map<String,AuthMechanism> m_authMechanismMap;
@ -97,7 +101,7 @@ public final class Authenticate implements RpcMethod
{ {
if (mechanismFolder.isDirectory()) if (mechanismFolder.isDirectory())
{ {
System.err.println("Authenticate.init()- Mechanism folder " + mechanismFolder + " is directory"); m_log.debug("Authenticate.init()- Mechanism folder " + mechanismFolder + " is directory");
// Try to obtain the mechanism settings // Try to obtain the mechanism settings
try try
@ -119,7 +123,7 @@ public final class Authenticate implements RpcMethod
// ultimately instantiate objects from a class loaded by the same class loader that // ultimately instantiate objects from a class loaded by the same class loader that
// loads the AuthMechanism class to avoid ClassCastExceptions. // loads the AuthMechanism class to avoid ClassCastExceptions.
File mechClassPathFile = new File(svcConfig.getSetting(SvcConfig.AppRootPath) + relativePath); File mechClassPathFile = new File(svcConfig.getSetting(SvcConfig.AppRootPath) + relativePath);
System.err.println("Authenticate.init()- Mechanism path = " + mechClassPathFile); m_log.debug("Authenticate.init()- Mechanism path = " + mechClassPathFile);
try try
{ {
URL methClassPathUrl = mechClassPathFile.toURL(); URL methClassPathUrl = mechClassPathFile.toURL();
@ -144,19 +148,19 @@ public final class Authenticate implements RpcMethod
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
System.err.println("Authenticate.init()- MalformedURLException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- MalformedURLException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
catch (ClassNotFoundException e) catch (ClassNotFoundException e)
{ {
System.err.println("Authenticate.init()- ClassNotFoundException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- ClassNotFoundException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
catch (InstantiationException e) catch (InstantiationException e)
{ {
System.err.println("Authenticate.init()- InstantiationException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- InstantiationException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
catch (IllegalAccessException e) catch (IllegalAccessException e)
{ {
System.err.println("Authenticate.init()- IllegalAccessException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- IllegalAccessException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
} }
else else
@ -169,7 +173,7 @@ public final class Authenticate implements RpcMethod
// ultimately instantiate objects from a class loaded by the same class loader that // ultimately instantiate objects from a class loaded by the same class loader that
// loads the AuthMechanism class to avoid ClassCastExceptions. // loads the AuthMechanism class to avoid ClassCastExceptions.
File mechClassPathFile = new File(classPath); File mechClassPathFile = new File(classPath);
System.err.println("Authenticate.init()- Mechanism path = " + mechClassPathFile); m_log.debug("Authenticate.init()- Mechanism path = " + mechClassPathFile);
try try
{ {
URL methClassPathUrl = mechClassPathFile.toURL(); URL methClassPathUrl = mechClassPathFile.toURL();
@ -194,53 +198,53 @@ public final class Authenticate implements RpcMethod
} }
catch (MalformedURLException e) catch (MalformedURLException e)
{ {
System.err.println("Authenticate.init()- MalformedURLException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- MalformedURLException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
catch (ClassNotFoundException e) catch (ClassNotFoundException e)
{ {
System.err.println("Authenticate.init()- ClassNotFoundException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- ClassNotFoundException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
catch (InstantiationException e) catch (InstantiationException e)
{ {
System.err.println("Authenticate.init()- InstantiationException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- InstantiationException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
catch (IllegalAccessException e) catch (IllegalAccessException e)
{ {
System.err.println("Authenticate.init()- IllegalAccessException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- IllegalAccessException for " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
} }
else else
{ {
System.err.println("Authenticate.init()- No configuration to find class path to load " + mechanismFolder + File.separator + m_mechanismSettingsFileName); m_log.warn("Authenticate.init()- No configuration to find class path to load " + mechanismFolder + File.separator + m_mechanismSettingsFileName);
} }
} }
} }
else else
{ {
System.err.println("Authenticate.init()- No configured mechanism class name for " + mechanismFolder + File.separator + m_mechanismSettingsFileName); m_log.warn("Authenticate.init()- No configured mechanism class name for " + mechanismFolder + File.separator + m_mechanismSettingsFileName);
} }
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("Authenticate.init()- SecurityException accessing " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- SecurityException accessing " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
catch (FileNotFoundException e) catch (FileNotFoundException e)
{ {
System.err.println("Authenticate.init()- No authentication policy file for " + mechanismFolder); m_log.warn("Authenticate.init()- No authentication policy file for " + mechanismFolder);
} }
catch (IOException e) catch (IOException e)
{ {
System.err.println("Authenticate.init()- IOException reading " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- IOException reading " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("Authenticate.init()- Exception instantiating mechConfig or mechanism " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- Exception instantiating mechConfig or mechanism " + mechanismFolder + File.separator + m_mechanismSettingsFileName + " Exception=" + e.toString());
} }
} }
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("Authenticate.init()- SecurityException accessing " + mechanismFolder + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- SecurityException accessing " + mechanismFolder + " Exception=" + e.toString());
} }
finally finally
{ {
@ -295,12 +299,12 @@ public final class Authenticate implements RpcMethod
} }
else else
{ {
System.err.println("Authenticate.init()- Unable to obtain mechanisms folder " + mechanismsConfigFolder + " objects"); m_log.warn("Authenticate.init()- Unable to obtain mechanisms folder " + mechanismsConfigFolder + " objects");
} }
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("Authenticate.init()- SecurityException accessing " + mechanismsConfigFolder + " Exception=" + e.toString()); m_log.warn("Authenticate.init()- SecurityException accessing " + mechanismsConfigFolder + " Exception=" + e.toString());
} }
} }
@ -316,7 +320,7 @@ public final class Authenticate implements RpcMethod
try try
{ {
System.err.println("Authenticate.invoke()"); m_log.debug("Authenticate.invoke()");
// Parse the AuthReqMsg sent from the client // Parse the AuthReqMsg sent from the client
authReqMsg = new AuthReqMsg(inStream); authReqMsg = new AuthReqMsg(inStream);
@ -331,7 +335,7 @@ public final class Authenticate implements RpcMethod
// Create response based on the identity resolution results // Create response based on the identity resolution results
if (identId != null && identId.length() != 0) if (identId != null && identId.length() != 0)
{ {
System.err.println("Authenticate.invoke()- identId resolved, " + identId); m_log.info("Authenticate.invoke()- identId resolved, " + identId);
// An identity was resolved, get a SessionToken for it. // An identity was resolved, get a SessionToken for it.
SessionToken sessionToken = new SessionToken(identId, SessionToken sessionToken = new SessionToken(identId,
@ -350,7 +354,7 @@ public final class Authenticate implements RpcMethod
} }
else else
{ {
System.err.println("Authenticate.invoke()- identId not resolved"); m_log.info("Authenticate.invoke()- identId not resolved");
// Write out the response // Write out the response
AuthRespMsg authRespMsg = new AuthRespMsg(ProtoDefs.httpUnauthorizedStatusMsg, AuthRespMsg authRespMsg = new AuthRespMsg(ProtoDefs.httpUnauthorizedStatusMsg,
@ -360,7 +364,7 @@ public final class Authenticate implements RpcMethod
} }
else else
{ {
System.err.println("Authenticate.invoke()- Unsupported mechanism " + authReqMsg.getMechanismId()); m_log.warn("Authenticate.invoke()- Unsupported mechanism " + authReqMsg.getMechanismId());
// Write out the response // Write out the response
AuthRespMsg authRespMsg = new AuthRespMsg(ProtoDefs.httpNotFoundStatusMsg, AuthRespMsg authRespMsg = new AuthRespMsg(ProtoDefs.httpNotFoundStatusMsg,
@ -370,7 +374,7 @@ public final class Authenticate implements RpcMethod
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("Authenticate.invoke()- Exception: " + e.toString()); m_log.error("Authenticate.invoke()- Exception: " + e.toString());
// Write out the response // Write out the response
try try
@ -381,7 +385,7 @@ public final class Authenticate implements RpcMethod
} }
catch (Exception e2) catch (Exception e2)
{ {
System.err.println("Authenticate.invoke()- Exception trying to construct response msg: " + e2.toString()); m_log.error("Authenticate.invoke()- Exception trying to construct response msg: " + e2.toString());
} }
} }
finally finally

View File

@ -43,6 +43,7 @@ import org.xml.sax.helpers.XMLReaderFactory;
import org.bandit.ia.IAContext; import org.bandit.ia.IAContext;
import org.bandit.util.config.Realm; import org.bandit.util.config.Realm;
import org.apache.log4j.Logger;
/** /**
* CasaIdentityToken Class. * CasaIdentityToken Class.
@ -73,6 +74,8 @@ import org.bandit.util.config.Realm;
*/ */
public final class CasaIdentityToken implements IdentityToken public final class CasaIdentityToken implements IdentityToken
{ {
private static final Logger m_log = Logger.getLogger(CasaIdentityToken.class);
/* /*
* XML Element Name Constants for the documents exchanged between the * XML Element Name Constants for the documents exchanged between the
* Casa Client and the Casa Server. * Casa Client and the Casa Server.
@ -154,7 +157,7 @@ public final class CasaIdentityToken implements IdentityToken
// Verify that we obtained all of the required elements // Verify that we obtained all of the required elements
if (m_state != DONE_PARSING) if (m_state != DONE_PARSING)
{ {
System.err.println("CasaIdentityToken SAXHandler.endDocument()- Missing element"); m_log.error("CasaIdentityToken SAXHandler.endDocument()- Missing element");
throw new SAXException("Missing element"); throw new SAXException("Missing element");
} }
} }
@ -183,7 +186,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.startElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -197,7 +200,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.startElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -211,7 +214,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.startElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
@ -226,7 +229,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.startElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -240,7 +243,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.startElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -254,7 +257,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.startElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -268,7 +271,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.startElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -293,7 +296,7 @@ public final class CasaIdentityToken implements IdentityToken
break; break;
default: default:
System.err.println("CasaIdentityToken SAXHandler.startElement()- State error"); m_log.error("CasaIdentityToken SAXHandler.startElement()- State error");
throw new SAXException("State error"); throw new SAXException("State error");
} }
} }
@ -321,7 +324,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -335,7 +338,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -349,7 +352,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -363,7 +366,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -377,7 +380,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -391,7 +394,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -415,19 +418,19 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Attribute data not found"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Attribute data not found");
throw new SAXException("Attribute data not found"); throw new SAXException("Attribute data not found");
} }
} }
catch (NamingException e) catch (NamingException e)
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Attribute data not found"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Attribute data not found");
throw new SAXException("Attribute data not found", e); throw new SAXException("Attribute data not found", e);
} }
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Attribute not found"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Attribute not found");
throw new SAXException("Attribute not found"); throw new SAXException("Attribute not found");
} }
@ -444,13 +447,13 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.endElement()- Un-expected element"); m_log.error("CasaIdentityToken SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
default: default:
System.err.println("CasaIdentityToken SAXHandler.endElement()- State error"); m_log.error("CasaIdentityToken SAXHandler.endElement()- State error");
throw new SAXException("State error"); throw new SAXException("State error");
} }
} }
@ -560,19 +563,19 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.characters()- Attribute data not found"); m_log.error("CasaIdentityToken SAXHandler.characters()- Attribute data not found");
throw new SAXException("Attribute data not found"); throw new SAXException("Attribute data not found");
} }
} }
catch (NamingException e) catch (NamingException e)
{ {
System.err.println("CasaIdentityToken SAXHandler.characters()- Attribute data not found"); m_log.error("CasaIdentityToken SAXHandler.characters()- Attribute data not found");
throw new SAXException("Attribute data not found", e); throw new SAXException("Attribute data not found", e);
} }
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.characters()- Attribute not found"); m_log.error("CasaIdentityToken SAXHandler.characters()- Attribute not found");
throw new SAXException("Attribute not found"); throw new SAXException("Attribute not found");
} }
} }
@ -627,19 +630,19 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.characters()- Attribute data not found"); m_log.error("CasaIdentityToken SAXHandler.characters()- Attribute data not found");
throw new SAXException("Attribute data not found"); throw new SAXException("Attribute data not found");
} }
} }
catch (NamingException e) catch (NamingException e)
{ {
System.err.println("CasaIdentityToken SAXHandler.characters()- Attribute data not found"); m_log.error("CasaIdentityToken SAXHandler.characters()- Attribute data not found");
throw new SAXException("Attribute data not found", e); throw new SAXException("Attribute data not found", e);
} }
} }
else else
{ {
System.err.println("CasaIdentityToken SAXHandler.characters()- Attribute not found"); m_log.error("CasaIdentityToken SAXHandler.characters()- Attribute not found");
throw new SAXException("Attribute not found"); throw new SAXException("Attribute not found");
} }
} }
@ -741,7 +744,7 @@ public final class CasaIdentityToken implements IdentityToken
{ {
Object attrValue = enumeration.next(); Object attrValue = enumeration.next();
m_attributes.put(attr.getID(), attrValue); m_attributes.put(attr.getID(), attrValue);
System.err.println("CasaIdentityToken.initialize()- Including attribute " + attr.getID()); m_log.debug("CasaIdentityToken.initialize()- Including attribute " + attr.getID());
// Encrypt the attribute if necessary // Encrypt the attribute if necessary
if (encryptAttributes) if (encryptAttributes)
@ -757,7 +760,7 @@ public final class CasaIdentityToken implements IdentityToken
{ {
// The attribute value is of type byte[], we need to encode it. // The attribute value is of type byte[], we need to encode it.
sb.append("<"); sb.append(attr.getID()); sb.append(" type=\"binary\" encoding=\"base64\">"); sb.append(new String(Base64Coder.encode((byte[]) attrValue))); sb.append("</"); sb.append(attr.getID()); sb.append(">\r\n"); sb.append("<"); sb.append(attr.getID()); sb.append(" type=\"binary\" encoding=\"base64\">"); sb.append(new String(Base64Coder.encode((byte[]) attrValue))); sb.append("</"); sb.append(attr.getID()); sb.append(">\r\n");
System.err.println("Attribute " + attr.getID() + "included as " + new String(Base64Coder.encode((byte[]) attrValue))); m_log.debug("Attribute " + attr.getID() + "included as " + new String(Base64Coder.encode((byte[]) attrValue)));
} }
else else
{ {
@ -774,12 +777,12 @@ public final class CasaIdentityToken implements IdentityToken
} }
catch (NamingException e) catch (NamingException e)
{ {
System.err.println("CasaIdentityToken.initialize()- Exception: " + e.getExplanation()); m_log.error("CasaIdentityToken.initialize()- Exception: " + e.getExplanation());
throw new Exception("Error obtaining identity data for token", e); throw new Exception("Error obtaining identity data for token", e);
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("CasaIdentityToken.initialize()- Exception: " + e.toString()); m_log.error("CasaIdentityToken.initialize()- Exception: " + e.toString());
throw new Exception("Error obtaining identity data for token", e); throw new Exception("Error obtaining identity data for token", e);
} }
} }
@ -811,8 +814,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
catch (SAXException e) catch (SAXException e)
{ {
// tbd - Log this. m_log.error("CasaIdentityToken()- Parse exception: " + e.toString());
System.err.println("CasaIdentityToken()- Parse exception: " + e.toString());
throw new Exception("Token error", e); throw new Exception("Token error", e);
} }
finally finally
@ -848,7 +850,7 @@ public final class CasaIdentityToken implements IdentityToken
} }
else else
{ {
System.err.println("CasaIdentityToken.toString()- Not initialized"); m_log.error("CasaIdentityToken.toString()- Not initialized");
throw new Exception("Not initialized"); throw new Exception("Not initialized");
} }
} }
@ -876,7 +878,7 @@ public final class CasaIdentityToken implements IdentityToken
return m_identityId; return m_identityId;
else else
{ {
System.err.println("CasaIdentityToken.getIdentityId()- Not initialized"); m_log.error("CasaIdentityToken.getIdentityId()- Not initialized");
throw new Exception("Not initialized"); throw new Exception("Not initialized");
} }
} }
@ -894,7 +896,7 @@ public final class CasaIdentityToken implements IdentityToken
return m_sourceName; return m_sourceName;
else else
{ {
System.err.println("CasaIdentityToken.getSourceName()- Not initialized"); m_log.error("CasaIdentityToken.getSourceName()- Not initialized");
throw new Exception("Not initialized"); throw new Exception("Not initialized");
} }
} }
@ -912,7 +914,7 @@ public final class CasaIdentityToken implements IdentityToken
return m_sourceUrl; return m_sourceUrl;
else else
{ {
System.err.println("CasaIdentityToken.getSourceUrl()- Not initialized"); m_log.error("CasaIdentityToken.getSourceUrl()- Not initialized");
throw new Exception("Not initialized"); throw new Exception("Not initialized");
} }
} }
@ -929,7 +931,7 @@ public final class CasaIdentityToken implements IdentityToken
return m_service; return m_service;
else else
{ {
System.err.println("CasaIdentityToken.getTargetService()- Not initialized"); m_log.error("CasaIdentityToken.getTargetService()- Not initialized");
throw new Exception("Not initialized"); throw new Exception("Not initialized");
} }
} }
@ -947,7 +949,7 @@ public final class CasaIdentityToken implements IdentityToken
return m_host; return m_host;
else else
{ {
System.err.println("CasaIdentityToken.getTargetHost()- Not initialized"); m_log.error("CasaIdentityToken.getTargetHost()- Not initialized");
throw new Exception("Not initialized"); throw new Exception("Not initialized");
} }
} }
@ -964,7 +966,7 @@ public final class CasaIdentityToken implements IdentityToken
return m_attributes; return m_attributes;
else else
{ {
System.err.println("CasaIdentityToken.getIdentityAttributes()- Not initialized"); m_log.error("CasaIdentityToken.getIdentityAttributes()- Not initialized");
throw new Exception("Not initialized"); throw new Exception("Not initialized");
} }
} }

View File

@ -24,6 +24,8 @@
package com.novell.casa.authtoksvc; package com.novell.casa.authtoksvc;
import org.apache.log4j.Logger;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
@ -36,6 +38,8 @@ import java.util.*;
*/ */
public final class EnabledSvcsConfig public final class EnabledSvcsConfig
{ {
private static final Logger m_log = Logger.getLogger(EnabledSvcsConfig.class);
private static final String m_authPolicyFileName = "auth.policy"; private static final String m_authPolicyFileName = "auth.policy";
private static final String m_authTokenSettingsFileName = "authtoken.settings"; private static final String m_authTokenSettingsFileName = "authtoken.settings";
private static final String m_idenTokenSettingsFileName = "identoken.settings"; private static final String m_idenTokenSettingsFileName = "identoken.settings";
@ -91,8 +95,8 @@ public final class EnabledSvcsConfig
public EnabledSvcsConfig(String svcConfigPath, public EnabledSvcsConfig(String svcConfigPath,
boolean enabledSvcsOnly) throws Exception boolean enabledSvcsOnly) throws Exception
{ {
System.err.println("EnabledSvcsConfig()-"); m_log.debug("EnabledSvcsConfig()-");
System.err.println("EnabledSvcsConfig()- SvcConfigPath = " + svcConfigPath); m_log.info("EnabledSvcsConfig()- SvcConfigPath = " + svcConfigPath);
// Remember the enabledSvcsOnly setting // Remember the enabledSvcsOnly setting
m_enabledSvcsOnly = enabledSvcsOnly; m_enabledSvcsOnly = enabledSvcsOnly;
@ -115,20 +119,20 @@ public final class EnabledSvcsConfig
int bytesRead = inStream.read(m_defaultAuthPolicyData); int bytesRead = inStream.read(m_defaultAuthPolicyData);
if (bytesRead != m_defaultAuthPolicyData.length) if (bytesRead != m_defaultAuthPolicyData.length)
{ {
System.err.println("EnabledSvcsConfig()- Error reading default policy file"); m_log.warn("EnabledSvcsConfig()- Error reading default policy file");
} }
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("EnabledSvcsConfig()- SecurityException accessing " + configFolder + File.separator + m_authPolicyFileName + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- SecurityException accessing " + configFolder + File.separator + m_authPolicyFileName + " Exception=" + e.toString());
} }
catch (FileNotFoundException e) catch (FileNotFoundException e)
{ {
System.err.println("EnabledSvcsConfig()- File " + configFolder + File.separator + m_authPolicyFileName + " not found"); m_log.warn("EnabledSvcsConfig()- File " + configFolder + File.separator + m_authPolicyFileName + " not found");
} }
catch (IOException e) catch (IOException e)
{ {
System.err.println("EnabledSvcsConfig()- IOException reading " + configFolder + File.separator + m_authPolicyFileName + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- IOException reading " + configFolder + File.separator + m_authPolicyFileName + " Exception=" + e.toString());
} }
finally finally
{ {
@ -187,7 +191,7 @@ public final class EnabledSvcsConfig
{ {
if (hostFolder.isDirectory()) if (hostFolder.isDirectory())
{ {
System.err.println("EnabledSvcsConfig()- Host folder " + hostFolder + " is directory"); m_log.debug("EnabledSvcsConfig()- Host folder " + hostFolder + " is directory");
// Now go through the services configured for this host // Now go through the services configured for this host
String[] hostFolderObjs = hostFolder.list(); String[] hostFolderObjs = hostFolder.list();
@ -200,12 +204,12 @@ public final class EnabledSvcsConfig
{ {
// Check if we are dealing with a file or a folder // Check if we are dealing with a file or a folder
File serviceFolder = new File(hostFolder, hostFolderObjs[ii]); File serviceFolder = new File(hostFolder, hostFolderObjs[ii]);
System.err.println("EnabledSvcsConfig()- Service folder " + serviceFolder); m_log.info("EnabledSvcsConfig()- Service folder " + serviceFolder);
try try
{ {
if (serviceFolder.isDirectory()) if (serviceFolder.isDirectory())
{ {
System.err.println("EnabledSvcsConfig()- Service folder " + serviceFolder + " is directory"); m_log.debug("EnabledSvcsConfig()- Service folder " + serviceFolder + " is directory");
// We are dealing with a folder, remember that the folder name matches the name // We are dealing with a folder, remember that the folder name matches the name
// of the enabled service. Check and see if there are authentication policy and // of the enabled service. Check and see if there are authentication policy and
@ -223,20 +227,20 @@ public final class EnabledSvcsConfig
int bytesRead = inStream.read(authPolicyData); int bytesRead = inStream.read(authPolicyData);
if (bytesRead != authPolicyData.length) if (bytesRead != authPolicyData.length)
{ {
System.err.println("EnabledSvcsConfig()- Error reading policy file for " + servicesConfigFolderObjs[i] + " " + hostFolderObjs[ii]); m_log.warn("EnabledSvcsConfig()- Error reading policy file for " + servicesConfigFolderObjs[i] + " " + hostFolderObjs[ii]);
} }
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("EnabledSvcsConfig()- SecurityException accessing " + serviceFolder + File.separator + m_authPolicyFileName + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- SecurityException accessing " + serviceFolder + File.separator + m_authPolicyFileName + " Exception=" + e.toString());
} }
catch (FileNotFoundException e) catch (FileNotFoundException e)
{ {
System.err.println("EnabledSvcsConfig()- No authentication policy file for " + serviceFolder); m_log.warn("EnabledSvcsConfig()- No authentication policy file for " + serviceFolder);
} }
catch (IOException e) catch (IOException e)
{ {
System.err.println("EnabledSvcsConfig()- IOException reading " + serviceFolder + File.separator + m_authPolicyFileName + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- IOException reading " + serviceFolder + File.separator + m_authPolicyFileName + " Exception=" + e.toString());
} }
finally finally
{ {
@ -259,7 +263,7 @@ public final class EnabledSvcsConfig
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("EnabledSvcsConfig()- Exception accessing " + serviceFolder + File.separator + m_authTokenSettingsFileName + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- Exception accessing " + serviceFolder + File.separator + m_authTokenSettingsFileName + " Exception=" + e.toString());
} }
try try
@ -268,7 +272,7 @@ public final class EnabledSvcsConfig
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("EnabledSvcsConfig()- Exception accessing " + serviceFolder + File.separator + m_idenTokenSettingsFileName + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- Exception accessing " + serviceFolder + File.separator + m_idenTokenSettingsFileName + " Exception=" + e.toString());
} }
// Make sure that we have a policy file // Make sure that we have a policy file
@ -281,18 +285,18 @@ public final class EnabledSvcsConfig
(idenTokenConfig != null) ? idenTokenConfig : m_defaultIdenTokenConfig); (idenTokenConfig != null) ? idenTokenConfig : m_defaultIdenTokenConfig);
// Add this entry to our map // Add this entry to our map
System.err.println("EnabledSvcsConfig()- Adding entry in map for " + servicesConfigFolderObjs[i] + " " + hostFolderObjs[ii]); m_log.info("EnabledSvcsConfig()- Adding entry in map for " + servicesConfigFolderObjs[i] + " " + hostFolderObjs[ii]);
enabledSvcsConfigMap.put(hostFolderObjs[ii], svcConfigEntry); enabledSvcsConfigMap.put(hostFolderObjs[ii], svcConfigEntry);
} }
else else
{ {
System.err.println("EnabledSvcsConfig()- Unable to enable " + servicesConfigFolderObjs[i] + " " + hostFolderObjs[ii] + " due to no configured authentication policy"); m_log.warn("EnabledSvcsConfig()- Unable to enable " + servicesConfigFolderObjs[i] + " " + hostFolderObjs[ii] + " due to no configured authentication policy");
} }
} }
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("EnabledSvcsConfig()- SecurityException accessing " + serviceFolder + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- SecurityException accessing " + serviceFolder + " Exception=" + e.toString());
} }
// Add this hosts enabled services configuration map to the hosts map // Add this hosts enabled services configuration map to the hosts map
@ -301,29 +305,29 @@ public final class EnabledSvcsConfig
} }
else else
{ {
System.err.println("EnabledSvcsConfig()- No services configured for " + hostFolder); m_log.info("EnabledSvcsConfig()- No services configured for " + hostFolder);
} }
} }
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("EnabledSvcsConfig()- SecurityException accessing " + hostFolder + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- SecurityException accessing " + hostFolder + " Exception=" + e.toString());
} }
} }
} }
else else
{ {
System.err.println("EnabledSvcsConfig()- Unable to obtain services folder " + servicesConfigFolder + " objects"); m_log.warn("EnabledSvcsConfig()- Unable to obtain services folder " + servicesConfigFolder + " objects");
} }
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("EnabledSvcsConfig()- SecurityException accessing " + servicesConfigFolder + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- SecurityException accessing " + servicesConfigFolder + " Exception=" + e.toString());
} }
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("EnabledSvcsConfig()- SecurityException accessing " + configFolder + " Exception=" + e.toString()); m_log.warn("EnabledSvcsConfig()- SecurityException accessing " + configFolder + " Exception=" + e.toString());
} }
} }

View File

@ -24,6 +24,8 @@
package com.novell.casa.authtoksvc; package com.novell.casa.authtoksvc;
import org.apache.log4j.Logger;
import java.io.*; import java.io.*;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -36,6 +38,8 @@ import java.io.PrintWriter;
*/ */
public final class GetAuthPolicy implements RpcMethod public final class GetAuthPolicy implements RpcMethod
{ {
private static final Logger m_log = Logger.getLogger(GetAuthPolicy.class);
private SvcConfig m_svcConfig; private SvcConfig m_svcConfig;
private EnabledSvcsConfig m_enabledSvcsConfig; private EnabledSvcsConfig m_enabledSvcsConfig;
@ -71,7 +75,7 @@ public final class GetAuthPolicy implements RpcMethod
{ {
try try
{ {
System.err.println("GetAuthPolicy.invoke()"); m_log.debug("GetAuthPolicy.invoke()");
// Read and parse the GetAuthPolicyReqMsg sent from the client // Read and parse the GetAuthPolicyReqMsg sent from the client
GetAuthPolicyReqMsg getAuthPolicyReqMsg = new GetAuthPolicyReqMsg(inStream); GetAuthPolicyReqMsg getAuthPolicyReqMsg = new GetAuthPolicyReqMsg(inStream);
@ -92,7 +96,7 @@ public final class GetAuthPolicy implements RpcMethod
} }
else else
{ {
System.err.println("GetAuthPolicy.invoke()- authPolicy is null for enabled service: " + getAuthPolicyReqMsg.getServiceName()); m_log.debug("GetAuthPolicy.invoke()- authPolicy is null for enabled service: " + getAuthPolicyReqMsg.getServiceName());
GetAuthPolicyRespMsg getAuthPolicyRespMsg = new GetAuthPolicyRespMsg(ProtoDefs.httpServerErrorStatusMsg, GetAuthPolicyRespMsg getAuthPolicyRespMsg = new GetAuthPolicyRespMsg(ProtoDefs.httpServerErrorStatusMsg,
ProtoDefs.httpServerErrorStatusCode); ProtoDefs.httpServerErrorStatusCode);
out.println(getAuthPolicyRespMsg.toString()); out.println(getAuthPolicyRespMsg.toString());
@ -105,7 +109,7 @@ public final class GetAuthPolicy implements RpcMethod
ProtoDefs.httpNotFoundStatusCode); ProtoDefs.httpNotFoundStatusCode);
out.println(getAuthPolicyRespMsg.toString()); out.println(getAuthPolicyRespMsg.toString());
System.err.println("GetAuthPolicy.invoke()- Service " m_log.warn("GetAuthPolicy.invoke()- Service "
+ getAuthPolicyReqMsg.getServiceName() + getAuthPolicyReqMsg.getServiceName()
+ " at " + getAuthPolicyReqMsg.getHostName() + " at " + getAuthPolicyReqMsg.getHostName()
+ " not enabled"); + " not enabled");
@ -113,7 +117,7 @@ public final class GetAuthPolicy implements RpcMethod
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("GetAuthPolicy.invoke()- Exception: " + e.toString()); m_log.error("GetAuthPolicy.invoke()- Exception: " + e.toString());
// Write out the response // Write out the response
try try
@ -124,7 +128,7 @@ public final class GetAuthPolicy implements RpcMethod
} }
catch (Exception e2) catch (Exception e2)
{ {
System.err.println("GetAuthPolicy.invoke()- Exception trying to construct response msg: " + e2.toString()); m_log.error("GetAuthPolicy.invoke()- Exception trying to construct response msg: " + e2.toString());
} }
} }
} }

View File

@ -30,6 +30,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.helpers.XMLReaderFactory;
import org.apache.log4j.Logger;
/** /**
* GetAuthPolicyReqMsg Class. * GetAuthPolicyReqMsg Class.
@ -47,6 +48,7 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/ */
public final class GetAuthPolicyReqMsg public final class GetAuthPolicyReqMsg
{ {
private static final Logger m_log = Logger.getLogger(GetAuthPolicyReqMsg.class);
protected String m_serviceName = null; protected String m_serviceName = null;
protected String m_hostName = null; protected String m_hostName = null;
@ -93,7 +95,7 @@ public final class GetAuthPolicyReqMsg
// Verify that we obtained all of the required elements // Verify that we obtained all of the required elements
if (m_state != DONE_PARSING) if (m_state != DONE_PARSING)
{ {
System.err.println("GetAuthPolicyReqMsg SAXHandler.endDocument()- Missing element"); m_log.error("GetAuthPolicyReqMsg SAXHandler.endDocument()- Missing element");
throw new SAXException("Missing element"); throw new SAXException("Missing element");
} }
} }
@ -121,7 +123,7 @@ public final class GetAuthPolicyReqMsg
} }
else else
{ {
System.err.println("GetAuthPolicyReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("GetAuthPolicyReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -135,7 +137,7 @@ public final class GetAuthPolicyReqMsg
} }
else else
{ {
System.err.println("GetAuthPolicyReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("GetAuthPolicyReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -149,14 +151,14 @@ public final class GetAuthPolicyReqMsg
} }
else else
{ {
System.err.println("GetAuthPolicyReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("GetAuthPolicyReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
default: default:
System.err.println("GetAuthPolicyReqMsg SAXHandler.startElement()- State error"); m_log.error("GetAuthPolicyReqMsg SAXHandler.startElement()- State error");
throw new SAXException("State error"); throw new SAXException("State error");
} }
} }
@ -183,7 +185,7 @@ public final class GetAuthPolicyReqMsg
} }
else else
{ {
System.err.println("GetAuthPolicyReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("GetAuthPolicyReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -197,7 +199,7 @@ public final class GetAuthPolicyReqMsg
} }
else else
{ {
System.err.println("GetAuthPolicyReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("GetAuthPolicyReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -211,13 +213,13 @@ public final class GetAuthPolicyReqMsg
} }
else else
{ {
System.err.println("GetAuthPolicyReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("GetAuthPolicyReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
default: default:
System.err.println("GetAuthPolicyReqMsg SAXHandler.endElement()- State error"); m_log.error("GetAuthPolicyReqMsg SAXHandler.endElement()- State error");
throw new SAXException("State error"); throw new SAXException("State error");
} }
} }
@ -289,7 +291,7 @@ public final class GetAuthPolicyReqMsg
} }
catch (SAXException e) catch (SAXException e)
{ {
System.err.println("GetAuthPolicyReqMsg()- Parse exception: " + e.toString()); m_log.error("GetAuthPolicyReqMsg()- Parse exception: " + e.toString());
throw new Exception("Protocol error", e); throw new Exception("Protocol error", e);
} }
} }

View File

@ -24,6 +24,8 @@
package com.novell.casa.authtoksvc; package com.novell.casa.authtoksvc;
import org.apache.log4j.Logger;
/** /**
* GetAuthPolicyRespMsg Class. * GetAuthPolicyRespMsg Class.
* <p> * <p>
@ -52,6 +54,7 @@ package com.novell.casa.authtoksvc;
*/ */
public final class GetAuthPolicyRespMsg public final class GetAuthPolicyRespMsg
{ {
private static final Logger m_log = Logger.getLogger(GetAuthPolicyRespMsg.class);
final String m_msg; final String m_msg;

View File

@ -30,6 +30,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.helpers.XMLReaderFactory;
import org.apache.log4j.Logger;
/** /**
* GetAuthTokReqMsg Class. * GetAuthTokReqMsg Class.
@ -48,6 +49,7 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/ */
public final class GetAuthTokReqMsg public final class GetAuthTokReqMsg
{ {
private static final Logger m_log = Logger.getLogger(GetAuthTokReqMsg.class);
protected String m_serviceName = null; protected String m_serviceName = null;
protected String m_hostName = null; protected String m_hostName = null;
@ -98,7 +100,7 @@ public final class GetAuthTokReqMsg
// Verify that we obtained all of the required elements // Verify that we obtained all of the required elements
if (m_state != DONE_PARSING) if (m_state != DONE_PARSING)
{ {
System.err.println("GetAuthTokReqMsg SAXHandler.endDocument()- Missing element"); m_log.error("GetAuthTokReqMsg SAXHandler.endDocument()- Missing element");
throw new SAXException("Missing element"); throw new SAXException("Missing element");
} }
} }
@ -126,7 +128,7 @@ public final class GetAuthTokReqMsg
} }
else else
{ {
System.err.println("GetAuthTokReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("GetAuthTokReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -140,7 +142,7 @@ public final class GetAuthTokReqMsg
} }
else else
{ {
System.err.println("GetAuthTokReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("GetAuthTokReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -154,7 +156,7 @@ public final class GetAuthTokReqMsg
} }
else else
{ {
System.err.println("GetAuthTokReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("GetAuthTokReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
@ -169,13 +171,13 @@ public final class GetAuthTokReqMsg
} }
else else
{ {
System.err.println("GetAuthTokReqMsg SAXHandler.startElement()- Un-expected element"); m_log.error("GetAuthTokReqMsg SAXHandler.startElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
default: default:
System.err.println("GetAuthTokReqMsg SAXHandler.startElement()- State error"); m_log.error("GetAuthTokReqMsg SAXHandler.startElement()- State error");
throw new SAXException("State error"); throw new SAXException("State error");
} }
} }
@ -202,7 +204,7 @@ public final class GetAuthTokReqMsg
} }
else else
{ {
System.err.println("GetAuthTokReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("GetAuthTokReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -216,7 +218,7 @@ public final class GetAuthTokReqMsg
} }
else else
{ {
System.err.println("GetAuthTokReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("GetAuthTokReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -230,7 +232,7 @@ public final class GetAuthTokReqMsg
} }
else else
{ {
System.err.println("GetAuthTokReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("GetAuthTokReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
@ -244,13 +246,13 @@ public final class GetAuthTokReqMsg
} }
else else
{ {
System.err.println("GetAuthTokReqMsg SAXHandler.endElement()- Un-expected element"); m_log.error("GetAuthTokReqMsg SAXHandler.endElement()- Un-expected element");
throw new SAXException("Un-expected element"); throw new SAXException("Un-expected element");
} }
break; break;
default: default:
System.err.println("GetAuthTokReqMsg SAXHandler.endElement()- State error"); m_log.error("GetAuthTokReqMsg SAXHandler.endElement()- State error");
throw new SAXException("State error"); throw new SAXException("State error");
} }
} }
@ -335,7 +337,7 @@ public final class GetAuthTokReqMsg
} }
catch (SAXException e) catch (SAXException e)
{ {
System.err.println("GetAuthTokReqMsg()- Parse exception: " + e.toString()); m_log.error("GetAuthTokReqMsg()- Parse exception: " + e.toString());
throw new Exception("Protocol error", e); throw new Exception("Protocol error", e);
} }
} }

View File

@ -24,6 +24,8 @@
package com.novell.casa.authtoksvc; package com.novell.casa.authtoksvc;
import org.apache.log4j.Logger;
/** /**
* GetAuthTokRespMsg Class. * GetAuthTokRespMsg Class.
* <p> * <p>
@ -52,6 +54,7 @@ package com.novell.casa.authtoksvc;
*/ */
public final class GetAuthTokRespMsg public final class GetAuthTokRespMsg
{ {
private static final Logger m_log = Logger.getLogger(GetAuthTokRespMsg.class);
final String m_msg; final String m_msg;

View File

@ -24,6 +24,8 @@
package com.novell.casa.authtoksvc; package com.novell.casa.authtoksvc;
import org.apache.log4j.Logger;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -37,6 +39,8 @@ import java.io.PrintWriter;
*/ */
public final class GetAuthToken implements RpcMethod public final class GetAuthToken implements RpcMethod
{ {
private static final Logger m_log = Logger.getLogger(GetAuthToken.class);
private SvcConfig m_svcConfig; private SvcConfig m_svcConfig;
private EnabledSvcsConfig m_enabledSvcsConfig; private EnabledSvcsConfig m_enabledSvcsConfig;
@ -72,7 +76,7 @@ public final class GetAuthToken implements RpcMethod
{ {
try try
{ {
System.err.println("GetAuthToken.invoke()"); m_log.debug("GetAuthToken.invoke()");
// Parse the GetAuthTokReqMsg sent from the client // Parse the GetAuthTokReqMsg sent from the client
GetAuthTokReqMsg getAuthTokReqMsg = new GetAuthTokReqMsg(inStream); GetAuthTokReqMsg getAuthTokReqMsg = new GetAuthTokReqMsg(inStream);
@ -104,7 +108,7 @@ public final class GetAuthToken implements RpcMethod
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("GetAuthToken.invoke()- Exception: " + e.toString()); m_log.info("GetAuthToken.invoke()- Exception: " + e.toString());
// Write out the response // Write out the response
try try
@ -115,7 +119,7 @@ public final class GetAuthToken implements RpcMethod
} }
catch (Exception e2) catch (Exception e2)
{ {
System.err.println("GetAuthToken.invoke()- Exception trying to construct response msg: " + e2.toString()); m_log.error("GetAuthToken.invoke()- Exception trying to construct response msg: " + e2.toString());
} }
} }
} }
@ -129,7 +133,7 @@ public final class GetAuthToken implements RpcMethod
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("GetAuthToken.invoke()- Exception: " + e.toString()); m_log.error("GetAuthToken.invoke()- Exception: " + e.toString());
// Write out the response // Write out the response
try try
@ -140,7 +144,7 @@ public final class GetAuthToken implements RpcMethod
} }
catch (Exception e2) catch (Exception e2)
{ {
System.err.println("GetAuthToken.invoke()- Exception trying to construct response msg: " + e2.toString()); m_log.error("GetAuthToken.invoke()- Exception trying to construct response msg: " + e2.toString());
} }
} }
} }

View File

@ -31,6 +31,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.helpers.XMLReaderFactory;
import org.apache.log4j.Logger;
/** /**
* IdenTokenConfig Class. * IdenTokenConfig Class.
@ -40,6 +41,8 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/ */
public final class IdenTokenConfig public final class IdenTokenConfig
{ {
private static final Logger m_log = Logger.getLogger(IdenTokenConfig.class);
// Well known identity token configuration settings // Well known identity token configuration settings
public final static String EncryptAttributes = "EncryptAttributes"; public final static String EncryptAttributes = "EncryptAttributes";
public final static String Attributes = "Attributes"; public final static String Attributes = "Attributes";
@ -56,7 +59,7 @@ public final class IdenTokenConfig
*/ */
public IdenTokenConfig() public IdenTokenConfig()
{ {
System.err.println("IdenTokenConfig()- Default"); m_log.debug("IdenTokenConfig()- Default");
// Create a map to keep track of the token settings // Create a map to keep track of the token settings
m_tokenSettingsMap = new HashMap<String, String>(); m_tokenSettingsMap = new HashMap<String, String>();
@ -73,7 +76,7 @@ public final class IdenTokenConfig
*/ */
public IdenTokenConfig(String idenTokenSettingsFileName) throws Exception public IdenTokenConfig(String idenTokenSettingsFileName) throws Exception
{ {
System.err.println("IdenTokenConfig()-"); m_log.debug("IdenTokenConfig()-");
// Create a map to keep track of the token settings // Create a map to keep track of the token settings
m_tokenSettingsMap = new HashMap<String, String>(); m_tokenSettingsMap = new HashMap<String, String>();
@ -97,7 +100,7 @@ public final class IdenTokenConfig
// Process the specified attributes // Process the specified attributes
if (m_tokenSettingsMap.containsKey(Attributes) == false) if (m_tokenSettingsMap.containsKey(Attributes) == false)
{ {
System.err.println("IdenTokenConfig()- Attributes not configured, defaulting them."); m_log.info("IdenTokenConfig()- Attributes not configured, defaulting them.");
m_tokenSettingsMap.put(Attributes, m_defaultAttributesValue); m_tokenSettingsMap.put(Attributes, m_defaultAttributesValue);
} }
String attributes = m_tokenSettingsMap.get(Attributes); String attributes = m_tokenSettingsMap.get(Attributes);
@ -105,22 +108,22 @@ public final class IdenTokenConfig
} }
catch (SAXException e) catch (SAXException e)
{ {
System.err.println("IdenTokenConfig()- " + idenTokenSettingsFileName + " format error, exception: " + e.toString()); m_log.warn("IdenTokenConfig()- " + idenTokenSettingsFileName + " format error, exception: " + e.toString());
throw new Exception("IdenTokenConfig()- authtoken.settings format error", e); throw new Exception("IdenTokenConfig()- authtoken.settings format error", e);
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("IdenTokenConfig()- SecurityException accessing " + idenTokenSettingsFileName + " Exception=" + e.toString()); m_log.warn("IdenTokenConfig()- SecurityException accessing " + idenTokenSettingsFileName + " Exception=" + e.toString());
throw new Exception("IdenTokenConfig()- Not able to access file", e); throw new Exception("IdenTokenConfig()- Not able to access file", e);
} }
catch (FileNotFoundException e) catch (FileNotFoundException e)
{ {
System.err.println("IdenTokenConfig()- File " + idenTokenSettingsFileName + " not found"); m_log.warn("IdenTokenConfig()- File " + idenTokenSettingsFileName + " not found");
throw new Exception("IdenTokenConfig()- File not found", e); throw new Exception("IdenTokenConfig()- File not found", e);
} }
catch (IOException e) catch (IOException e)
{ {
System.err.println("IdenTokenConfig()- IOException accessing " + idenTokenSettingsFileName + " Exception=" + e.toString()); m_log.warn("IdenTokenConfig()- IOException accessing " + idenTokenSettingsFileName + " Exception=" + e.toString());
throw new Exception("IdenTokenConfig()- Read error", e); throw new Exception("IdenTokenConfig()- Read error", e);
} }
finally finally
@ -151,14 +154,14 @@ public final class IdenTokenConfig
String value = m_tokenSettingsMap.get(settingName); String value = m_tokenSettingsMap.get(settingName);
if (value == null) if (value == null)
{ {
System.err.println("IdenTokenConfig.getSetting()- Did not find setting " + settingName); m_log.info("IdenTokenConfig.getSetting()- Did not find setting " + settingName);
// The setting is not in our map, check if it is one to // The setting is not in our map, check if it is one to
// which we have defaults. // which we have defaults.
if (settingName.equalsIgnoreCase(EncryptAttributes)) if (settingName.equalsIgnoreCase(EncryptAttributes))
{ {
value = m_defaultEncryptAttributesValue; value = m_defaultEncryptAttributesValue;
System.err.println("AuthTokenConfig.getSetting()- Assigning default value " + value); m_log.info("AuthTokenConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_tokenSettingsMap.put(EncryptAttributes, m_defaultEncryptAttributesValue); m_tokenSettingsMap.put(EncryptAttributes, m_defaultEncryptAttributesValue);
@ -166,8 +169,8 @@ public final class IdenTokenConfig
} }
else else
{ {
System.err.println("IdenTokenConfig.getSetting()- Found setting " + settingName); m_log.info("IdenTokenConfig.getSetting()- Found setting " + settingName);
System.err.println("IdenTokenConfig.getSetting()- Setting value = " + value); m_log.info("IdenTokenConfig.getSetting()- Setting value = " + value);
} }
return value; return value;

View File

@ -24,6 +24,8 @@
package com.novell.casa.authtoksvc; package com.novell.casa.authtoksvc;
import org.apache.log4j.Logger;
/** /**
* IdentityToken Interface. * IdentityToken Interface.
* <p> * <p>

View File

@ -44,6 +44,7 @@ import org.ietf.jgss.Oid;
import org.bandit.ia.IAContext; import org.bandit.ia.IAContext;
import org.bandit.util.config.Realm; import org.bandit.util.config.Realm;
import org.apache.log4j.Logger;
/** /**
* Krb5Authenticate Class. * Krb5Authenticate Class.
@ -55,6 +56,8 @@ import org.bandit.util.config.Realm;
*/ */
public final class Krb5Authenticate implements AuthMechanism, Serializable public final class Krb5Authenticate implements AuthMechanism, Serializable
{ {
private static final Logger m_log = Logger.getLogger(Krb5Authenticate.class);
private SvcConfig m_svcConfig; private SvcConfig m_svcConfig;
private AuthMechConfig m_mechConfig; private AuthMechConfig m_mechConfig;
@ -105,7 +108,7 @@ public final class Krb5Authenticate implements AuthMechanism, Serializable
} }
catch (GSSException e) catch (GSSException e)
{ {
System.err.println("Krb5Authenticate Krb5Token()- GSS Exception caught: " + e.getLocalizedMessage()); m_log.warn("Krb5Authenticate Krb5Token()- GSS Exception caught: " + e.getLocalizedMessage());
throw new Exception("Authentication Failure", e); throw new Exception("Authentication Failure", e);
} }
} }
@ -171,13 +174,13 @@ public final class Krb5Authenticate implements AuthMechanism, Serializable
} }
catch (GSSException e) catch (GSSException e)
{ {
System.err.println("Krb5Authenticate()- GSS Exception caught: " + e.getLocalizedMessage()); m_log.warn("Krb5Authenticate()- GSS Exception caught: " + e.getLocalizedMessage());
throw new Exception("Failed to instantiate needed GSS objects", e); throw new Exception("Failed to instantiate needed GSS objects", e);
} }
} }
else else
{ {
System.err.println("Krb5Authenticate()- Service Principal Name not configured"); m_log.warn("Krb5Authenticate()- Service Principal Name not configured");
throw new Exception("Service Principal Name not configured"); throw new Exception("Service Principal Name not configured");
} }
} }
@ -195,7 +198,7 @@ public final class Krb5Authenticate implements AuthMechanism, Serializable
try try
{ {
System.err.println("Krb5Authenticate.invoke()"); m_log.debug("Krb5Authenticate.invoke()");
// Now parse the Kerberos Token // Now parse the Kerberos Token
Krb5Token krb5Token = new Krb5Token(authReqMsg.getAuthMechToken(), this); Krb5Token krb5Token = new Krb5Token(authReqMsg.getAuthMechToken(), this);
@ -235,13 +238,13 @@ public final class Krb5Authenticate implements AuthMechanism, Serializable
searchString = "(userPrincipalName={0})"; searchString = "(userPrincipalName={0})";
else else
{ {
System.err.println("Krb5Authenticate.invoke()- Unsupported realm type " + realmType); m_log.warn("Krb5Authenticate.invoke()- Unsupported realm type " + realmType);
throw new Exception("Realm configuration error"); throw new Exception("Realm configuration error");
} }
} }
else else
{ {
System.err.println("Krb5Authenticate.invoke()- Failed to obtain realm type for realm " + authReqMsg.getRealm()); m_log.warn("Krb5Authenticate.invoke()- Failed to obtain realm type for realm " + authReqMsg.getRealm());
throw new Exception("Realm configuration error"); throw new Exception("Realm configuration error");
} }
@ -270,18 +273,18 @@ public final class Krb5Authenticate implements AuthMechanism, Serializable
} }
else else
{ {
System.err.println("Krb5Authenticate.invoke()- No matching identity entities found"); m_log.info("Krb5Authenticate.invoke()- No matching identity entities found");
} }
} }
} }
catch (NamingException e) catch (NamingException e)
{ {
// Log the error // Log the error
System.err.println("Krb5Authenticate.invoke()- NamingException: " + e.toString()); m_log.warn("Krb5Authenticate.invoke()- NamingException: " + e.toString());
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("Krb5Authenticate.invoke()- Exception: " + e.toString()); m_log.warn("Krb5Authenticate.invoke()- Exception: " + e.toString());
} }
// Return the authentication result // Return the authentication result

View File

@ -40,6 +40,7 @@ import javax.naming.NamingException;
import org.bandit.ia.IAContext; import org.bandit.ia.IAContext;
import org.bandit.util.config.Realm; import org.bandit.util.config.Realm;
import org.apache.log4j.Logger;
/** /**
@ -52,6 +53,8 @@ import org.bandit.util.config.Realm;
*/ */
public final class PwdAuthenticate implements AuthMechanism, Serializable public final class PwdAuthenticate implements AuthMechanism, Serializable
{ {
private static final Logger m_log = Logger.getLogger(PwdAuthenticate.class);
private SvcConfig m_svcConfig; private SvcConfig m_svcConfig;
private AuthMechConfig m_mechConfig; private AuthMechConfig m_mechConfig;
@ -96,7 +99,7 @@ public final class PwdAuthenticate implements AuthMechanism, Serializable
// Check against zero length passwords // Check against zero length passwords
if (m_password.equals("")) if (m_password.equals(""))
{ {
System.err.println("PwToken()- Zero length password diss-allowed"); m_log.warn("PwToken()- Zero length password diss-allowed");
throw new Exception("Zero length password"); throw new Exception("Zero length password");
} }
} }
@ -171,7 +174,7 @@ public final class PwdAuthenticate implements AuthMechanism, Serializable
try try
{ {
System.err.println("PwdAuthenticate.invoke()"); m_log.debug("PwdAuthenticate.invoke()");
// Now parse the PW Token // Now parse the PW Token
PwToken pwToken = new PwToken(authReqMsg.getAuthMechToken()); PwToken pwToken = new PwToken(authReqMsg.getAuthMechToken());
@ -214,13 +217,13 @@ public final class PwdAuthenticate implements AuthMechanism, Serializable
searchString = "(sAMAccountName={0})"; searchString = "(sAMAccountName={0})";
else else
{ {
System.err.println("PwdAuthenticate.invoke()- Unsupported realm type " + realmType); m_log.warn("PwdAuthenticate.invoke()- Unsupported realm type " + realmType);
throw new Exception("Realm configuration error"); throw new Exception("Realm configuration error");
} }
} }
else else
{ {
System.err.println("PwdAuthenticate.invoke()- Failed to obtain realm type for realm " + authReqMsg.getRealm()); m_log.warn("PwdAuthenticate.invoke()- Failed to obtain realm type for realm " + authReqMsg.getRealm());
throw new Exception("Realm configuration error"); throw new Exception("Realm configuration error");
} }
} }
@ -266,7 +269,7 @@ public final class PwdAuthenticate implements AuthMechanism, Serializable
} }
catch (NamingException e) catch (NamingException e)
{ {
System.err.println("PwdAuthenticate.invoke()- NamingException: " + e.getExplanation()); m_log.warn("PwdAuthenticate.invoke()- NamingException: " + e.getExplanation());
} }
} }
} }
@ -274,17 +277,17 @@ public final class PwdAuthenticate implements AuthMechanism, Serializable
// Check if we did not resolve the identity // Check if we did not resolve the identity
if (identId == null) if (identId == null)
{ {
System.err.println("PwdAuthenticate.invoke()- Failed to resolve identity for entity " + pwToken.getUsername()); m_log.warn("PwdAuthenticate.invoke()- Failed to resolve identity for entity " + pwToken.getUsername());
} }
} }
catch (NamingException e) catch (NamingException e)
{ {
// Log the error // Log the error
System.err.println("PwdAuthenticate.invoke()- NamingException on Proxy User: " + e.toString()); m_log.warn("PwdAuthenticate.invoke()- NamingException on Proxy User: " + e.toString());
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("PwdAuthenticate.invoke()- Exception: " + e.toString()); m_log.warn("PwdAuthenticate.invoke()- Exception: " + e.toString());
} }
// Return the authentication result // Return the authentication result

View File

@ -34,6 +34,7 @@ import javax.naming.directory.Attributes;
import org.bandit.ia.IAContext; import org.bandit.ia.IAContext;
import org.bandit.util.config.Realm; import org.bandit.util.config.Realm;
import org.apache.log4j.Logger;
import java.io.FileReader; import java.io.FileReader;
import java.util.Hashtable; import java.util.Hashtable;
@ -47,6 +48,8 @@ import java.util.HashMap;
*/ */
public class RealmsInfo public class RealmsInfo
{ {
private static final Logger m_log = Logger.getLogger(RealmsInfo.class);
// Internal constants // Internal constants
private final static String RealmUrl = "Url"; private final static String RealmUrl = "Url";
private final static String RealmType = "Type"; private final static String RealmType = "Type";
@ -144,7 +147,7 @@ public class RealmsInfo
else else
{ {
// Ignore parameter // Ignore parameter
System.err.println("RealmsInfo: Unknown directory type"); m_log.debug("RealmsInfo: Unknown directory type");
} }
} }
else if (env[iii].getProp().equalsIgnoreCase("com.novell.casa.authtoksvc.contextless_search_string")) else if (env[iii].getProp().equalsIgnoreCase("com.novell.casa.authtoksvc.contextless_search_string"))

View File

@ -25,6 +25,7 @@
package com.novell.casa.authtoksvc; package com.novell.casa.authtoksvc;
import org.bandit.ia.IAContext; import org.bandit.ia.IAContext;
import org.apache.log4j.Logger;
import java.util.*; import java.util.*;
@ -47,6 +48,8 @@ public final class Rpc extends javax.servlet.http.HttpServlet implements javax.s
{ {
private static final long serialVersionUID = -8264027868130334613L; private static final long serialVersionUID = -8264027868130334613L;
private static final Logger m_log = Logger.getLogger(Rpc.class);
private String m_appFolderPath = null; private String m_appFolderPath = null;
private String m_configFolderPath = null; private String m_configFolderPath = null;
@ -85,7 +88,7 @@ public final class Rpc extends javax.servlet.http.HttpServlet implements javax.s
*/ */
public final void run () public final void run ()
{ {
System.err.println("ReconfigureThread.run()- Running"); m_log.debug("ReconfigureThread.run()- Running");
while (m_run) while (m_run)
{ {
@ -107,13 +110,13 @@ public final class Rpc extends javax.servlet.http.HttpServlet implements javax.s
// Check if it is no longer necessary to re-configure the servlet // Check if it is no longer necessary to re-configure the servlet
if (m_rpc.m_reconfigureInterval == 0) if (m_rpc.m_reconfigureInterval == 0)
{ {
System.err.println("ReconfigureTask.run()- Configuration changed to no longer perform timed re-configuration"); m_log.info("ReconfigureTask.run()- Configuration changed to no longer perform timed re-configuration");
break; break;
} }
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("ReconfigureTask.run()- Exception caught during re-configure process, " + e.toString()); m_log.warn("ReconfigureTask.run()- Exception caught during re-configure process, " + e.toString());
} }
} }
} }
@ -152,7 +155,7 @@ public final class Rpc extends javax.servlet.http.HttpServlet implements javax.s
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
System.err.println("Rpc.configureServlet()- Invalid reconfigure interval value format"); m_log.warn("Rpc.configureServlet()- Invalid reconfigure interval value");
m_reconfigureInterval = Integer.parseInt(SvcConfig.DefaultReconfigureIntervalValue); m_reconfigureInterval = Integer.parseInt(SvcConfig.DefaultReconfigureIntervalValue);
} }
@ -189,7 +192,7 @@ public final class Rpc extends javax.servlet.http.HttpServlet implements javax.s
{ {
super.init(config); super.init(config);
System.err.println("Rpc.init()"); m_log.debug("Rpc.init()");
try try
{ {
@ -230,12 +233,13 @@ public final class Rpc extends javax.servlet.http.HttpServlet implements javax.s
} }
catch (Exception e) catch (Exception e)
{ {
System.err.println("Rpc.init()- Exception caught: " + e.toString()); m_log.fatal("Rpc.init()- Exception caught: " + e.toString());
e.printStackTrace();
throw new ServletException("Exception caught while instantiating Rpc methods", e); throw new ServletException("Exception caught while instantiating Rpc methods", e);
} }
catch (Error e) catch (Error e)
{ {
System.err.println("Rpc.init()- Error caught: " + e.toString()); m_log.fatal("Rpc.init()- Error caught: " + e.toString());
e.printStackTrace(); e.printStackTrace();
throw new Error("Error caught while instantiating Rpc methods", e); throw new Error("Error caught while instantiating Rpc methods", e);
} }
@ -248,7 +252,7 @@ public final class Rpc extends javax.servlet.http.HttpServlet implements javax.s
{ {
super.destroy(); super.destroy();
System.err.println("Rpc.destroy()"); m_log.debug("Rpc.destroy()");
// Stop our re-configure thread // Stop our re-configure thread
if (m_reconfigureThread != null) if (m_reconfigureThread != null)
@ -285,6 +289,8 @@ public final class Rpc extends javax.servlet.http.HttpServlet implements javax.s
try try
{ {
m_log.debug("Rpc.doPost()");
// Get ready to send back a reply // Get ready to send back a reply
response.setContentType("text/html"); response.setContentType("text/html");
out = response.getWriter(); out = response.getWriter();
@ -305,26 +311,26 @@ public final class Rpc extends javax.servlet.http.HttpServlet implements javax.s
else else
{ {
// Unsupported method // Unsupported method
System.err.println("Rpc.doPost()- Unsupported method"); m_log.warn("Rpc.doPost()- Unsupported method");
response.sendError(HttpServletResponse.SC_BAD_REQUEST); response.sendError(HttpServletResponse.SC_BAD_REQUEST);
} }
} }
else else
{ {
// Missing method parameter // Missing method parameter
System.err.println("Rpc.doPost()- Missing method parameter"); m_log.warn("Rpc.doPost()- Missing method parameter");
response.sendError(HttpServletResponse.SC_BAD_REQUEST); response.sendError(HttpServletResponse.SC_BAD_REQUEST);
} }
} }
catch (Exception e) catch (Exception e)
{ {
// tbd m_log.error("Rpc.doPost()- Exception caught: " + e.toString());
System.err.println("Rpc.doPost()- Exception caught: " + e.toString()); e.printStackTrace();
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} }
catch (Error e) catch (Error e)
{ {
System.err.println("Rpc.doPost()- Error caught: " + e.toString()); m_log.error("Rpc.doPost()- Error caught: " + e.toString());
e.printStackTrace(); e.printStackTrace();
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} }

View File

@ -33,6 +33,7 @@ import org.apache.axis.configuration.NullProvider;
import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPBody; import org.apache.axis.message.SOAPBody;
import org.apache.axis.message.MessageElement; import org.apache.axis.message.MessageElement;
import org.apache.log4j.Logger;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import java.io.*; import java.io.*;
@ -54,6 +55,7 @@ import java.io.*;
*/ */
public final class SessionToken public final class SessionToken
{ {
private static final Logger m_log = Logger.getLogger(SessionToken.class);
private String m_id = null; private String m_id = null;
private String m_realm = null; private String m_realm = null;
@ -168,14 +170,14 @@ public final class SessionToken
if (m_realm == null || m_id == null) if (m_realm == null || m_id == null)
{ {
System.out.println("SessionToken()- Required data missing from session token"); m_log.warn("SessionToken()- Required data missing from session token");
throw new Exception("Error: Required data missing from session Token"); throw new Exception("Error: Required data missing from session Token");
} }
} }
else else
{ {
// Message verification failed // Message verification failed
System.err.println("SessionToken()- Invalid Session Token"); m_log.warn("SessionToken()- Invalid Session Token");
throw new Exception("Invalid Session Token"); throw new Exception("Invalid Session Token");
} }
} }
@ -246,7 +248,7 @@ public final class SessionToken
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("SessionToken.getMessage() - Exception caught building message, error: " + e.getMessage()); m_log.error("SessionToken.getMessage() - Exception caught building message, error: " + e.getMessage());
secureMessage = null; secureMessage = null;
} }
finally finally

View File

@ -31,6 +31,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory; import org.xml.sax.helpers.XMLReaderFactory;
import org.apache.log4j.Logger;
/** /**
* SvcConfig Class. * SvcConfig Class.
@ -40,6 +41,8 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/ */
public final class SvcConfig public final class SvcConfig
{ {
private static final Logger m_log = Logger.getLogger(SvcConfig.class);
// Well known service configuration settings // Well known service configuration settings
// //
// The LifetimeShorter value is the value by which token lifetime // The LifetimeShorter value is the value by which token lifetime
@ -85,9 +88,9 @@ public final class SvcConfig
*/ */
public SvcConfig(String appRootPath, String svcConfigPath) throws Exception public SvcConfig(String appRootPath, String svcConfigPath) throws Exception
{ {
System.err.println("SvcConfig()-"); m_log.debug("SvcConfig()-");
System.err.println("SvcConfig()- SvcConfigPath = " + svcConfigPath); m_log.info("SvcConfig()- SvcConfigPath = " + svcConfigPath);
// Create a map to keep track of the service settings // Create a map to keep track of the service settings
m_svcSettingsMap = new HashMap<String, String>(); m_svcSettingsMap = new HashMap<String, String>();
@ -119,7 +122,7 @@ public final class SvcConfig
tokenLifetime = Integer.valueOf(getSetting(SessionTokenLifetime)).intValue(); tokenLifetime = Integer.valueOf(getSetting(SessionTokenLifetime)).intValue();
if (tokenLifetime < MinimumTokenLifetimeValue) if (tokenLifetime < MinimumTokenLifetimeValue)
{ {
System.err.println("SvcConfig()- Configured token lifetime too small, defaulting to " m_log.info("SvcConfig()- Configured token lifetime too small, defaulting to "
+ Integer.toString(MinimumTokenLifetimeValue) + " seconds"); + Integer.toString(MinimumTokenLifetimeValue) + " seconds");
tokenLifetime = MinimumTokenLifetimeValue; tokenLifetime = MinimumTokenLifetimeValue;
@ -129,7 +132,7 @@ public final class SvcConfig
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
System.err.println("SvcConfig()- Invalid configured token lifetime value, defaulting to " m_log.info("SvcConfig()- Invalid configured token lifetime value, defaulting to "
+ Integer.toString(MinimumTokenLifetimeValue) + " seconds"); + Integer.toString(MinimumTokenLifetimeValue) + " seconds");
tokenLifetime = MinimumTokenLifetimeValue; tokenLifetime = MinimumTokenLifetimeValue;
@ -143,7 +146,7 @@ public final class SvcConfig
lifetimeShorter = Integer.valueOf(getSetting(LifetimeShorter)).intValue(); lifetimeShorter = Integer.valueOf(getSetting(LifetimeShorter)).intValue();
if (lifetimeShorter < MinimumLifetimeShorterValue) if (lifetimeShorter < MinimumLifetimeShorterValue)
{ {
System.err.println("SvcConfig()- Configured lifetime shorter too small, defaulting to " m_log.info("SvcConfig()- Configured lifetime shorter too small, defaulting to "
+ Integer.toString(MinimumLifetimeShorterValue) + " seconds"); + Integer.toString(MinimumLifetimeShorterValue) + " seconds");
lifetimeShorter = MinimumLifetimeShorterValue; lifetimeShorter = MinimumLifetimeShorterValue;
@ -153,7 +156,7 @@ public final class SvcConfig
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
System.err.println("SvcConfig()- Invalid configured lifetime shorter value, defaulting to " m_log.info("SvcConfig()- Invalid configured lifetime shorter value, defaulting to "
+ Integer.toString(MinimumLifetimeShorterValue) + " seconds"); + Integer.toString(MinimumLifetimeShorterValue) + " seconds");
lifetimeShorter = MinimumLifetimeShorterValue; lifetimeShorter = MinimumLifetimeShorterValue;
@ -164,7 +167,7 @@ public final class SvcConfig
if (lifetimeShorter > tokenLifetime if (lifetimeShorter > tokenLifetime
|| (tokenLifetime - lifetimeShorter) < MinimumLifetimeShorterDifferential) || (tokenLifetime - lifetimeShorter) < MinimumLifetimeShorterDifferential)
{ {
System.err.println("SvcConfig()- Invalid lifetime shorter value, defaulting to " m_log.info("SvcConfig()- Invalid lifetime shorter value, defaulting to "
+ Integer.toString(MinimumLifetimeShorterValue) + " seconds"); + Integer.toString(MinimumLifetimeShorterValue) + " seconds");
// Update the map with the new value for the setting // Update the map with the new value for the setting
@ -178,7 +181,7 @@ public final class SvcConfig
if (reconfigureInterval != 0 if (reconfigureInterval != 0
&& reconfigureInterval < MinimumReconfigureIntervalValue) && reconfigureInterval < MinimumReconfigureIntervalValue)
{ {
System.err.println("SvcConfig()- Configured reconfigure interval too small, defaulting to " m_log.info("SvcConfig()- Configured reconfigure interval too small, defaulting to "
+ Integer.toString(MinimumReconfigureIntervalValue) + " seconds"); + Integer.toString(MinimumReconfigureIntervalValue) + " seconds");
// Update the map with the new value for the setting // Update the map with the new value for the setting
@ -187,7 +190,7 @@ public final class SvcConfig
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
System.err.println("SvcConfig()- Invalid configured reconfigured interval value, defaulting to " m_log.info("SvcConfig()- Invalid configured reconfigured interval value, defaulting to "
+ Integer.toString(MinimumReconfigureIntervalValue) + " seconds"); + Integer.toString(MinimumReconfigureIntervalValue) + " seconds");
// Update the map with the new value for the setting // Update the map with the new value for the setting
@ -199,22 +202,22 @@ public final class SvcConfig
} }
catch (SAXException e) catch (SAXException e)
{ {
System.err.println("SvcConfig()- Parse exception: " + e.toString()); m_log.warn("SvcConfig()- Parse exception: " + e.toString());
throw new Exception("SvcConfig()- svc.settings format error", e); throw new Exception("SvcConfig()- svc.settings format error", e);
} }
catch (SecurityException e) catch (SecurityException e)
{ {
System.err.println("SvcConfig()- SecurityException caught while accessing " + svcConfigPath + File.separator + m_svcSettingsFileName + " Exception=" + e.toString()); m_log.warn("SvcConfig()- SecurityException caught while accessing " + svcConfigPath + File.separator + m_svcSettingsFileName + " Exception=" + e.toString());
throw new Exception("SvcConfig()- Not able to access file", e); throw new Exception("SvcConfig()- Not able to access file", e);
} }
catch (FileNotFoundException e) catch (FileNotFoundException e)
{ {
System.err.println("SvcConfig()- File " + svcConfigPath + File.separator + m_svcSettingsFileName + " not found"); m_log.warn("SvcConfig()- File " + svcConfigPath + File.separator + m_svcSettingsFileName + " not found");
throw new Exception("SvcConfig()- File not found", e); throw new Exception("SvcConfig()- File not found", e);
} }
catch (IOException e) catch (IOException e)
{ {
System.err.println("SvcConfig()- IOException caught while trying to read " + svcConfigPath + File.separator + m_svcSettingsFileName + " Exception=" + e.toString()); m_log.warn("SvcConfig()- IOException caught while trying to read " + svcConfigPath + File.separator + m_svcSettingsFileName + " Exception=" + e.toString());
throw new Exception("SvcConfig()- Read error", e); throw new Exception("SvcConfig()- Read error", e);
} }
finally finally
@ -246,14 +249,14 @@ public final class SvcConfig
String value = m_svcSettingsMap.get(settingName); String value = m_svcSettingsMap.get(settingName);
if (value == null) if (value == null)
{ {
System.err.println("SvcConfig.getSetting()- Did not find setting " + settingName); m_log.info("SvcConfig.getSetting()- Did not find setting " + settingName);
// The setting is not in our map, check if it is one to // The setting is not in our map, check if it is one to
// which we have defaults. // which we have defaults.
if (settingName.equalsIgnoreCase(SessionTokenLifetime)) if (settingName.equalsIgnoreCase(SessionTokenLifetime))
{ {
value = DefaultSessionTokenLifetimeValue; value = DefaultSessionTokenLifetimeValue;
System.err.println("SvcConfig.getSetting()- Assigning default value " + value); m_log.info("SvcConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_svcSettingsMap.put(SessionTokenLifetime, DefaultSessionTokenLifetimeValue); m_svcSettingsMap.put(SessionTokenLifetime, DefaultSessionTokenLifetimeValue);
@ -261,7 +264,7 @@ public final class SvcConfig
else if (settingName.equalsIgnoreCase(LifetimeShorter)) else if (settingName.equalsIgnoreCase(LifetimeShorter))
{ {
value = DefaultLifetimeShorterValue; value = DefaultLifetimeShorterValue;
System.err.println("SvcConfig.getSetting()- Assigning default value " + value); m_log.info("SvcConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_svcSettingsMap.put(LifetimeShorter, DefaultLifetimeShorterValue); m_svcSettingsMap.put(LifetimeShorter, DefaultLifetimeShorterValue);
@ -269,7 +272,7 @@ public final class SvcConfig
else if (settingName.equalsIgnoreCase(ReconfigureInterval)) else if (settingName.equalsIgnoreCase(ReconfigureInterval))
{ {
value = DefaultReconfigureIntervalValue; value = DefaultReconfigureIntervalValue;
System.err.println("SvcConfig.getSetting()- Assigning default value " + value); m_log.info("SvcConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_svcSettingsMap.put(ReconfigureInterval, DefaultReconfigureIntervalValue); m_svcSettingsMap.put(ReconfigureInterval, DefaultReconfigureIntervalValue);
@ -277,7 +280,7 @@ public final class SvcConfig
else if (settingName.equalsIgnoreCase(SigningKeyAliasName)) else if (settingName.equalsIgnoreCase(SigningKeyAliasName))
{ {
value = DefaultSigningKeyAliasNameValue; value = DefaultSigningKeyAliasNameValue;
System.err.println("SvcConfig.getSetting()- Assigning default value " + value); m_log.info("SvcConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_svcSettingsMap.put(SigningKeyAliasName, DefaultSigningKeyAliasNameValue); m_svcSettingsMap.put(SigningKeyAliasName, DefaultSigningKeyAliasNameValue);
@ -285,21 +288,21 @@ public final class SvcConfig
else if (settingName.equalsIgnoreCase(SigningKeyPassword)) else if (settingName.equalsIgnoreCase(SigningKeyPassword))
{ {
value = DefaultSigningKeyPasswordValue; value = DefaultSigningKeyPasswordValue;
System.err.println("SvcConfig.getSetting()- Assigning default value " + value); m_log.info("SvcConfig.getSetting()- Assigning default value " + value);
// Add the key to the map so that it can be found quicker next time // Add the key to the map so that it can be found quicker next time
m_svcSettingsMap.put(SigningKeyPassword, DefaultSigningKeyPasswordValue); m_svcSettingsMap.put(SigningKeyPassword, DefaultSigningKeyPasswordValue);
} }
else if (settingName.equalsIgnoreCase(IdentityAbstractionConfigFile)) else if (settingName.equalsIgnoreCase(IdentityAbstractionConfigFile))
{ {
System.err.println("SvcConfig.getSetting()- Mandatory setting " + IdentityAbstractionConfigFile + " not set"); m_log.info("SvcConfig.getSetting()- Mandatory setting " + IdentityAbstractionConfigFile + " not set");
throw new Exception("Missing mandatory configuration setting"); throw new Exception("Missing mandatory configuration setting");
} }
} }
else else
{ {
System.err.println("SvcConfig.getSetting()- Found setting " + settingName); m_log.info("SvcConfig.getSetting()- Found setting " + settingName);
System.err.println("SvcConfig.getSetting()- Setting value = " + value); m_log.info("SvcConfig.getSetting()- Setting value = " + value);
} }
return value; return value;

View File

@ -36,6 +36,7 @@ import org.apache.ws.security.message.WSSecHeader;
import org.apache.ws.security.message.WSSecSignature; import org.apache.ws.security.message.WSSecSignature;
import org.apache.ws.security.message.WSSecTimestamp; import org.apache.ws.security.message.WSSecTimestamp;
import org.apache.xml.security.c14n.Canonicalizer; import org.apache.xml.security.c14n.Canonicalizer;
import org.apache.log4j.Logger;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -55,6 +56,8 @@ import java.util.Vector;
*/ */
public final class WSSecurity public final class WSSecurity
{ {
private static final Logger m_log = Logger.getLogger(WSSecurity.class);
static final private WSSecurityEngine secEngine = new WSSecurityEngine(); static final private WSSecurityEngine secEngine = new WSSecurityEngine();
static final private Crypto crypto = CryptoFactory.getInstance(); static final private Crypto crypto = CryptoFactory.getInstance();
@ -237,17 +240,17 @@ public final class WSSecurity
if (timeStampProcessed && signatureProcessed) if (timeStampProcessed && signatureProcessed)
{ {
System.out.println("WSSecurity.verifyMessage() - Validation succeded"); m_log.debug("WSSecurity.verifyMessage() - Validation succeded");
msgVerificationStatus = true; msgVerificationStatus = true;
} }
else else
{ {
System.out.println("WSSecurity.verifyMessage() - validation failed"); m_log.warn("WSSecurity.verifyMessage() - validation failed");
} }
} }
catch (WSSecurityException e) catch (WSSecurityException e)
{ {
System.out.println("WSSecurity.verifyMessage() - Verification failed with error:" + e.getMessage() + " code = " + e.getErrorCode()); m_log.warn("WSSecurity.verifyMessage() - Verification failed with error:" + e.getMessage() + " code = " + e.getErrorCode());
} }
return msgVerificationStatus; return msgVerificationStatus;