Changes to fix problems found while testing with the sample application.

Also added a shell script to allow us to build and run the test
application.
This commit is contained in:
Juan Carlos Luciani 2006-05-24 00:53:03 +00:00
parent 51b08492a8
commit 452fabac62
6 changed files with 392 additions and 374 deletions

View File

@ -10,5 +10,4 @@ This file contains a list of the items still outstanding for JaasSupport.
OUTSTANDING ITEMS
- Change the username that the login module checks to be CasaPrincipal.
- Change the setting for checking usernames to be PerformUsernameCheck.
- Change printfs used for debugging into a suitable mechanism.

View File

@ -0,0 +1,17 @@
#!/bin/bash
if [ ! -d build-test ]; then
mkdir build-test
mkdir build-test/classes
else
if [ ! -d build-test/classes ]; then
mkdir build-test/classes
fi
fi
echo "*** Compiling the test application ***"
javac -sourcepath src -classpath ../../../lib/java/CasaJaasSupport.jar:../../../lib/java/CasaAuthToken.jar -d build-test/classes src/com/novell/casa/jaas/sample/SampleApp.java src/com/novell/casa/jaas/sample/SampleAppCallbackHandler.java
echo "*** Done compiling ***"
echo ""
echo "*** Starting the test application ***"
java -classpath build-test/classes:../../../lib/java/CasaJaasSupport.jar:../../../lib/java/CasaAuthToken.jar:/usr/share/java/xerces-j2.jar -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser -Djava.security.auth.login.config=src/com/novell/casa/jaas/sample/SampleApp.conf com.novell.casa.jaas.sample.SampleApp
#jdb -sourcepath src:../AuthTokenSvc/src -classpath build-test/classes:../../../lib/java/CasaJaasSupport.jar:../../../lib/java/CasaAuthToken.jar:/usr/share/java/xerces-j2.jar -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser -Djava.security.auth.login.config=src/com/novell/casa/jaas/sample/SampleApp.conf com.novell.casa.jaas.sample.SampleApp

View File

@ -120,9 +120,9 @@ public class CasaLoginModule implements LoginModule
// Do not perform the username check unless configured to do it.
boolean performUsernameCheck = false;
if (m_options != null
&& m_options.containsKey((String) "performUsernameCheck") == true)
&& m_options.containsKey((String) "PerformUsernameCheck") == true)
{
String keyVal = (String) m_options.get("performUsernameCheck");
String keyVal = (String) m_options.get("PerformUsernameCheck");
if (keyVal != null && keyVal.equals("true"))
performUsernameCheck = true;
}

View File

@ -51,6 +51,7 @@ public class CasaPrincipal implements Principal
m_identStoreUrl = identityToken.getSourceUrl();
m_attributes = identityToken.getAttributes();
}
/*
* (non-Javadoc)
* @see java.security.Principal#getName()

View File

@ -1,3 +1,3 @@
SampleApp {
testService {
com.novell.casa.jaas.CasaLoginModule Required debug=true;
};

View File

@ -59,6 +59,7 @@ public class SampleApp
// Create a socket to listen for connections
int port = 4444;
int queueLen = 6;
System.out.println("Listen port = " + port);
listenSock = new ServerSocket(port, queueLen);
// Service connections
@ -83,9 +84,9 @@ public class SampleApp
// Authenticate the token and print out the information available to our service
// about the authenticated identity.
LoginContext lc = new LoginContext("testService", new SampleAppCallbackHandler(authToken));
try
{
LoginContext lc = new LoginContext("testService", new SampleAppCallbackHandler(authToken));
System.out.println("Authenticating the user");
lc.login();
@ -130,7 +131,7 @@ public class SampleApp
}
catch (LoginException e)
{
System.out.println(" Authentication failed");
System.out.println(" Authentication failed, LoginException: " + e.getMessage());
}
}
finally