| <?xml version="1.0" encoding="UTF-8"?> |
| <pmd-cpd> |
| <duplication lines="30" tokens="161"> |
| <file line="40" path="/Users/briandemers/dev/source/shiro-1.2.x/samples/guice/src/main/java/org/apache/shiro/samples/guice/SampleShiroNativeSessionsServletModule.java"/> |
| <file line="41" path="/Users/briandemers/dev/source/shiro-1.2.x/samples/guice/src/main/java/org/apache/shiro/samples/guice/SampleShiroServletModule.java"/> |
| <codefragment> |
| <![CDATA[ |
| public SampleShiroServletModule(ServletContext servletContext) { |
| super(servletContext); |
| |
| this.servletContext = servletContext; |
| } |
| |
| @Override |
| protected void configureShiroWeb() { |
| bindConstant().annotatedWith(Names.named("shiro.loginUrl")).to("/login.jsp"); |
| try { |
| this.bindRealm().toConstructor(IniRealm.class.getConstructor(Ini.class)); |
| } catch (NoSuchMethodException e) { |
| addError("Could not locate proper constructor for IniRealm.", e); |
| } |
| |
| this.addFilterChain("/login.jsp", AUTHC); |
| this.addFilterChain("/logout", LOGOUT); |
| this.addFilterChain("/account/**", AUTHC); |
| this.addFilterChain("/remoting/**", AUTHC, config(ROLES, "b2bClient"), config(PERMS, "remote:invoke:lan,wan")); |
| } |
| |
| @Provides |
| @Singleton |
| Ini loadShiroIni() throws MalformedURLException { |
| URL iniUrl = servletContext.getResource("/WEB-INF/shiro.ini"); |
| return Ini.fromResourcePath("url:" + iniUrl.toExternalForm()); |
| } |
| |
| @Override |
| protected void bindWebSecurityManager(AnnotatedBindingBuilder<? super WebSecurityManager> bind) |
| ]]> |
| </codefragment> |
| </duplication> |
| </pmd-cpd> |