You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by D Tim Cummings <ti...@triptera.com.au> on 2014/08/05 03:42:28 UTC
tapestry-security looking for sample code
I am having a look at the tapestry-security guide at http://tynamo.org/tapestry-security+guide and several of the links are broken
Hibernate-based entity realm (service) points to http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java (404 Not found)
User entity used by the realm sample referred to above points to http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java (404 Not found)
tapestry-exceptionpage points to the tapestry-security guide page that we are reading.
full-featured integration test web app should probably point to github https://github.com/tynamo/tapestry-security/tree/master/src/test/java/org/tynamo/security/testapp
template should probably point to github https://github.com/tynamo/tapestry-security/blob/master/src/test/resources/org/tynamo/security/testapp/pages/Index.tml
class should probably point to github https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/pages/Index.java
AlphaService should probably point to github https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/services/AlphaService.java
http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts should probably point to github https://github.com/tynamo/tynamo-example-federatedaccounts
AppModule should probably point to github https://github.com/tynamo/tynamo-example-federatedaccounts/blob/master/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java
I am really looking for sample code of an implementation of tapestry-security with Cayenne (or Hibernate) using Tapestry 5.3.7, tapestry-security 0.5.1. I don't need federated accounts at this stage.
Regards
Tim
Re: tapestry-security looking for sample code
Posted by D Tim Cummings <ti...@triptera.com.au>.
Thanks Chris
This is really helpful. Getting an error that I can't parse hibernate.cfg.xml at the moment but I should be able to work it out.
Tim
On 5 Aug 2014, at 12:27, Chris Mylonas <ch...@opencsta.org> wrote:
> And here's some notes from my wiki for a tapestry-security file based auth
> and hibernate for entities.
> I'm also in +10 timezone down in Sydney - so the replies will come later in
> the day usually :)
>
> Skeleton
>
> - Create quickstart tapestry archetype
>
> [edit
> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=2>
> ]Change dependencies
>
> - Add in these dependencies replacing tapestry-core
>
> <dependency>
> <groupId>org.apache.tapestry</groupId>
> <artifactId>tapestry-hibernate</artifactId>
> <version>5.3.7</version>
> </dependency>
> <dependency>
> <groupId>org.tynamo</groupId>
> <artifactId>tapestry-security</artifactId>
> <version>0.5.1</version>
> </dependency>
> <dependency>
> <groupId>hsqldb</groupId>
> <artifactId>hsqldb</artifactId>
> <version>1.8.0.7</version>
> </dependency>
> <dependency>
> <groupId>org.got5</groupId>
> <artifactId>tapestry5-jquery</artifactId>
> <version>3.3.7</version>
> </dependency>
>
>
> ...
> <repository>
> <id>devlab722-repo</id>
> <url>http://nexus.devlab722.net/nexus/content/repositories/releases
> </url>
> <snapshots>
> <enabled>false</enabled>
> </snapshots>
> </repository>
>
> <repository>
> <id>devlab722-snapshot-repo</id>
> <url>http://nexus.devlab722.net/nexus/content/repositories/snapshots
> </url>
> <releases>
> <enabled>false</enabled>
> </releases>
> </repository>
> ...
>
>
>
>
> - Running in jetty at this stage will yield this error in the browser
>
> HTTP ERROR 500
>
> Problem accessing /TapestryHibernateSecurity/. Reason:
>
> Exception constructing service 'WebSecurityManager': Error
> invoking constructor public
> org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection):
> Realms collection argument cannot be empty.
>
> Caused by:
>
> java.lang.RuntimeException: Exception constructing service
> 'WebSecurityManager': Error invoking constructor public
> org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection):
> Realms collection argument cannot be empty.
> at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
>
>
> Because Tapestry has an IoC container that does dependency injection, each
> service tapetry uses needs to be configured within a module. The default
> place for application specific services to be set up is in AppModule.
> [edit
> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=3>
> ]Add realm to security service
>
> So we need to contribute some web security manager realm info by adding a
> realm.
>
> - Add websecuritymanager realm into AppModule
>
> ...
> import org.tynamo.shiro.extension.realm.text.ExtendedPropertiesRealm;
> import org.apache.shiro.realm.Realm;
> import org.apache.shiro.web.mgt.WebSecurityManager;
> ...
>
> @Contribute(WebSecurityManager.class)
> public static void addRealms(Configuration<Realm> configuration) {
> ExtendedPropertiesRealm realm = new
> ExtendedPropertiesRealm("classpath:shiro-users.properties");
> configuration.add(realm);
> }
>
> [edit
> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=4>
> ]Shiro users properties
>
> And also add shiro-users.properties to the classpath (src/main/resources)
>
> touch srm/main/resources/shiro-users.properties
>
>
> - Firing up application now yields hibernate errors.
>
> HTTP ERROR 500
>
> Problem accessing /TapestryHibernateSecurity/. Reason:
>
> java.lang.RuntimeException: Exception constructing service
> 'ValueEncoderSource': Error invoking service contribution method
> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
> LoggerSource): Exception constructing service
> 'HibernateSessionSource': Error invoking constructor public
> org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List):
> /hibernate.cfg.xml not found
>
> Caused by:
>
> org.apache.shiro.subject.ExecutionException:
> java.lang.RuntimeException: Exception constructing service
> 'ValueEncoderSource': Error invoking service contribution method
> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
> LoggerSource): Exception constructing service
> 'HibernateSessionSource': Error invoking constructor public
> org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List):
> /hibernate.cfg.xml not found
> at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:382)
>
>
> [edit
> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=5>
> ]add in the hibernate configuration
>
> - Add hibernate configuration for derby db
>
> src/main/resources/hibernate.cfg.xml
> <!DOCTYPE hibernate-configuration PUBLIC
> "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
> <hibernate-configuration>
> <session-factory>
> <property
> name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
> <property
> name="hibernate.connection.url">jdbc:hsqldb:./target/work/t5hibernatesecurity;shutdown=true</property>
> <property
> name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
> <property name="hibernate.connection.username">sa</property>
> <property name="hibernate.connection.password"></property>
> <property name="hbm2ddl.auto">update</property>
> <property name="hibernate.show_sql">true</property>
> <property name="hibernate.format_sql">true</property>
> </session-factory>
> </hibernate-configuration>
>
>
>
>
>
>
>
> On Tue, Aug 5, 2014 at 12:19 PM, Chris Mylonas <ch...@opencsta.org> wrote:
>
>> Hi Tim,
>>
>> I had sample code in a repo I was making a variations project to split
>> hairs on how to do the same thing using different ways.
>>
>> Unforch that repo was lost by a VPS provider although I have the latest
>> got tree it is def not share-able ATM.
>>
>> Do a Google search for "github eloquentia Thiago tapestry" and you'll find
>> thiago's excellent sample to get you going from a file based thing to
>> database.
>>
>> Eloquentia may use nosql but you will be able to work it out - I did and
>> I'm by far nowhere in the league of others on the list :)
>>
>> HTH
>> Chris
>> On 05/08/2014 11:43 am, "D Tim Cummings" <ti...@triptera.com.au> wrote:
>>
>>> I am having a look at the tapestry-security guide at
>>> http://tynamo.org/tapestry-security+guide and several of the links are
>>> broken
>>>
>>> Hibernate-based entity realm (service)
>>> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java> points
>>> to
>>> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java
>>> (404 Not found)
>>>
>>> User entity used by the realm sample referred to above
>>> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java> points
>>> to
>>> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java
>>> (404 Not found)
>>>
>>> tapestry-exceptionpage <http://tynamo.org/tapestry-security+guide> points
>>> to the tapestry-security guide page that we are reading.
>>>
>>> full-featured integration test web app
>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/> should
>>> probably point to github
>>> https://github.com/tynamo/tapestry-security/tree/master/src/test/java/org/tynamo/security/testapp
>>>
>>> template
>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/resources/org/tynamo/security/testapp/pages/Index.tml> should
>>> probably point to github
>>> https://github.com/tynamo/tapestry-security/blob/master/src/test/resources/org/tynamo/security/testapp/pages/Index.tml
>>>
>>> class
>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/pages/Index.java> should
>>> probably point to github
>>> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/pages/Index.java
>>>
>>> AlphaService
>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/services/AlphaService.java> should
>>> probably point to github
>>> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/services/AlphaService.java
>>>
>>> http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts should
>>> probably point to github
>>> https://github.com/tynamo/tynamo-example-federatedaccounts
>>>
>>> AppModule
>>> <http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java> should
>>> probably point to github
>>> https://github.com/tynamo/tynamo-example-federatedaccounts/blob/master/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java
>>>
>>>
>>>
>>> I am really looking for sample code of an implementation of
>>> tapestry-security with Cayenne (or Hibernate) using Tapestry 5.3.7,
>>> tapestry-security 0.5.1. I don't need federated accounts at this stage.
>>>
>>>
>>>
>>> Regards
>>>
>>> Tim
>>>
>>
Re: tapestry-security looking for sample code
Posted by Chris Mylonas <ch...@opencsta.org>.
Oh yeah....hibernate cfg file I put those spaces in cos of parsing
problems. Sorry about that - I will note it for the next sucker :P
Will fix/note the other.
Happy it gave some direction. I've gotta thank Thiago for his sample
application, that paved the way for me to get a leg up on things.
There's loads to check out from others on this list that with time will
come in useful.
Cheers
Chris
On 05/08/2014 4:24 pm, "D Tim Cummings" <ti...@triptera.com.au> wrote:
> Hi Chris
>
> Your blog post has a couple of errors probably caused by copying and
> pasting out of email.
>
> In your pom.xml your repository configuration has <a href=""> tags around
> the urls
> Your hibernate.cfg.xml has spaces around the double slashes in the DOCTYPE.
> "http: // hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
> should be "
> http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
>
> Little things but they took me a while to find. :)
>
> Tim
>
>
>
> On 5 Aug 2014, at 12:51, Chris Mylonas <ch...@opencsta.org> wrote:
>
> Blog entry from previous reply seeing as it is out in the ether now :)
> Sorry for spamming list
>
> http://www.mrvoip.com.au/blog/tapestry-security-howto-notes
>
> Chris
>
>
> On Tue, Aug 5, 2014 at 12:27 PM, Chris Mylonas <ch...@opencsta.org> wrote:
>
> And here's some notes from my wiki for a tapestry-security file based auth
> and hibernate for entities.
> I'm also in +10 timezone down in Sydney - so the replies will come later
> in the day usually :)
>
> Skeleton
>
> - Create quickstart tapestry archetype
>
> [edit
> <
> https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=2
> >
> ]Change dependencies
>
> - Add in these dependencies replacing tapestry-core
>
> <dependency>
> <groupId>org.apache.tapestry</groupId>
> <artifactId>tapestry-hibernate</artifactId>
> <version>5.3.7</version>
> </dependency>
> <dependency>
> <groupId>org.tynamo</groupId>
> <artifactId>tapestry-security</artifactId>
> <version>0.5.1</version>
> </dependency>
> <dependency>
> <groupId>hsqldb</groupId>
> <artifactId>hsqldb</artifactId>
> <version>1.8.0.7</version>
> </dependency>
> <dependency>
> <groupId>org.got5</groupId>
> <artifactId>tapestry5-jquery</artifactId>
> <version>3.3.7</version>
> </dependency>
>
>
> ...
> <repository>
> <id>devlab722-repo</id>
> <url>http://nexus.devlab722.net/nexus/content/repositories/releases
> </url>
> <snapshots>
> <enabled>false</enabled>
> </snapshots>
> </repository>
>
> <repository>
> <id>devlab722-snapshot-repo</id>
> <url>
> http://nexus.devlab722.net/nexus/content/repositories/snapshots
> </url>
> <releases>
> <enabled>false</enabled>
> </releases>
> </repository>
> ...
>
>
>
>
> - Running in jetty at this stage will yield this error in the browser
>
> HTTP ERROR 500
>
> Problem accessing /TapestryHibernateSecurity/. Reason:
>
> Exception constructing service 'WebSecurityManager': Error invoking
> constructor public
> org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection):
> Realms collection argument cannot be empty.
>
> Caused by:
>
> java.lang.RuntimeException: Exception constructing service
> 'WebSecurityManager': Error invoking constructor public
> org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection):
> Realms collection argument cannot be empty.
> at
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
>
>
> Because Tapestry has an IoC container that does dependency injection, each
> service tapetry uses needs to be configured within a module. The default
> place for application specific services to be set up is in AppModule.
> [edit
> <
> https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=3
> >
> ]Add realm to security service
>
> So we need to contribute some web security manager realm info by adding a
> realm.
>
> - Add websecuritymanager realm into AppModule
>
> ...
> import org.tynamo.shiro.extension.realm.text.ExtendedPropertiesRealm;
> import org.apache.shiro.realm.Realm;
> import org.apache.shiro.web.mgt.WebSecurityManager;
> ...
>
> @Contribute(WebSecurityManager.class)
> public static void addRealms(Configuration<Realm> configuration) {
> ExtendedPropertiesRealm realm = new
> ExtendedPropertiesRealm("classpath:shiro-users.properties");
> configuration.add(realm);
> }
>
> [edit
> <
> https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=4
> >
> ]Shiro users properties
>
> And also add shiro-users.properties to the classpath (src/main/resources)
>
> touch srm/main/resources/shiro-users.properties
>
>
> - Firing up application now yields hibernate errors.
>
> HTTP ERROR 500
>
> Problem accessing /TapestryHibernateSecurity/. Reason:
>
> java.lang.RuntimeException: Exception constructing service
> 'ValueEncoderSource': Error invoking service contribution method
> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
> LoggerSource): Exception constructing service 'HibernateSessionSource':
> Error invoking constructor public
> org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List):
> /hibernate.cfg.xml not found
>
> Caused by:
>
> org.apache.shiro.subject.ExecutionException: java.lang.RuntimeException:
> Exception constructing service 'ValueEncoderSource': Error invoking service
> contribution method
> org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
> boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
> LoggerSource): Exception constructing service 'HibernateSessionSource':
> Error invoking constructor public
> org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List):
> /hibernate.cfg.xml not found
> at
> org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:382)
>
>
> [edit
> <
> https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=5
> >
> ]add in the hibernate configuration
>
> - Add hibernate configuration for derby db
>
> src/main/resources/hibernate.cfg.xml
> <!DOCTYPE hibernate-configuration PUBLIC
> "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
> <hibernate-configuration>
> <session-factory>
> <property
> name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
> <property
> name="hibernate.connection.url">jdbc:hsqldb:./target/work/t5hibernatesecurity;shutdown=true</property>
> <property
> name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
> <property name="hibernate.connection.username">sa</property>
> <property name="hibernate.connection.password"></property>
> <property name="hbm2ddl.auto">update</property>
> <property name="hibernate.show_sql">true</property>
> <property name="hibernate.format_sql">true</property>
> </session-factory>
> </hibernate-configuration>
>
>
>
>
>
>
>
> On Tue, Aug 5, 2014 at 12:19 PM, Chris Mylonas <ch...@opencsta.org> wrote:
>
> Hi Tim,
>
> I had sample code in a repo I was making a variations project to split
> hairs on how to do the same thing using different ways.
>
> Unforch that repo was lost by a VPS provider although I have the latest
> got tree it is def not share-able ATM.
>
> Do a Google search for "github eloquentia Thiago tapestry" and you'll
> find thiago's excellent sample to get you going from a file based thing to
> database.
>
> Eloquentia may use nosql but you will be able to work it out - I did and
> I'm by far nowhere in the league of others on the list :)
>
> HTH
> Chris
> On 05/08/2014 11:43 am, "D Tim Cummings" <ti...@triptera.com.au> wrote:
>
> I am having a look at the tapestry-security guide at
> http://tynamo.org/tapestry-security+guide and several of the links are
> broken
>
> Hibernate-based entity realm (service)
> <
> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java>
> points
> to
>
> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java
> (404 Not found)
>
> User entity used by the realm sample referred to above
> <
> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java>
> points
> to
>
> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java
> (404 Not found)
>
> tapestry-exceptionpage <http://tynamo.org/tapestry-security+guide> points
> to the tapestry-security guide page that we are reading.
>
> full-featured integration test web app
> <
> http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/>
> should
> probably point to github
>
> https://github.com/tynamo/tapestry-security/tree/master/src/test/java/org/tynamo/security/testapp
>
> template
> <
> http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/resources/org/tynamo/security/testapp/pages/Index.tml>
> should
> probably point to github
>
> https://github.com/tynamo/tapestry-security/blob/master/src/test/resources/org/tynamo/security/testapp/pages/Index.tml
>
> class
> <
> http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/pages/Index.java>
> should
> probably point to github
>
> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/pages/Index.java
>
> AlphaService
> <
> http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/services/AlphaService.java>
> should
> probably point to github
>
> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/services/AlphaService.java
>
> http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts
> should
> probably point to github
> https://github.com/tynamo/tynamo-example-federatedaccounts
>
> AppModule
> <
> http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java>
> should
> probably point to github
>
> https://github.com/tynamo/tynamo-example-federatedaccounts/blob/master/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java
>
>
>
> I am really looking for sample code of an implementation of
> tapestry-security with Cayenne (or Hibernate) using Tapestry 5.3.7,
> tapestry-security 0.5.1. I don't need federated accounts at this stage.
>
>
>
> Regards
>
> Tim
>
>
>
>
>
Re: tapestry-security looking for sample code
Posted by D Tim Cummings <ti...@triptera.com.au>.
Hi Chris
Your blog post has a couple of errors probably caused by copying and pasting out of email.
In your pom.xml your repository configuration has <a href=""> tags around the urls
Your hibernate.cfg.xml has spaces around the double slashes in the DOCTYPE.
"http: // hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" should be "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
Little things but they took me a while to find. :)
Tim
On 5 Aug 2014, at 12:51, Chris Mylonas <ch...@opencsta.org> wrote:
> Blog entry from previous reply seeing as it is out in the ether now :)
> Sorry for spamming list
>
> http://www.mrvoip.com.au/blog/tapestry-security-howto-notes
>
> Chris
>
>
> On Tue, Aug 5, 2014 at 12:27 PM, Chris Mylonas <ch...@opencsta.org> wrote:
>
>> And here's some notes from my wiki for a tapestry-security file based auth
>> and hibernate for entities.
>> I'm also in +10 timezone down in Sydney - so the replies will come later
>> in the day usually :)
>>
>> Skeleton
>>
>> - Create quickstart tapestry archetype
>>
>> [edit
>> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=2>
>> ]Change dependencies
>>
>> - Add in these dependencies replacing tapestry-core
>>
>> <dependency>
>> <groupId>org.apache.tapestry</groupId>
>> <artifactId>tapestry-hibernate</artifactId>
>> <version>5.3.7</version>
>> </dependency>
>> <dependency>
>> <groupId>org.tynamo</groupId>
>> <artifactId>tapestry-security</artifactId>
>> <version>0.5.1</version>
>> </dependency>
>> <dependency>
>> <groupId>hsqldb</groupId>
>> <artifactId>hsqldb</artifactId>
>> <version>1.8.0.7</version>
>> </dependency>
>> <dependency>
>> <groupId>org.got5</groupId>
>> <artifactId>tapestry5-jquery</artifactId>
>> <version>3.3.7</version>
>> </dependency>
>>
>>
>> ...
>> <repository>
>> <id>devlab722-repo</id>
>> <url>http://nexus.devlab722.net/nexus/content/repositories/releases
>> </url>
>> <snapshots>
>> <enabled>false</enabled>
>> </snapshots>
>> </repository>
>>
>> <repository>
>> <id>devlab722-snapshot-repo</id>
>> <url>http://nexus.devlab722.net/nexus/content/repositories/snapshots
>> </url>
>> <releases>
>> <enabled>false</enabled>
>> </releases>
>> </repository>
>> ...
>>
>>
>>
>>
>> - Running in jetty at this stage will yield this error in the browser
>>
>> HTTP ERROR 500
>>
>> Problem accessing /TapestryHibernateSecurity/. Reason:
>>
>> Exception constructing service 'WebSecurityManager': Error invoking constructor public org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection): Realms collection argument cannot be empty.
>>
>> Caused by:
>>
>> java.lang.RuntimeException: Exception constructing service 'WebSecurityManager': Error invoking constructor public org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection): Realms collection argument cannot be empty.
>> at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
>>
>>
>> Because Tapestry has an IoC container that does dependency injection, each
>> service tapetry uses needs to be configured within a module. The default
>> place for application specific services to be set up is in AppModule.
>> [edit
>> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=3>
>> ]Add realm to security service
>>
>> So we need to contribute some web security manager realm info by adding a
>> realm.
>>
>> - Add websecuritymanager realm into AppModule
>>
>> ...
>> import org.tynamo.shiro.extension.realm.text.ExtendedPropertiesRealm;
>> import org.apache.shiro.realm.Realm;
>> import org.apache.shiro.web.mgt.WebSecurityManager;
>> ...
>>
>> @Contribute(WebSecurityManager.class)
>> public static void addRealms(Configuration<Realm> configuration) {
>> ExtendedPropertiesRealm realm = new ExtendedPropertiesRealm("classpath:shiro-users.properties");
>> configuration.add(realm);
>> }
>>
>> [edit
>> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=4>
>> ]Shiro users properties
>>
>> And also add shiro-users.properties to the classpath (src/main/resources)
>>
>> touch srm/main/resources/shiro-users.properties
>>
>>
>> - Firing up application now yields hibernate errors.
>>
>> HTTP ERROR 500
>>
>> Problem accessing /TapestryHibernateSecurity/. Reason:
>>
>> java.lang.RuntimeException: Exception constructing service 'ValueEncoderSource': Error invoking service contribution method org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, LoggerSource): Exception constructing service 'HibernateSessionSource': Error invoking constructor public org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List): /hibernate.cfg.xml not found
>>
>> Caused by:
>>
>> org.apache.shiro.subject.ExecutionException: java.lang.RuntimeException: Exception constructing service 'ValueEncoderSource': Error invoking service contribution method org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, LoggerSource): Exception constructing service 'HibernateSessionSource': Error invoking constructor public org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List): /hibernate.cfg.xml not found
>> at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:382)
>>
>>
>> [edit
>> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=5>
>> ]add in the hibernate configuration
>>
>> - Add hibernate configuration for derby db
>>
>> src/main/resources/hibernate.cfg.xml
>> <!DOCTYPE hibernate-configuration PUBLIC
>> "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
>> "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
>> <hibernate-configuration>
>> <session-factory>
>> <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
>> <property name="hibernate.connection.url">jdbc:hsqldb:./target/work/t5hibernatesecurity;shutdown=true</property>
>> <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
>> <property name="hibernate.connection.username">sa</property>
>> <property name="hibernate.connection.password"></property>
>> <property name="hbm2ddl.auto">update</property>
>> <property name="hibernate.show_sql">true</property>
>> <property name="hibernate.format_sql">true</property>
>> </session-factory>
>> </hibernate-configuration>
>>
>>
>>
>>
>>
>>
>>
>> On Tue, Aug 5, 2014 at 12:19 PM, Chris Mylonas <ch...@opencsta.org> wrote:
>>
>>> Hi Tim,
>>>
>>> I had sample code in a repo I was making a variations project to split
>>> hairs on how to do the same thing using different ways.
>>>
>>> Unforch that repo was lost by a VPS provider although I have the latest
>>> got tree it is def not share-able ATM.
>>>
>>> Do a Google search for "github eloquentia Thiago tapestry" and you'll
>>> find thiago's excellent sample to get you going from a file based thing to
>>> database.
>>>
>>> Eloquentia may use nosql but you will be able to work it out - I did and
>>> I'm by far nowhere in the league of others on the list :)
>>>
>>> HTH
>>> Chris
>>> On 05/08/2014 11:43 am, "D Tim Cummings" <ti...@triptera.com.au> wrote:
>>>
>>>> I am having a look at the tapestry-security guide at
>>>> http://tynamo.org/tapestry-security+guide and several of the links are
>>>> broken
>>>>
>>>> Hibernate-based entity realm (service)
>>>> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java> points
>>>> to
>>>> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java
>>>> (404 Not found)
>>>>
>>>> User entity used by the realm sample referred to above
>>>> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java> points
>>>> to
>>>> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java
>>>> (404 Not found)
>>>>
>>>> tapestry-exceptionpage <http://tynamo.org/tapestry-security+guide> points
>>>> to the tapestry-security guide page that we are reading.
>>>>
>>>> full-featured integration test web app
>>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/> should
>>>> probably point to github
>>>> https://github.com/tynamo/tapestry-security/tree/master/src/test/java/org/tynamo/security/testapp
>>>>
>>>> template
>>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/resources/org/tynamo/security/testapp/pages/Index.tml> should
>>>> probably point to github
>>>> https://github.com/tynamo/tapestry-security/blob/master/src/test/resources/org/tynamo/security/testapp/pages/Index.tml
>>>>
>>>> class
>>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/pages/Index.java> should
>>>> probably point to github
>>>> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/pages/Index.java
>>>>
>>>> AlphaService
>>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/services/AlphaService.java> should
>>>> probably point to github
>>>> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/services/AlphaService.java
>>>>
>>>> http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts should
>>>> probably point to github
>>>> https://github.com/tynamo/tynamo-example-federatedaccounts
>>>>
>>>> AppModule
>>>> <http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java> should
>>>> probably point to github
>>>> https://github.com/tynamo/tynamo-example-federatedaccounts/blob/master/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java
>>>>
>>>>
>>>>
>>>> I am really looking for sample code of an implementation of
>>>> tapestry-security with Cayenne (or Hibernate) using Tapestry 5.3.7,
>>>> tapestry-security 0.5.1. I don't need federated accounts at this stage.
>>>>
>>>>
>>>>
>>>> Regards
>>>>
>>>> Tim
>>>>
>>>
>>
Re: tapestry-security looking for sample code
Posted by Chris Mylonas <ch...@opencsta.org>.
Blog entry from previous reply seeing as it is out in the ether now :)
Sorry for spamming list
http://www.mrvoip.com.au/blog/tapestry-security-howto-notes
Chris
On Tue, Aug 5, 2014 at 12:27 PM, Chris Mylonas <ch...@opencsta.org> wrote:
> And here's some notes from my wiki for a tapestry-security file based auth
> and hibernate for entities.
> I'm also in +10 timezone down in Sydney - so the replies will come later
> in the day usually :)
>
> Skeleton
>
> - Create quickstart tapestry archetype
>
> [edit
> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=2>
> ]Change dependencies
>
> - Add in these dependencies replacing tapestry-core
>
> <dependency>
> <groupId>org.apache.tapestry</groupId>
> <artifactId>tapestry-hibernate</artifactId>
> <version>5.3.7</version>
> </dependency>
> <dependency>
> <groupId>org.tynamo</groupId>
> <artifactId>tapestry-security</artifactId>
> <version>0.5.1</version>
> </dependency>
> <dependency>
> <groupId>hsqldb</groupId>
> <artifactId>hsqldb</artifactId>
> <version>1.8.0.7</version>
> </dependency>
> <dependency>
> <groupId>org.got5</groupId>
> <artifactId>tapestry5-jquery</artifactId>
> <version>3.3.7</version>
> </dependency>
>
>
> ...
> <repository>
> <id>devlab722-repo</id>
> <url>http://nexus.devlab722.net/nexus/content/repositories/releases
> </url>
> <snapshots>
> <enabled>false</enabled>
> </snapshots>
> </repository>
>
> <repository>
> <id>devlab722-snapshot-repo</id>
> <url>http://nexus.devlab722.net/nexus/content/repositories/snapshots
> </url>
> <releases>
> <enabled>false</enabled>
> </releases>
> </repository>
> ...
>
>
>
>
> - Running in jetty at this stage will yield this error in the browser
>
> HTTP ERROR 500
>
> Problem accessing /TapestryHibernateSecurity/. Reason:
>
> Exception constructing service 'WebSecurityManager': Error invoking constructor public org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection): Realms collection argument cannot be empty.
>
> Caused by:
>
> java.lang.RuntimeException: Exception constructing service 'WebSecurityManager': Error invoking constructor public org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection): Realms collection argument cannot be empty.
> at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
>
>
> Because Tapestry has an IoC container that does dependency injection, each
> service tapetry uses needs to be configured within a module. The default
> place for application specific services to be set up is in AppModule.
> [edit
> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=3>
> ]Add realm to security service
>
> So we need to contribute some web security manager realm info by adding a
> realm.
>
> - Add websecuritymanager realm into AppModule
>
> ...
> import org.tynamo.shiro.extension.realm.text.ExtendedPropertiesRealm;
> import org.apache.shiro.realm.Realm;
> import org.apache.shiro.web.mgt.WebSecurityManager;
> ...
>
> @Contribute(WebSecurityManager.class)
> public static void addRealms(Configuration<Realm> configuration) {
> ExtendedPropertiesRealm realm = new ExtendedPropertiesRealm("classpath:shiro-users.properties");
> configuration.add(realm);
> }
>
> [edit
> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=4>
> ]Shiro users properties
>
> And also add shiro-users.properties to the classpath (src/main/resources)
>
> touch srm/main/resources/shiro-users.properties
>
>
> - Firing up application now yields hibernate errors.
>
> HTTP ERROR 500
>
> Problem accessing /TapestryHibernateSecurity/. Reason:
>
> java.lang.RuntimeException: Exception constructing service 'ValueEncoderSource': Error invoking service contribution method org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, LoggerSource): Exception constructing service 'HibernateSessionSource': Error invoking constructor public org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List): /hibernate.cfg.xml not found
>
> Caused by:
>
> org.apache.shiro.subject.ExecutionException: java.lang.RuntimeException: Exception constructing service 'ValueEncoderSource': Error invoking service contribution method org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration, boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, LoggerSource): Exception constructing service 'HibernateSessionSource': Error invoking constructor public org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List): /hibernate.cfg.xml not found
> at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:382)
>
>
> [edit
> <https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=5>
> ]add in the hibernate configuration
>
> - Add hibernate configuration for derby db
>
> src/main/resources/hibernate.cfg.xml
> <!DOCTYPE hibernate-configuration PUBLIC
> "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
> <hibernate-configuration>
> <session-factory>
> <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
> <property name="hibernate.connection.url">jdbc:hsqldb:./target/work/t5hibernatesecurity;shutdown=true</property>
> <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
> <property name="hibernate.connection.username">sa</property>
> <property name="hibernate.connection.password"></property>
> <property name="hbm2ddl.auto">update</property>
> <property name="hibernate.show_sql">true</property>
> <property name="hibernate.format_sql">true</property>
> </session-factory>
> </hibernate-configuration>
>
>
>
>
>
>
>
> On Tue, Aug 5, 2014 at 12:19 PM, Chris Mylonas <ch...@opencsta.org> wrote:
>
>> Hi Tim,
>>
>> I had sample code in a repo I was making a variations project to split
>> hairs on how to do the same thing using different ways.
>>
>> Unforch that repo was lost by a VPS provider although I have the latest
>> got tree it is def not share-able ATM.
>>
>> Do a Google search for "github eloquentia Thiago tapestry" and you'll
>> find thiago's excellent sample to get you going from a file based thing to
>> database.
>>
>> Eloquentia may use nosql but you will be able to work it out - I did and
>> I'm by far nowhere in the league of others on the list :)
>>
>> HTH
>> Chris
>> On 05/08/2014 11:43 am, "D Tim Cummings" <ti...@triptera.com.au> wrote:
>>
>>> I am having a look at the tapestry-security guide at
>>> http://tynamo.org/tapestry-security+guide and several of the links are
>>> broken
>>>
>>> Hibernate-based entity realm (service)
>>> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java> points
>>> to
>>> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java
>>> (404 Not found)
>>>
>>> User entity used by the realm sample referred to above
>>> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java> points
>>> to
>>> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java
>>> (404 Not found)
>>>
>>> tapestry-exceptionpage <http://tynamo.org/tapestry-security+guide> points
>>> to the tapestry-security guide page that we are reading.
>>>
>>> full-featured integration test web app
>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/> should
>>> probably point to github
>>> https://github.com/tynamo/tapestry-security/tree/master/src/test/java/org/tynamo/security/testapp
>>>
>>> template
>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/resources/org/tynamo/security/testapp/pages/Index.tml> should
>>> probably point to github
>>> https://github.com/tynamo/tapestry-security/blob/master/src/test/resources/org/tynamo/security/testapp/pages/Index.tml
>>>
>>> class
>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/pages/Index.java> should
>>> probably point to github
>>> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/pages/Index.java
>>>
>>> AlphaService
>>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/services/AlphaService.java> should
>>> probably point to github
>>> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/services/AlphaService.java
>>>
>>> http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts should
>>> probably point to github
>>> https://github.com/tynamo/tynamo-example-federatedaccounts
>>>
>>> AppModule
>>> <http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java> should
>>> probably point to github
>>> https://github.com/tynamo/tynamo-example-federatedaccounts/blob/master/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java
>>>
>>>
>>>
>>> I am really looking for sample code of an implementation of
>>> tapestry-security with Cayenne (or Hibernate) using Tapestry 5.3.7,
>>> tapestry-security 0.5.1. I don't need federated accounts at this stage.
>>>
>>>
>>>
>>> Regards
>>>
>>> Tim
>>>
>>
>
Re: tapestry-security looking for sample code
Posted by Chris Mylonas <ch...@opencsta.org>.
And here's some notes from my wiki for a tapestry-security file based auth
and hibernate for entities.
I'm also in +10 timezone down in Sydney - so the replies will come later in
the day usually :)
Skeleton
- Create quickstart tapestry archetype
[edit
<https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=2>
]Change dependencies
- Add in these dependencies replacing tapestry-core
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-hibernate</artifactId>
<version>5.3.7</version>
</dependency>
<dependency>
<groupId>org.tynamo</groupId>
<artifactId>tapestry-security</artifactId>
<version>0.5.1</version>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
<dependency>
<groupId>org.got5</groupId>
<artifactId>tapestry5-jquery</artifactId>
<version>3.3.7</version>
</dependency>
...
<repository>
<id>devlab722-repo</id>
<url>http://nexus.devlab722.net/nexus/content/repositories/releases
</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>devlab722-snapshot-repo</id>
<url>http://nexus.devlab722.net/nexus/content/repositories/snapshots
</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
...
- Running in jetty at this stage will yield this error in the browser
HTTP ERROR 500
Problem accessing /TapestryHibernateSecurity/. Reason:
Exception constructing service 'WebSecurityManager': Error
invoking constructor public
org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection):
Realms collection argument cannot be empty.
Caused by:
java.lang.RuntimeException: Exception constructing service
'WebSecurityManager': Error invoking constructor public
org.tynamo.security.services.TapestryRealmSecurityManager(org.tynamo.security.Authenticator,org.apache.shiro.mgt.SubjectFactory,org.apache.shiro.mgt.RememberMeManager,java.util.Collection):
Realms collection argument cannot be empty.
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
Because Tapestry has an IoC container that does dependency injection, each
service tapetry uses needs to be configured within a module. The default
place for application specific services to be set up is in AppModule.
[edit
<https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=3>
]Add realm to security service
So we need to contribute some web security manager realm info by adding a
realm.
- Add websecuritymanager realm into AppModule
...
import org.tynamo.shiro.extension.realm.text.ExtendedPropertiesRealm;
import org.apache.shiro.realm.Realm;
import org.apache.shiro.web.mgt.WebSecurityManager;
...
@Contribute(WebSecurityManager.class)
public static void addRealms(Configuration<Realm> configuration) {
ExtendedPropertiesRealm realm = new
ExtendedPropertiesRealm("classpath:shiro-users.properties");
configuration.add(realm);
}
[edit
<https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=4>
]Shiro users properties
And also add shiro-users.properties to the classpath (src/main/resources)
touch srm/main/resources/shiro-users.properties
- Firing up application now yields hibernate errors.
HTTP ERROR 500
Problem accessing /TapestryHibernateSecurity/. Reason:
java.lang.RuntimeException: Exception constructing service
'ValueEncoderSource': Error invoking service contribution method
org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
LoggerSource): Exception constructing service
'HibernateSessionSource': Error invoking constructor public
org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List):
/hibernate.cfg.xml not found
Caused by:
org.apache.shiro.subject.ExecutionException:
java.lang.RuntimeException: Exception constructing service
'ValueEncoderSource': Error invoking service contribution method
org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
LoggerSource): Exception constructing service
'HibernateSessionSource': Error invoking constructor public
org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List):
/hibernate.cfg.xml not found
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:382)
[edit
<https://bondiwiki.mrvoip.com.au/index.php?title=Tapestry_Hibernate_Security&action=edit§ion=5>
]add in the hibernate configuration
- Add hibernate configuration for derby db
src/main/resources/hibernate.cfg.xml
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property
name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property
name="hibernate.connection.url">jdbc:hsqldb:./target/work/t5hibernatesecurity;shutdown=true</property>
<property
name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
</session-factory>
</hibernate-configuration>
On Tue, Aug 5, 2014 at 12:19 PM, Chris Mylonas <ch...@opencsta.org> wrote:
> Hi Tim,
>
> I had sample code in a repo I was making a variations project to split
> hairs on how to do the same thing using different ways.
>
> Unforch that repo was lost by a VPS provider although I have the latest
> got tree it is def not share-able ATM.
>
> Do a Google search for "github eloquentia Thiago tapestry" and you'll find
> thiago's excellent sample to get you going from a file based thing to
> database.
>
> Eloquentia may use nosql but you will be able to work it out - I did and
> I'm by far nowhere in the league of others on the list :)
>
> HTH
> Chris
> On 05/08/2014 11:43 am, "D Tim Cummings" <ti...@triptera.com.au> wrote:
>
>> I am having a look at the tapestry-security guide at
>> http://tynamo.org/tapestry-security+guide and several of the links are
>> broken
>>
>> Hibernate-based entity realm (service)
>> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java> points
>> to
>> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java
>> (404 Not found)
>>
>> User entity used by the realm sample referred to above
>> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java> points
>> to
>> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java
>> (404 Not found)
>>
>> tapestry-exceptionpage <http://tynamo.org/tapestry-security+guide> points
>> to the tapestry-security guide page that we are reading.
>>
>> full-featured integration test web app
>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/> should
>> probably point to github
>> https://github.com/tynamo/tapestry-security/tree/master/src/test/java/org/tynamo/security/testapp
>>
>> template
>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/resources/org/tynamo/security/testapp/pages/Index.tml> should
>> probably point to github
>> https://github.com/tynamo/tapestry-security/blob/master/src/test/resources/org/tynamo/security/testapp/pages/Index.tml
>>
>> class
>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/pages/Index.java> should
>> probably point to github
>> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/pages/Index.java
>>
>> AlphaService
>> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/services/AlphaService.java> should
>> probably point to github
>> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/services/AlphaService.java
>>
>> http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts should
>> probably point to github
>> https://github.com/tynamo/tynamo-example-federatedaccounts
>>
>> AppModule
>> <http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java> should
>> probably point to github
>> https://github.com/tynamo/tynamo-example-federatedaccounts/blob/master/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java
>>
>>
>>
>> I am really looking for sample code of an implementation of
>> tapestry-security with Cayenne (or Hibernate) using Tapestry 5.3.7,
>> tapestry-security 0.5.1. I don't need federated accounts at this stage.
>>
>>
>>
>> Regards
>>
>> Tim
>>
>
Re: tapestry-security looking for sample code
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 04 Aug 2014 23:19:37 -0300, Chris Mylonas <ch...@opencsta.org>
wrote:
> Hi Tim,
Hi, guys!
> Do a Google search for "github eloquentia Thiago tapestry" and you'll
> find thiago's excellent sample to get you going from a file based thing
> to
> database.
Thanks for the shoutout, Chris! :D Here's it:
https://github.com/thiagohp/eloquentia. I was learning Tapestry Security
and Apache Shiro on the fly, one piece at a time, implementing
authentication then authorization. The key for learning Tapestry Security
is to remember that's an integration of Apache Shiro, an awesome security
framework, with Tapestry-IoC and Tapestry, so users, realms,
authentication, authorization, permissions, etc, are all Shiro's
responsibility, so you should learn it (or at least the pieces you need).
> Eloquentia may use nosql but you will be able to work it out - I did and
> I'm by far nowhere in the league of others on the list :)
SQL or NoSQL won't make a difference.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: tapestry-security looking for sample code
Posted by Chris Mylonas <ch...@opencsta.org>.
Hi Tim,
I had sample code in a repo I was making a variations project to split
hairs on how to do the same thing using different ways.
Unforch that repo was lost by a VPS provider although I have the latest got
tree it is def not share-able ATM.
Do a Google search for "github eloquentia Thiago tapestry" and you'll find
thiago's excellent sample to get you going from a file based thing to
database.
Eloquentia may use nosql but you will be able to work it out - I did and
I'm by far nowhere in the league of others on the list :)
HTH
Chris
On 05/08/2014 11:43 am, "D Tim Cummings" <ti...@triptera.com.au> wrote:
> I am having a look at the tapestry-security guide at
> http://tynamo.org/tapestry-security+guide and several of the links are
> broken
>
> Hibernate-based entity realm (service)
> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java> points
> to
> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java
> (404 Not found)
>
> User entity used by the realm sample referred to above
> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java> points
> to
> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java
> (404 Not found)
>
> tapestry-exceptionpage <http://tynamo.org/tapestry-security+guide> points
> to the tapestry-security guide page that we are reading.
>
> full-featured integration test web app
> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/> should
> probably point to github
> https://github.com/tynamo/tapestry-security/tree/master/src/test/java/org/tynamo/security/testapp
>
> template
> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/resources/org/tynamo/security/testapp/pages/Index.tml> should
> probably point to github
> https://github.com/tynamo/tapestry-security/blob/master/src/test/resources/org/tynamo/security/testapp/pages/Index.tml
>
> class
> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/pages/Index.java> should
> probably point to github
> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/pages/Index.java
>
> AlphaService
> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/services/AlphaService.java> should
> probably point to github
> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/services/AlphaService.java
>
> http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts should
> probably point to github
> https://github.com/tynamo/tynamo-example-federatedaccounts
>
> AppModule
> <http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java> should
> probably point to github
> https://github.com/tynamo/tynamo-example-federatedaccounts/blob/master/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java
>
>
>
> I am really looking for sample code of an implementation of
> tapestry-security with Cayenne (or Hibernate) using Tapestry 5.3.7,
> tapestry-security 0.5.1. I don't need federated accounts at this stage.
>
>
>
> Regards
>
> Tim
>
Re: tapestry-security looking for sample code
Posted by Kalle Korhonen <ka...@gmail.com>.
Thanks Tim,
we are in the process of moving from Codehaus' SVN to Github so the
documentation is dragging a bit behind, sorry for the trouble. I'll update
it and fix whatever is broken before the next release. Regardless of the
origin of the source code, take a look at the JPA examples. The concepts
are largely the same whether you use JPA or Hibernate.
Kalle
On Mon, Aug 4, 2014 at 6:42 PM, D Tim Cummings <ti...@triptera.com.au> wrote:
> I am having a look at the tapestry-security guide at
> http://tynamo.org/tapestry-security+guide and several of the links are
> broken
>
> Hibernate-based entity realm (service)
> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java> points
> to
> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java
> (404 Not found)
>
> User entity used by the realm sample referred to above
> <http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java> points
> to
> http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/tynamo-federatedaccounts-core/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java
> (404 Not found)
>
> tapestry-exceptionpage <http://tynamo.org/tapestry-security+guide> points
> to the tapestry-security guide page that we are reading.
>
> full-featured integration test web app
> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/> should
> probably point to github
> https://github.com/tynamo/tapestry-security/tree/master/src/test/java/org/tynamo/security/testapp
>
> template
> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/resources/org/tynamo/security/testapp/pages/Index.tml> should
> probably point to github
> https://github.com/tynamo/tapestry-security/blob/master/src/test/resources/org/tynamo/security/testapp/pages/Index.tml
>
> class
> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/pages/Index.java> should
> probably point to github
> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/pages/Index.java
>
> AlphaService
> <http://svn.codehaus.org/tynamo/trunk/tapestry-security/src/test/java/org/tynamo/security/testapp/services/AlphaService.java> should
> probably point to github
> https://github.com/tynamo/tapestry-security/blob/master/src/test/java/org/tynamo/security/testapp/services/AlphaService.java
>
> http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts should
> probably point to github
> https://github.com/tynamo/tynamo-example-federatedaccounts
>
> AppModule
> <http://svn.codehaus.org/tynamo/trunk/tynamo-example-federatedaccounts/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java> should
> probably point to github
> https://github.com/tynamo/tynamo-example-federatedaccounts/blob/master/src/main/java/org/tynamo/examples/federatedaccounts/services/AppModule.java
>
>
>
> I am really looking for sample code of an implementation of
> tapestry-security with Cayenne (or Hibernate) using Tapestry 5.3.7,
> tapestry-security 0.5.1. I don't need federated accounts at this stage.
>
>
>
> Regards
>
> Tim
>