throws CredentialPolicyException, IdentityException, NamingException, SQLException {
LdapClient client = null;
try {
// ensure that the new credentials are valid
CredentialPolicy policy = new CredentialPolicy();
UsernamePasswordCredentials cred;
cred = user.getCredentials().getUsernamePasswordCredentials();
policy.validateUsernamePolicy(cred);
policy.validatePasswordPolicy(cred);
policy.validateEmailPolicy(user.getProfile().getEmailAddress());
// register the user
client = newServiceConnection();
client.getEditFunctions().registerUser(client.getConnectedContext(),user);
} finally {