Hi,
Thanks for the information, that was very helpful. Now I have a problem that
may belong in a basic Java forum rather than this one, but perhaps it can be
useful to someone trying to use LDAP with Base.
I have written a standalone Java program that authenticates to my LDAP server
and it works. I have tried to put it inside the SimpleAuthenticator example
you have, commenting out the part that does the authentication and replacing
it with my code. I know I have to change the base.config to reference that
file, but where should I put the file? I tried to use the POP3Authenticator
as an example, but I couldn't find the POP3Authenticator file anywhere other
than in the 'doc' directory.
I haven't been able to run my LDAP authenticator in the console because it
gives me "cannot find symbol" errors (I suppose it can't find
net.sf.basedb.core.authentication , but I don't know how to tell it where it
is, and actually I don't even know where it is, after trying to find it in
the base directory).
(I'm attaching the modified SimpleAuthenticator.java)
Thanks,
Paulo
On Monday 11 August 2008 21:20, Nicklas Nordborg wrote:
> > Hi,
> >
> > Is there a way to integrate Base authentication with an existing LDAP or
> > Kerberos server, or a different centralized solution? If not, are there
> > plans
> > for something like that? Do you think it would be complex to go to the
> > source
> > and implement an LDAP lookup function at login? (I am thinking it would
> > be a
> > matter of doing the lookup and if it is successful, everything proceeds
> > as if
> > it were a local user; the only problem may be that you have to create the
> > user locally if he does not exist).
>
> Yes, this should be possible. BASE includes a plug-in mechanism for
> authentication. Documentation is available at
> http://base.thep.lu.se/chrome/site/latest/html/developerdoc/plugin_develope
>r/plugin_developer.other.html#plugin_developer.other.authentication
>
> /Nicklas
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge Build the coolest Linux based applications with Moblin SDK & win
> great prizes Grand prize is a trip for two to an Open Source event anywhere
> in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> The BASE general discussion mailing list
> basedb-users@lists.sourceforge.net
> unsubscribe: send a mail with subject "unsubscribe" to
> [EMAIL PROTECTED]
/*
$Id$
Copyright (C) 2005 Samuel Andersson, Nicklas Nordborg
Copyright (C) 2006 Jari Hakkinen
This file is part of BASE - BioArray Software Environment.
Available at http://base.thep.lu.se/
BASE is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
BASE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
package net.sf.basedb.core.authentication;
/**
This class is an example implementation of the [EMAIL PROTECTED] Authenticator}
interface that authenticates everyone as long as the login is the same
as the password. This class should of course never be used in a real
environment.
@author Nicklas
@version 2.0
@base.modified $Date$
*/
public class LDAPAuthenticator
implements Authenticator
{
/**
Create a new <code>SimpleAuthenticator</code> object.
*/
public LDAPAuthenticator()
{
super();
}
/**
There is nothing to initialise.
*/
public void init(String settings)
throws AuthenticationException
{}
/**
Always return FALSE.
*/
public boolean supportsExtraInformation()
{
return false;
}
/**
If login and password are equal the user is authenticated, otherwise an
[EMAIL PROTECTED] InvalidPasswordException} is thrown.
*/
public AuthenticationInformation authenticate(String login, String password)
throws UnknownLoginException, InvalidPasswordException, AuthenticationException
/*{
if (login == null || !login.equals(password))
{
throw new InvalidPasswordException(login, "Password must be equal to login");
}
return new AuthenticationInformation(login, login);
}*/
{
// Set up environment for creating initial context
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://ldap.igc.gulbenkian.pt:389/");
// Authenticate as S. User and password "mysecret"
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "uid="+login+",cn=users,dc=igc,dc=gulbenkian,dc=pt");
env.put(Context.SECURITY_CREDENTIALS, password);
try {
// Create initial context
DirContext ctx = new InitialDirContext(env);
// do something useful with ctx
// Change to using no authentication
// do something useful with ctx
// Close the context when we're done
ctx.close();
} catch (NamingException e) {
e.printStackTrace();
}
return new AuthenticationInformation(login, login);
}
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
The BASE general discussion mailing list
basedb-users@lists.sourceforge.net
unsubscribe: send a mail with subject "unsubscribe" to
[EMAIL PROTECTED]