Hi Al - this looks very cool. Thanks for sharing!
On Tue, Mar 9, 2010 at 12:02 PM, aloleary <[email protected]> wrote: > > Hello, > I have just wired up Shiro using Spring JavaConfig (no xml - Spring > 3.0.1)... > > This is how it looks: > > NOTE: Change the realm to your own - I just have a simple PIN based security > realm for my app > > If anyone spots any issues/improvements let me know > > @Configuration > public class SecurityConfig { > > �...@bean > public PinAccountRealm pinAccountRealm(){ > return new PinAccountRealm(); > } > > �...@bean > public SecurityManager securityManager(){ > DefaultSecurityManager securityManager = new > DefaultSecurityManager(); > securityManager.setRealm(pinAccountRealm()); > return securityManager; > } > > �...@bean > public LifecycleBeanPostProcessor lifecycleBeanPostProcessor(){ > return new LifecycleBeanPostProcessor(); > } > > �...@bean > public MethodInvokingFactoryBean methodInvokingFactoryBean(){ > MethodInvokingFactoryBean methodInvokingFactoryBean = new > MethodInvokingFactoryBean(); > > methodInvokingFactoryBean.setStaticMethod("org.apache.shiro.SecurityUtils.setSecurityManager"); > methodInvokingFactoryBean.setArguments(new > Object[]{securityManager()}); > > return methodInvokingFactoryBean; > } > > �...@bean > �...@dependson(value="lifecycleBeanPostProcessor") > public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator(){ > return new DefaultAdvisorAutoProxyCreator(); > } > > �...@bean > public AuthorizationAttributeSourceAdvisor > authorizationAttributeSourceAdvisor(){ > AuthorizationAttributeSourceAdvisor > authorizationAttributeSourceAdvisor = > new AuthorizationAttributeSourceAdvisor(); > > authorizationAttributeSourceAdvisor.setSecurityManager(securityManager()); > return authorizationAttributeSourceAdvisor; > } > -- > View this message in context: > http://n2.nabble.com/Spring-JavaConfig-tp4704383p4704383.html > Sent from the Shiro User mailing list archive at Nabble.com. >
