Re: troubles using JAASRealm with SecurityFilter

Matthew Hixson <[email protected]> Thu, 31 Jul 2008 11:28:26 -0700
Newsgroups gmane.comp.java.securityfilter.user
Message-ID <[email protected]>
On Jul 31, 2008, at 6:58 AM, Christopher Schultz wrote:

> Matt,
>
> Matthew Hixson wrote:
>> Without catalina.jar in my WEB-INF/lib I can view any of the non-  
>> protected pages.  There's nothing wrong until I try to login.
> >
>> With catalina.jar in my WEB-INF/lib I can't view any of the site.    
>> Going to the front page (which does not require you to login) gives  
>> me  a Tomcat HTTP Status 500 error page with:
>> java.lang.ClassCastException:   
>> org.apache.catalina.util.DefaultAnnotationProcessor
>
> That's a little weird -- I wouldn't imagine that the JSP processor  
> would need to observe the Realm or anything like that. It's possible  
> that it's unrelated, but not likely.

It is definitely related, but I have no idea how.

>
> I would stick to /not/ putting catalina.jar into your webapp's WEB- 
> INF/lib directory.

Agreed.

>
> The problem is that the Realm being used is not getting its  
> "Container" set. The CatalinaRealmAdaptor (the sf realm that wraps  
> Tomcat's realms) does not set that component on the wrapped realm.  
> My guess is that when the adapter class was written, that step was  
> unnecessary, and that most people either abandon sf when it doesn't  
> work, or write their own realms (as I did).
>
> Are you willing to do some sf hacking and recompiling? If so, take a  
> look at CatalinaRealmAdapter.java -- it's very short. You'll have to  
> call Realm.setContainer and pass-in the Container from Tomcat. Who  
> knows... maybe it doesn't even require the "real" container that is  
> actually running -- although using the currently-running container  
> would be ideal.

Yeah, I was wondering if a reference to the container could just be  
done later in the startup process, but didn't know from where to  
obtain a reference to it.

>
> I'll ask over on the TC list about the Container and how to get it  
> properly.
>
> Oh, one more thing -- which version of sf are you using? Honestly,  
> the best version to use is the latest cvs HEAD, which has some nice  
> new features and is still quite stable.

I'm using 2.0 downloaded from the sourceforge page.
   -M@

-------------------------------------------------------------------------
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=/