Modifications due to continue development and re-structuring of

auth_token.
This commit is contained in:
Juan Carlos Luciani
2006-04-26 22:05:29 +00:00
parent 51da351af7
commit abacf42fa4
15 changed files with 79 additions and 65 deletions

View File

@@ -3,5 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/CasaAuthServer"/>
<classpathentry kind="lib" path="/usr/share/java/xerces-j2.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

View File

@@ -117,16 +117,17 @@ public class CasaLoginModule implements LoginModule
throw new LoginException("Null CallbackHandler");
}
// Perform the username check unless configured to skip it.
boolean skipUsernameCheck = false;
// Do not perform the username check unless configured to do it.
boolean performUsernameCheck = false;
if (m_options != null
&& m_options.containsKey((String) "skipUsernameCheck") == true)
&& m_options.containsKey((String) "performUsernameCheck") == true)
{
String keyVal = (String) m_options.get("skipUsernameCheck");
if (keyVal == null || keyVal.equals("true"))
skipUsernameCheck = true;
String keyVal = (String) m_options.get("performUsernameCheck");
if (keyVal != null && keyVal.equals("true"))
performUsernameCheck = true;
}
if (!skipUsernameCheck)
if (performUsernameCheck)
{
// Verify that the username is CasaIdentityUser, for this
// we first need to obtain it.
@@ -155,7 +156,7 @@ public class CasaLoginModule implements LoginModule
else
{
// Save the retrieved username in the shared state and then check it.
m_sharedState.put("javax.security.auth.login.name" , username);
m_sharedState.put("javax.security.auth.login.name", username);
if (username.equals(casaUsername) == false)
return false;
}

View File

@@ -22,7 +22,7 @@
*
***********************************************************************/
package com.novell.casa.jaas;
package com.novell.casa.jaas.sample;
import java.io.BufferedReader;
import java.io.IOException;
@@ -37,6 +37,8 @@ import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import com.novell.casa.jaas.CasaPrincipal;
/*
* This is a sample application which demonstrates the use of
@@ -81,10 +83,9 @@ public class SampleApp
// Authenticate the token and print out the information available to our service
// about the authenticated identity.
try
{
LoginContext lc = new LoginContext("SampleApp", new SampleAppCallbackHandler(authToken));
LoginContext lc = new LoginContext("testService", new SampleAppCallbackHandler(authToken));
System.out.println("Authenticating the user");
lc.login();

View File

@@ -22,7 +22,7 @@
*
***********************************************************************/
package com.novell.casa.jaas;
package com.novell.casa.jaas.sample;
import java.io.IOException;