views:

305

answers:

1

Hello all,

I've been recently working on a JBoss Seam project (v2.1.1) where I want to autheticate against LDAP/AD and store premissions in a custom DB schema.

The documentation states that this is possible and I saw a text-book example that doesn't work for me since the DB schema is managed by Hibernate. Has anyone out there done something similar? Can anyone provide a good example?

Thanks in advance. --ctopete

A: 

I've personally developed a solution like this. I've used jCifs to authenticate all the users through NTLM, and then use the username/domain pair to load roles and permissions from a custom database.

jCifs is super easy to configure, just set these filters in your web.xml: http://jcifs.samba.org/src/docs/ntlmhttpauth.html

then in your Authenticator class, in the authenticate() method use these to read username and domain:

@Name("authenticator")
public class Authenticator {

    @In
    Context sessionContext;

    ...

    public boolean authenticate() {

        String username = ((NtlmPasswordAuthentication) sessionContext.get("NtlmHttpAuth")).getUsername();
        String domain = ((NtlmPasswordAuthentication) sessionContext.get("NtlmHttpAuth")).getDomain();

    ...

    }
Luke