I tried testing the POP3Authenticator and I also can't get it to work. It 
gives me this error when I try to login:

The authentication 
driver 'net.sf.basedb.core.authentication.POP3Authenticator' could not be 
loaded. The error message is: null

I compiled the POP3Authenticator, put the .jar file in 
<basedir>/www/WEB-INF/lib and uncommented the auth.driver line in the default 
base.config file.

I think this is the only problem now. I've been able to compile my 
LDAPAuthenticator with a different package name (I'm using 
just 'authentication' now), but I'm missing something when I try to tell Base 
to use an authentication module.

Can you figure out what may be wrong? I'm attaching my latest 
LDAPAuthenticator.java 

- Paulo

 

That seems to be the only 

On Wednesday 13 August 2008 13:17, Nicklas Nordborg wrote:
> Paulo Almeida wrote:
> > Hi,
> >
> > Sorry, I sent an e-mail earlier but I realized I couldn't compile the
> > Authenticator because I was using a binary release instead of the source.
> > Now it compiles, but do I have to compile all of Base to make use of the
> > authentication plugin?
>
> You shouldn't need the BASE source code to compile you class. You just
> need to reference the BASE2Core.jar file (and possible some other BASE
> jar files) on your class path. Those JAR files are found in the
> <basedir>/www/WEB-INF/lib directory.
>
> If you are using Ant for compilation and building it should be possible
> for you to organize code and stuff in the same structure as described
> in:
> http://base.thep.lu.se/chrome/site/latest/html/developerdoc/plugin_develope
>r/plugin_developer.organize.html
>
> Ignore any information about the "plug-in installation wizard" and
> MANIFEST.MF file since that is not applicable for this type of plug-in.
>
> I also recommend that you put your code in a package that is not
> "net.sf.basedb.core.authentication".
>
> After you have compiled your code you should put the JAR file together
> with the other JAR files in the <basedir>/www/WEB-INF/lib directory.
> Don't forget to also put any JAR files you require for the LDAP
> authentication in the same directory. Then, restart your BASE server and
> check if it is working.
>
> /Nicklas
>
> > 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_devel
> >>ope 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]
> >
> > -------------------------------------------------------------------------
> > 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]
>
> -------------------------------------------------------------------------
> 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 authentication;

import net.sf.basedb.core.authentication.*;

import javax.naming.*;
import javax.naming.directory.*;
import java.util.Hashtable;

/**
	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
{
	void main(){
	}
	/**
		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]

Reply via email to