Hi! I got shiro + guice (+vaadin) working togheter ... so now I'm able to get
annotations in my vaadin view.
Before guice, I was simply using shiro for auth via ldap, configuring my
shiro.ini.
Now I'm not able to use shiro.ini to get my shiro configs... the
authentication process looks for users in ini file, where I want it get ldap
configuration from file, retrieving info from LDAP and the retrieving roles
by ldap user group (in my ini file).
So this is my ini:

[main]
contextFactory = org.apache.shiro.realm.ldap.JndiLdapContextFactory 
contextFactory.url = ldap://ldap.forumsys.com:389

activeDirectoryRealm =mmm.aa.com.LdapAuth
activeDirectoryRealm.ldapContextFactory = $contextFactory 
activeDirectoryRealm.searchBase = "dc=example,dc=com" 
activeDirectoryRealm.groupRolesMap =
"ou=scientists,dc=example,dc=com":"Editor"
#rolePermissionResolver = shiro.IniRealmRolePermissionResolver
rolePermissionResolver = =mmm.aa.com.IniRealmRolePermissionResolver
rolePermissionResolver.ini = $iniRealm
activeDirectoryRealm.rolePermissionResolver = $rolePermissionResolver

[roles]
# 'admin' role has all permissions, indicated by the wildcard '*'
Admin = *
Editor = *


Now with guice  in my ShiroModule how can I configure realm? Where am I
wrong?

Here the code

public class MyShiroModule extends ShiroWebModule {

    private static Logger log =
LoggerFactory.getLogger(MyShiroModule.class);

    @Inject
    public MyShiroModule(ServletContext servletContext) {
        super(servletContext);

    }


    /*  public MyShiroModule(ServletContext servletContext) {
     super(servletContext);
     }
     */

    /* @Override
     protected void configureShiro() {
     try {
     bindRealm().toConstructor(IniRealm.class.getConstructor(Ini.class));
     } catch (NoSuchMethodException e) {
     log.error("ERRORRRE");
     }
     }
     */
    @Provides
    @Singleton
    Ini loadShiroIni() {
        return Ini.fromResourcePath("classpath:shiro.ini");
    }

    @Override
    protected void configureShiroWeb() {
        try {   
   
           
bindRealm().toConstructor(IniRealm.class.getConstructor(Ini.class));
        //    bind(AssegnazionePODMassivoView.class);
        } catch (NoSuchMethodException e) {
            log.error("ERRORRRE");
        }
 
             Factory<org.apache.shiro.mgt.SecurityManager> factory = new  
IniSecurityManagerFactory("classpath:shiro.ini");
       final org.apache.shiro.mgt.SecurityManager securityManager =
factory.getInstance();
     
        SecurityUtils.setSecurityManager(securityManager);
    }

}


Thanks a lot!





--
View this message in context: 
http://shiro-user.582556.n2.nabble.com/Shiro-Guice-tp7580965.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to