Changed to start searches at the context root if a startSearchContext is

not configured in the svc.settings file. Also, modified the various
configuration parsing components to allow for empty settings.
This commit is contained in:
Juan Carlos Luciani 2006-05-31 16:12:41 +00:00
parent 228ffd5164
commit c5cf7bcc88
7 changed files with 30 additions and 10 deletions

View File

@ -133,6 +133,7 @@ public class AuthMechConfig
// Proceed based on our state
switch (m_state)
{
case AWAITING_SETTING_ELEMENT_DATA:
case AWAITING_SETTING_ELEMENT_END:
// Advance to the next state
m_state = AWAITING_SETTING_ELEMENT_START;

View File

@ -138,6 +138,7 @@ public class AuthTokenConfig
// Proceed based on our state
switch (m_state)
{
case AWAITING_SETTING_ELEMENT_DATA:
case AWAITING_SETTING_ELEMENT_END:
// Advance to the next state
m_state = AWAITING_SETTING_ELEMENT_START;

View File

@ -137,6 +137,7 @@ public class IdenTokenConfig
// Proceed based on our state
switch (m_state)
{
case AWAITING_SETTING_ELEMENT_DATA:
case AWAITING_SETTING_ELEMENT_END:
// Advance to the next state
m_state = AWAITING_SETTING_ELEMENT_START;

View File

@ -198,11 +198,22 @@ public class Krb5Authenticate implements AuthMechanism, Serializable
DirContext ctx = new InitialDirContext(env);
// Now search for a user with a matching kerberos principal name
// Now search for a user with a matching kerberos principal name.
//
// Set up a search control so that the search is scoped to the sub-tree
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration answer = ctx.search(m_svcConfig.getSetting(SvcConfig.StartSearchContext),
// Obtain the start search context - tbd - this will be removed once the functionality flows into Bandit
String searchContext = m_svcConfig.getSetting(SvcConfig.StartSearchContext);
if (searchContext == null)
{
// A start search context was not configured, start from the root.
searchContext = "";
}
// Perform the search
NamingEnumeration answer = ctx.search(searchContext,
"(krbPrincipalName={0})",
new String[] {krb5Token.getPrincipalName()},
controls);

View File

@ -143,11 +143,22 @@ public class PwdAuthenticate implements AuthMechanism, Serializable
DirContext ctx = new InitialDirContext(env);
// Now search for a user with a matching surname
// Now search for a user with a matching surname.
//
// Set up a search control so that the search is scoped to the sub-tree
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration answer = ctx.search(m_svcConfig.getSetting(SvcConfig.StartSearchContext),
// Obtain the start search context - tbd - this will be removed once the functionality flows into Bandit
String searchContext = m_svcConfig.getSetting(SvcConfig.StartSearchContext);
if (searchContext == null)
{
// A start search context was not configured, start from the root.
searchContext = "";
}
// Perform the search
NamingEnumeration answer = ctx.search(searchContext,
"(cn={0})",
new String[] {pwToken.getUsername()},
controls);

View File

@ -146,6 +146,7 @@ public class SvcConfig
// Proceed based on our state
switch (m_state)
{
case AWAITING_SETTING_ELEMENT_DATA:
case AWAITING_SETTING_ELEMENT_END:
// Advance to the next state
m_state = AWAITING_SETTING_ELEMENT_START;
@ -273,11 +274,6 @@ public class SvcConfig
System.err.println("SvcConfig.getSetting()- Mandatory setting " + IdentityAbstractionConfigFile + " not set");
throw new Exception("Missing mandatory configuration setting");
}
else if (settingName.equals(StartSearchContext) == true)
{
System.err.println("SvcConfig.getSetting()- Mandatory setting " + StartSearchContext + " not set");
throw new Exception("Missing mandatory configuration setting");
}
}
else
{

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<settings>
<IAConfigFile>Replace with path to the Identity Abstraction Realms Configuration File.</IAConfigFile>
<startSearchContext>Replace with the Context from where to start searches, do not specify to start at the root.</startSearchContext>
<SessionTokenLifetime>43200</SessionTokenLifetime>
</settings>