On Thu, Dec 8, 2011 at 8:05 PM, csckid <testnowsh...@gmail.com> wrote: > I am trying to configure my tapestry project with tapestry-security, but > couldn't connect them. Right now I just want try it out with simple login > page. Roles user name and password will come from the database. > Is there any simple tutorial just for this?
shiro-users.properties is for a properties realm (i.e. that's your simple "user database"). You want a custom realm for your database model, something like: http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java (you can safely ignore all the federated stuff in your use case). There are several links to this example from the main documentation page at http://tynamo.org/tapestry-security+guide. Kalle > > This is what I have done so far: > *SignIn.tml* > <html t:type="layout" title="Login" > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" > xmlns:p="tapestry:parameter"> > <t:security.loginform /> > </html> > > SignIn.java > public class Signin { > @Inject > private SecurityService securityService; > > @Inject > private ApplicationStateManager applicationStateManager; > > void onActivate() { > if (securityService.getSubject().isAuthenticated() ) { > //CurrentUser currentUser = > applicationStateManager.get(CurrentUser.class); > > //currentUser.merge(securityService.getSubject().getPrincipal()); > } > > } > } > > AppModule.java > > public static void contributeWebSecurityManager(Configuration<Realm> > configuration) { > ExtendedPropertiesRealm realm = new > ExtendedPropertiesRealm("classpath:shiro-users.properties"); > configuration.add(realm); > } > public static void contributeFactoryDefaults(MappedConfiguration<String, > String> > configuration) > { > > configuration.override(SecuritySymbols.LOGIN_URL, "/signin"); > > > } > public static void contributeWebSecurityManager(Configuration<Realm> > configuration, @Inject AuthorizingRealm realm) > { > configuration.add(realm); > } > > public static void contributeSecurityRequestFilter( > OrderedConfiguration<FilterChainDefinition> configuration) > { > configuration.add("index-anon", new FilterChainDefinition("/index", > "anon")); > configuration.add("signup-anon", new FilterChainDefinition("/signup", > "anon")); > configuration.add("signin-anon", new FilterChainDefinition("/signin", > "anon")); > } > > * > shiro-users.properties* > //I really don't know what to write here > user.localuser = local, admin > role.admin = user:view > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/tapestry-security-shiro-tp5060704p5060704.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org