On Mon, Oct 20, 2014 at 2:22 AM, Dan Haywood
<[email protected]> wrote:
>
> On 20 October 2014 05:22, Waypoint D <[email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:
>
> > Greetings,
> >
> >
> Hi John,
> welcome to the Isis mailing list.
Thank you.
>
> > I am trying to build a webapp which uses apache shiro and google
> > guice. I have been following a [1] tutorial, but cannot seem to get code
> > to compile with the realm I need to use. In particular, I am not sure what
> > to supply for the following sections of code (which has been edited for
> > readability)...
> >
> >
> I presume you're building an Isis webapp, in which case the bootstrapping
> is taken care of for you. Isis already integrates with Shiro, and the
> WEB-INF/shiro.ini file is the one that is read from. There should be no
> need to build your own Guice module.
I am building a general webapp which only uses the ldap classes from
the shiro-security module within apache isis. So I am literally only
compiling against 3 java files within the entire apache isis project.
I use IsisLdapRealm for its functionality to map ldap groups to shiro
roles (which JndiLdapRealm does not do).
However, I must use Guice within my project for dependency reasons;
otherwise yes, you are correct, when I follow the example webapp which
does not use guice, the shiro.ini file is loaded with all of my
configuration settings.
I went from a web.xml file containing
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
to one that looked like this
<listener-class>bigbank.guice.BootstrapListener</listener-class>
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
and now i have lost whatever EnvironmentLoaderListener was doing to
automagically load shiro.ini. I am left to either load the shiro.ini
file inside of configureShiroWeb() or set the configuration options at
runtime, but i am not sure how to accomplish either.
John
> You might want to check out the new isis-module-security [1] add-on [2],
> which provides an out-of-the-box realm for pluggable authentication and
> also authorization.
Thank you, although these modules appear to only support isis webapps,
which my project does not leverage.
> If the above doesn't fit, let us know a bit more what you're wanting to
> do...
>
> Cheers
> Dan
>
> [1] https://github.com/isisaddons/isis-module-security
> [2] http://www.isisaddons.org/
>
>
>
> > *file:BigBankShiroWebModule.java*
> > public class BigBankShiroWebModule extends ShiroWebModule {
> > protected void configureShiroWeb() {
> > bindRealm().toConstructor( IniRealm.class.getConstructor(
> > Ini.class ) );
> > }
> > Ini loadShiroIni() {
> > return Ini.fromResourcePath( "classpath:shiro.ini" );
> > }
> >
> > I have tried to replace *IniRealm *with *IsisLdapRealm *or
> > *JndiLdapRealm *which
> > seems to work to a degree, but they wont load my *shiro.ini* file since
> > those realms don't implement the *Ini *class. Since the realm I need to
> > use does not support ini files, how can I configure the realm?
> >
> > Help is appreciated more than you know!
> > - John
> >
> >
> > *Web link appendix* [1] Add an example for using Guice integration.
> > https://issues.apache.org/jira/browse/SHIRO-320
> >