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:
parent
51b08492a8
commit
452fabac62
@ -10,5 +10,4 @@ This file contains a list of the items still outstanding for JaasSupport.
|
|||||||
|
|
||||||
OUTSTANDING ITEMS
|
OUTSTANDING ITEMS
|
||||||
|
|
||||||
- Change the username that the login module checks to be CasaPrincipal.
|
- Change printfs used for debugging into a suitable mechanism.
|
||||||
- Change the setting for checking usernames to be PerformUsernameCheck.
|
|
||||||
|
17
auth_token/server/JaasSupport/make_and_run_test.sh
Executable file
17
auth_token/server/JaasSupport/make_and_run_test.sh
Executable 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
|
||||||
|
|
@ -120,9 +120,9 @@ public class CasaLoginModule implements LoginModule
|
|||||||
// Do not perform the username check unless configured to do it.
|
// Do not perform the username check unless configured to do it.
|
||||||
boolean performUsernameCheck = false;
|
boolean performUsernameCheck = false;
|
||||||
if (m_options != null
|
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"))
|
if (keyVal != null && keyVal.equals("true"))
|
||||||
performUsernameCheck = true;
|
performUsernameCheck = true;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ public class CasaPrincipal implements Principal
|
|||||||
m_identStoreUrl = identityToken.getSourceUrl();
|
m_identStoreUrl = identityToken.getSourceUrl();
|
||||||
m_attributes = identityToken.getAttributes();
|
m_attributes = identityToken.getAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see java.security.Principal#getName()
|
* @see java.security.Principal#getName()
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
SampleApp {
|
testService {
|
||||||
com.novell.casa.jaas.CasaLoginModule Required debug=true;
|
com.novell.casa.jaas.CasaLoginModule Required debug=true;
|
||||||
};
|
};
|
@ -59,6 +59,7 @@ public class SampleApp
|
|||||||
// Create a socket to listen for connections
|
// Create a socket to listen for connections
|
||||||
int port = 4444;
|
int port = 4444;
|
||||||
int queueLen = 6;
|
int queueLen = 6;
|
||||||
|
System.out.println("Listen port = " + port);
|
||||||
listenSock = new ServerSocket(port, queueLen);
|
listenSock = new ServerSocket(port, queueLen);
|
||||||
|
|
||||||
// Service connections
|
// Service connections
|
||||||
@ -83,9 +84,9 @@ public class SampleApp
|
|||||||
|
|
||||||
// Authenticate the token and print out the information available to our service
|
// Authenticate the token and print out the information available to our service
|
||||||
// about the authenticated identity.
|
// about the authenticated identity.
|
||||||
|
LoginContext lc = new LoginContext("testService", new SampleAppCallbackHandler(authToken));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LoginContext lc = new LoginContext("testService", new SampleAppCallbackHandler(authToken));
|
|
||||||
System.out.println("Authenticating the user");
|
System.out.println("Authenticating the user");
|
||||||
lc.login();
|
lc.login();
|
||||||
|
|
||||||
@ -130,7 +131,7 @@ public class SampleApp
|
|||||||
}
|
}
|
||||||
catch (LoginException e)
|
catch (LoginException e)
|
||||||
{
|
{
|
||||||
System.out.println(" Authentication failed");
|
System.out.println(" Authentication failed, LoginException: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
Loading…
Reference in New Issue
Block a user