Skip to content

Commit

Permalink
SAK-9854 SAK-9965 SAK-10431 SAK-11347 SAK-3800 Merge from SAK-10418 w…
Browse files Browse the repository at this point in the history
…orking branch -r34663 to trunk; includes changes to UserDirectoryProvider and UserDirectoryService interfaces

git-svn-id: https://source.sakaiproject.org/svn/providers/trunk@34683 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
raydavis committed Sep 4, 2007
1 parent 2e6b0ef commit 6ba8362
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 299 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,6 @@ public void destroy()
public FilterUserDirectoryProvider()
{
} // Switch


/**
* See if a user by this id exists.
*
* @param userId
* The user id string.
* @return true if a user by this id exists, false if not.
*/
public boolean userExists(String userId)
{
if (m_logger.isDebugEnabled()) {
m_logger.debug("userExists() as "+providerID + " on " + userId);
}
if ( myProvider.userExists(userId) ) {
return true;
} else if ( nextProvider != null ) {
return nextProvider.userExists(userId);
}
return false;
} // userExists

/**
* Access a user object. Update the object with the information found.
Expand Down Expand Up @@ -521,57 +500,6 @@ public boolean authenticateUser(String userId, UserEdit edit, String password)

} // authenticateUser

/**
* Will this provider update user records on successfull authentication? If so, the UserDirectoryService will cause these updates to be stored.
*
* @return true if the user record may be updated after successfull authentication, false if not.
*/
public boolean updateUserAfterAuthentication()
{
m_logger.debug("updateUserAfterAuthnetication() as "+providerID);

// This is called directly after authenticateUser, so we should be able to
// register which used we are talking about, provided none of the underlying
// directroy providers calls this. It is also only called once, so we must remove
// the thread local flag once the call has completed.
if ( providerID.equals(authenticatedProvider.get()) ) {
authenticatedProvider.set(null);
return myProvider.updateUserAfterAuthentication();
} else if ( nextProvider != null ) {
return nextProvider.updateUserAfterAuthentication();
}
return false;
}
/**
*
* {@inheritDoc}
*/
public boolean createUserRecord(String id)
{
if ( myProvider.createUserRecord(id) ) {
return true;
} else if ( nextProvider != null ) {
return nextProvider.createUserRecord(id);
}
return false;
}


/**
* {@inheritDoc}
*/
public void destroyAuthentication()
{
m_logger.warn("destroyAuthentciation() as "+providerID);

// the provider must only destroy authentications for their own provider
// source.
myProvider.destroyAuthentication();
if ( nextProvider != null ) {
nextProvider.destroyAuthentication();
}
}

/**
* The UserDirectoryProvider used by this filter
* @return
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ public void init()
{
M_log.warn(".init(): Not properly initialized.");
}

// Run our local unit tests
IMSEntProviderUnitTest.localUnitTests(this, null);
}
catch (Throwable t)
{
Expand Down Expand Up @@ -259,22 +256,6 @@ public IMSEntUserDirectoryProvider()

} // SampleUserDirectoryProvider

/**
* See if a user by this id exists.
*
* @param userId
* The user id string.
* @return true if a user by this id exists, false if not.
*/
public boolean userExists(String userId)
{
if (!isReady()) return false;
if (userId == null) return false;
System.out.println("userExists(" + userId + ")");
SakaiIMSUser rv = retrieveUser(userId, false);
return (rv != null);
} // userExists

/**
* Copy the information from our internal structure into the Sakai User structure.
*
Expand Down Expand Up @@ -371,23 +352,6 @@ public boolean authenticateUser(final String userId, UserEdit edit, String passw
return (password.compareTo(rv.password) == 0);
} // authenticateUser

/**
* Will this provider update user records on successfull authentication? If so, the UserDirectoryService will cause these updates to be stored.
*
* @return true if the user record may be updated after successfull authentication, false if not.
*/
public boolean updateUserAfterAuthentication()
{
return false;
}

/**
* {@inheritDoc}
*/
public void destroyAuthentication()
{
}

/**
* {@inheritDoc}
*/
Expand All @@ -396,13 +360,5 @@ public boolean authenticateWithProviderFirst(String id)
return false;
}

/**
* {@inheritDoc}
*/
public boolean createUserRecord(String id)
{
return false;
}

} // SampleUserDirectoryProvider

Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,6 @@ public boolean authenticateUser(String userLogin, UserEdit edit, String password
}
}

public void destroyAuthentication()
{
// not sure what to do here
}

public boolean findUserByEmail(UserEdit edit, String email)
{

Expand Down Expand Up @@ -317,38 +312,6 @@ public void getUsers(Collection users)
}
}

public boolean updateUserAfterAuthentication()
{
return false;
}

public boolean userExists(String id)
{
UserData existingUser = (UserData) users.get(id);

if (existingUser != null)
{
return true;
}
LDAPConnection conn = new LDAPConnection();
String sFilter = (String) attributeMappings.get("login") + "=" + id;

String thisDn = "";
String[] attrList = new String[] { (String) attributeMappings.get("distinguishedName") };
try
{
conn.connect(ldapHost, ldapPort);
// this will fail if user does not exist
LDAPEntry userEntry = getEntryFromDirectory(sFilter, attrList, conn);
conn.disconnect();
}
catch (Exception e)
{
return false;
}
return true;
}

// search the directory to get an entry
private LDAPEntry getEntryFromDirectory(String searchFilter, String[] attribs, LDAPConnection conn) throws LDAPException
{
Expand Down Expand Up @@ -646,12 +609,4 @@ public boolean authenticateWithProviderFirst(String id)
{
return false;
}

/**
* {@inheritDoc}
*/
public boolean createUserRecord(String id)
{
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,22 +235,6 @@ public void destroy()
* UserDirectoryProvider implementation
*********************************************************************************************************************************************************************************************************************************************************/

/**
* See if a user by this id exists.
*
* @param userId
* The user id string.
* @return true if a user by this id exists, false if not.
*/
public boolean userExists(String userId)
{
if (m_requirelocalaccount) return false;

boolean knownKerb = userKnownToKerberos(userId);
M_log.info("userExists: " + userId + " Kerberos: " + knownKerb);
return knownKerb;
} // userExists

/**
* Access a user object. Update the object with the information found.
*
Expand All @@ -260,7 +244,8 @@ public boolean userExists(String userId)
*/
public boolean getUser(UserEdit edit)
{
if (!userExists(edit.getEid())) return false;
if (m_requirelocalaccount) return false;
if (!userKnownToKerberos(edit.getEid())) return false;

edit.setEmail(edit.getEid() + "@" + m_domain);
edit.setType("kerberos");
Expand Down Expand Up @@ -387,24 +372,6 @@ public boolean authenticateUser(String userId, UserEdit edit, String password)
}
} // authenticateUser

/**
* {@inheritDoc}
*/
public void destroyAuthentication()
{

}

/**
* Will this provider update user records on successful authentication? If so, the UserDirectoryService will cause these updates to be stored.
*
* @return true if the user record may be updated after successful authentication, false if not.
*/
public boolean updateUserAfterAuthentication()
{
return false;
}

/**********************************************************************************************************************************************************************************************************************************************************
* Kerberos stuff
*********************************************************************************************************************************************************************************************************************************************************/
Expand Down Expand Up @@ -562,8 +529,6 @@ public SakaiCallbackHandler()
*/
public void handle(Callback[] callbacks) throws java.io.IOException, UnsupportedCallbackException
{
ConfirmationCallback confirmation = null;

for (int i = 0; i < callbacks.length; i++)
{
if (callbacks[i] instanceof TextOutputCallback)
Expand Down Expand Up @@ -637,14 +602,6 @@ public boolean authenticateWithProviderFirst(String id)
return false;
}

/**
* {@inheritDoc}
*/
public boolean createUserRecord(String id)
{
return false;
}

/**
* <p>
* Helper class for storing user data in an in-memory cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ public boolean authenticateUser(String userLogin, UserEdit edit, String password
return returnVal;
}

public void destroyAuthentication()
{
}

public boolean findUserByEmail(UserEdit edit, String email)
{

Expand Down Expand Up @@ -202,12 +198,7 @@ public void getUsers(Collection users)
}
}

public boolean updateUserAfterAuthentication()
{
return false;
}

public boolean userExists(String id)
protected boolean userExists(String id)
{
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_CREDENTIALS, "secret");
Expand Down
Loading

0 comments on commit 6ba8362

Please sign in to comment.