Re: Securing page with Tapestry
Hi Will, seems that the tapestry-security is not in your classpath. Make sure that you see: ... ProjectClassLoader: entry=/home/ASDF/.m2/repository/org/tynamo/tapestry-security/0.5.1/tapestry-security-0.5.1.jar ... and: ... [INFO] ioc.RegistryBuilder Adding module definition for class org.tynamo.security.services.SecurityModule ... With kind regards David Am 09.08.2013 15:02, schrieb Will N.: > Hi David, > actually, i do not come so far because the error occurs while the > application is starting. So It does not get to the point where the > services are printed. > > > [INFO] ioc.RegistryBuilder Adding module definition for class > org.apache.tapestry5.ioc.services.TapestryIOCModule > [INFO] ioc.RegistryBuilder Adding module definition for class > org.apache.tapestry5.hibernate.HibernateCoreModule > [INFO] ioc.RegistryBuilder Adding module definition for class > org.apache.tapestry5.json.services.JSONModule > [INFO] ioc.RegistryBuilder Adding module definition for class > org.apache.tapestry5.yuicompressor.services.YuiCompressorModule > [INFO] ioc.RegistryBuilder Adding module definition for class > org.apache.tapestry5.services.TapestryModule > [INFO] ioc.RegistryBuilder Adding module definition for class > org.apache.tapestry5.internal.services.InternalModule > [INFO] ioc.RegistryBuilder Adding module definition for class > org.apache.tapestry5.services.assets.AssetsModule > [INFO] ioc.RegistryBuilder Adding module definition for class > org.apache.tapestry5.services.pageload.PageLoadModule > [INFO] ioc.RegistryBuilder Adding module definition for class > com.example.pms.services.PmsModule > [INFO] ioc.RegistryBuilder Adding module definition for class > com.example.pms.services.DevelopmentModule > 2013-08-09 15:00:08.583:WARN::failed pms: > java.lang.IllegalArgumentException: Contribution > com.example.pms.services.PmsModule.contributeWebSecurityManager(Configuration, > Session) (at PmsModule.java:195) is for service 'WebSecurityManager', > which does not exist. > 2013-08-09 15:00:08.583:WARN::Failed startup of context > org.mortbay.jetty.webapp.WebAppContext@9a0d40{/pms,C:\Users\xxx\tapestry\pms\src\main\webapp} > java.lang.IllegalArgumentException: Contribution > com.example.pms.services.PmsModule.contributeWebSecurityManager(Configuration, > Session) (at PmsModule.java:195) is for service 'WebSecurityManager', > which does not exist. > at > org.apache.tapestry5.ioc.internal.RegistryImpl.validateContributeDefs(RegistryImpl.java:241) > at > org.apache.tapestry5.ioc.internal.RegistryImpl.(RegistryImpl.java:205) > at > org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:177) > at > org.apache.tapestry5.internal.TapestryAppInitializer.createRegistry(TapestryAppInitializer.java:200) > at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:109) > at > org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) > at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) > at > org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713) > at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) > at > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282) > at > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518) > at > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499) > at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) > at > org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) > at org.mortbay.jetty.Server.doStart(Server.java:224) > at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) > at runjettyrun.Bootstrap.main(Bootstrap.java:97) > 2013-08-09 15:00:08.614:INFO::Started SelectChannelConnector@0.0.0.0:8080 > Am 09.08.2013 13:56, schrieb D.R.: > > > public class PmsModule { > > public static void bind(ServiceBinder binder) { > // // binder.bind(MyServiceInterface.class, MyServiceImpl.class); > // > // // Make bind() calls on the binder object to define most IoC > // services. > // // Use service builder methods (example below) when the > // implementation > // // is provided inline, or requires more initialization than > simply > // // invoking the constructor. > binder.bind(ArbeitspaketDao.class, ArbeitspaketDaoImpl.class); > binder.bind(AufgabeDao.class, AufgabeDaoImpl.class); > binder.bind(BasicDao.class, BasicDaoImpl.class); > binder.bind(FunktionDao.class, FunktionDaoImpl.class); > // binder.bind(GrantedAuthorityBeanDao.class, > // GrantedAuthorityBeanDaoImpl.class); > binder.bind(MitarbeiterDao.class, MitarbeiterDaoImpl.class); > binder.bind(MitarbeiterProjektDao.class, > MitarbeiterProjektDaoImpl.class); > binder.bind(ModulDao.class, ModulDaoImpl.class); >
Re: Securing page with Tapestry
Hi David, actually, i do not come so far because the error occurs while the application is starting. So It does not get to the point where the services are printed. [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.ioc.services.TapestryIOCModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.hibernate.HibernateCoreModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.json.services.JSONModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.yuicompressor.services.YuiCompressorModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.TapestryModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.internal.services.InternalModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.assets.AssetsModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.pageload.PageLoadModule [INFO] ioc.RegistryBuilder Adding module definition for class com.example.pms.services.PmsModule [INFO] ioc.RegistryBuilder Adding module definition for class com.example.pms.services.DevelopmentModule 2013-08-09 15:00:08.583:WARN::failed pms: java.lang.IllegalArgumentException: Contribution com.example.pms.services.PmsModule.contributeWebSecurityManager(Configuration, Session) (at PmsModule.java:195) is for service 'WebSecurityManager', which does not exist. 2013-08-09 15:00:08.583:WARN::Failed startup of context org.mortbay.jetty.webapp.WebAppContext@9a0d40{/pms,C:\Users\xxx\tapestry\pms\src\main\webapp} java.lang.IllegalArgumentException: Contribution com.example.pms.services.PmsModule.contributeWebSecurityManager(Configuration, Session) (at PmsModule.java:195) is for service 'WebSecurityManager', which does not exist. at org.apache.tapestry5.ioc.internal.RegistryImpl.validateContributeDefs(RegistryImpl.java:241) at org.apache.tapestry5.ioc.internal.RegistryImpl.(RegistryImpl.java:205) at org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:177) at org.apache.tapestry5.internal.TapestryAppInitializer.createRegistry(TapestryAppInitializer.java:200) at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:109) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at runjettyrun.Bootstrap.main(Bootstrap.java:97) 2013-08-09 15:00:08.614:INFO::Started SelectChannelConnector@0.0.0.0:8080 Am 09.08.2013 13:56, schrieb D.R.: public class PmsModule { public static void bind(ServiceBinder binder) { // // binder.bind(MyServiceInterface.class, MyServiceImpl.class); // // // Make bind() calls on the binder object to define most IoC // services. // // Use service builder methods (example below) when the // implementation // // is provided inline, or requires more initialization than simply // // invoking the constructor. binder.bind(ArbeitspaketDao.class, ArbeitspaketDaoImpl.class); binder.bind(AufgabeDao.class, AufgabeDaoImpl.class); binder.bind(BasicDao.class, BasicDaoImpl.class); binder.bind(FunktionDao.class, FunktionDaoImpl.class); // binder.bind(GrantedAuthorityBeanDao.class, // GrantedAuthorityBeanDaoImpl.class); binder.bind(MitarbeiterDao.class, MitarbeiterDaoImpl.class); binder.bind(MitarbeiterProjektDao.class, MitarbeiterProjektDaoImpl.class); binder.bind(ModulDao.class, ModulDaoImpl.class); binder.bind(PersonMonatDao.class, PersonMonatDaoImpl.class); binder.bind(UserDataDao.class, UserDataDaoImpl.class); binder.bind(ProjektDao.class, ProjektDaoImpl.class); binder.bind(UnteraufgabeDao.class, UnteraufgabeDaoImpl.class); binder.bind(UnterunteraufgabeDao.class, UnterunteraufgabeDaoImpl.class); binder.bind(PrivillegesDao.class, PrivillegesDaoImpl.class); binder.bind(AuthenticatorInterface.class, AuthenticatorImp.class); // } public static void contributeFac
Re: Securing page with Tapestry
Hi Will, provide some code pls. Is this the full stacktrace? Do you see the service definition in the startup log, like this? [INFO] tapestry5.TapestryFilter Startup status: Services: ... WebSecurityManager: DEFINED In addition i had to exclude t5-ioc as the versions did not match: org.tynamo tapestry-security 0.5.1 org.apache.tapestry tapestry-ioc With kind regards David Am 09.08.2013 12:07, schrieb Will N.: > Hi, > this is what i got when i follow the instructions in the mentioned > tutorial. > > 2013-08-09 11:57:05.504:WARN::failed pms: > java.lang.IllegalArgumentException: Contribution > com.example.pms.services.PmsModule.contributeWebSecurityManager(Configuration, > Session) (at PmsModule.java:193) is for service 'interface > org.apache.shiro.web.mgt.WebSecurityManager' qualified with marker > annotations [], which does not exist. > 2013-08-09 11:57:05.504:WARN::Failed startup of context > org.mortbay.jetty.webapp.WebAppContext@1b77bbb{/pms,C:\Users\xxx\tapestry\pms\src\main\webapp} > java.lang.IllegalArgumentException: Contribution > com.example.pms.services.PmsModule.contributeWebSecurityManager(Configuration, > Session) (at PmsModule.java:193) is for service 'interface > org.apache.shiro.web.mgt.WebSecurityManager' qualified with marker > annotations [], which does not exist. > at > org.apache.tapestry5.ioc.internal.RegistryImpl.validateContributeDefs(RegistryImpl.java:246) > at > org.apache.tapestry5.ioc.internal.RegistryImpl.(RegistryImpl.java:205) > at > org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:177) > at > org.apache.tapestry5.internal.TapestryAppInitializer.createRegistry(TapestryAppInitializer.java:200) > at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:109) > at > org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) > at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) > at > org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713) > at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) > at > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282) > at > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518) > at > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499) > at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) > at > org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) > at org.mortbay.jetty.Server.doStart(Server.java:224) > at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) > at runjettyrun.Bootstrap.main(Bootstrap.java:97) > 2013-08-09 11:57:05.534:INFO::Started SelectChannelConnector@0.0.0.0:8080 > > > > Am 07.08.2013 13:20, schrieb D.R.: >> Hi, >> >> i also want to suggest tynamo tapestry-security. >> >> As a quickstart is missing, i recommend this post: >> http://comments.gmane.org/gmane.comp.java.tynamo.user/287 >> >> With the instructions given there, you can quickly setup >> tapestry-security and use this as a starting point. >> >> >> With kind regards >> David >> >> > > > - > 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
Re: Securing page with Tapestry
Hi, this is what i got when i follow the instructions in the mentioned tutorial. 2013-08-09 11:57:05.504:WARN::failed pms: java.lang.IllegalArgumentException: Contribution com.example.pms.services.PmsModule.contributeWebSecurityManager(Configuration, Session) (at PmsModule.java:193) is for service 'interface org.apache.shiro.web.mgt.WebSecurityManager' qualified with marker annotations [], which does not exist. 2013-08-09 11:57:05.504:WARN::Failed startup of context org.mortbay.jetty.webapp.WebAppContext@1b77bbb{/pms,C:\Users\xxx\tapestry\pms\src\main\webapp} java.lang.IllegalArgumentException: Contribution com.example.pms.services.PmsModule.contributeWebSecurityManager(Configuration, Session) (at PmsModule.java:193) is for service 'interface org.apache.shiro.web.mgt.WebSecurityManager' qualified with marker annotations [], which does not exist. at org.apache.tapestry5.ioc.internal.RegistryImpl.validateContributeDefs(RegistryImpl.java:246) at org.apache.tapestry5.ioc.internal.RegistryImpl.(RegistryImpl.java:205) at org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:177) at org.apache.tapestry5.internal.TapestryAppInitializer.createRegistry(TapestryAppInitializer.java:200) at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:109) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at runjettyrun.Bootstrap.main(Bootstrap.java:97) 2013-08-09 11:57:05.534:INFO::Started SelectChannelConnector@0.0.0.0:8080 Am 07.08.2013 13:20, schrieb D.R.: Hi, i also want to suggest tynamo tapestry-security. As a quickstart is missing, i recommend this post: http://comments.gmane.org/gmane.comp.java.tynamo.user/287 With the instructions given there, you can quickly setup tapestry-security and use this as a starting point. With kind regards David - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Securing page with Tapestry (Solved)
Hi, there is an error in the Tutorial (http://tapestryjava.blogspot.co.uk/search/label/security), which is the wrong name of the constructor of the RequiresLoginFilter class. It musst be public *RequiresLoginFilter*(PageRenderLinkSource renderLinkSource, ComponentSource componentSource, Response response, AuthenticatorInterface authService) { this.renderLinkSource = renderLinkSource; this.componentSource = componentSource; this.response = response; this.authService = authService; } and NOT public *PageAccessFilter*(PageRenderLinkSource renderLinkSource, ComponentSource componentSource, Response response, AuthenticationService authService) { this.renderLinkSource = renderLinkSource; this.componentSource = componentSource; this.response = response; this.authService = authService; } Many tanks to D.R. Will Am 08.08.2013 09:59, schrieb D.R.: Hi Willy, are you french or german? Teamviewer is fine, but i have to work until 6pm CET After 6pm we can make a session. Kind regards David Am 08.08.2013 09:56, schrieb Willy N.: Hi David, thanks for the proposition. It will be great If we could do that. I will be working on it in 3 hours. I will contact you then. we could use teamviewer. Regards Will Am 07.08.2013 18:40, schrieb D.R.: Will, seems that there are so many things not working in your env. that it is too much for the mailinglist. If you want, contact me and share your screen so i can have a look on it. Kind regards David
Re: Securing page with Tapestry
t;>> >>> public void handleComponentEvent( >>> ComponentEventRequestParameters parameters, >>> ComponentRequestHandler handler) throws IOException { >>> >>> if (dispatchedToLoginPage(parameters.getActivePageName())) { >>> return; >>> } >>> >>> handler.handleComponentEvent(parameters); >>> >>> } >>> >>> public void handlePageRender(PageRenderRequestParameters parameters, >>> ComponentRequestHandler handler) throws IOException { >>> if (dispatchedToLoginPage(parameters.getLogicalPageName())) { >>> return; >>> } >>> >>> handler.handlePageRender(parameters); >>> } >>> >>> private boolean dispatchedToLoginPage(String pageName) throws >>> IOException { >>> if (authService.isLoggedIn()) { // line 66 >>> return false; >>> } >>> >>> Component page = componentSource.getPage(pageName); >>> >>> if (!page.getClass().isAnnotationPresent(RequiresLogin.class)) { >>> return false; >>> } >>> >>> Link link = renderLinkSource.createPageRenderLink("Login"); >>> >>> response.sendRedirect(link); >>> >>> return true; >>> } >>> } >>> >>> >>> public class RequiresLoginFilter implements ComponentRequestFilter { >>> private PageRenderLinkSource renderLinkSource; >>> >>> private ComponentSource componentSource; >>> private Response response; >>> >>> private AuthenticatorImp authService; >>> >>> public void PageAccessFilter(PageRenderLinkSource renderLinkSource, >>> ComponentSource componentSource, Response response, >>> AuthenticatorImp authService) { >>> >>> this.renderLinkSource = renderLinkSource; >>> this.componentSource = componentSource; >>> this.response = response; >>> this.authService = authService; >>> >>> } >>> >>> public void handleComponentEvent( >>> ComponentEventRequestParameters parameters, >>> ComponentRequestHandler handler) throws IOException { >>> >>> if (dispatchedToLoginPage(parameters.getActivePageName())) { >>> return; >>> } >>> >>> handler.handleComponentEvent(parameters); >>> >>> } >>> >>> public void handlePageRender(PageRenderRequestParameters parameters, >>> ComponentRequestHandler handler) throws IOException { >>> if (dispatchedToLoginPage(parameters.getLogicalPageName())) { >>> return; >>> } >>> >>> handler.handlePageRender(parameters); >>> } >>> >>> private boolean dispatchedToLoginPage(String pageName) throws >>> IOException { // line 57 >>> if (authService.isLoggedIn()) { >>> return false; >>> } >>> >>> Component page = componentSource.getPage(pageName); >>> >>> if (!page.getClass().isAnnotationPresent(RequiresLogin.class)) { >>> return false; >>> } >>> >>> Link link = renderLinkSource.createPageRenderLink("Login"); >>> >>> response.sendRedirect(link); >>> >>> return true; >>> } >>> } >>> >>> >>> >>> public class AuthenticatorImp implements AuthenticatorInterface{ >>> >>> public static final String AUTH_TOKEN = "authToken"; >>> /** >>> * >>> */ >>> public AuthenticatorImp() { >>> super(); >>> // TODO Auto-generated constructor stub >>> } >>> >>> /** >>> * @param request >>> */ >>> public AuthenticatorImp(Request request) { >>> super(); >>> this.request = request; >>> } >>> >>> >>> >>> >>> @Inject >>> private Request request; >>> public Mitarbeiter getLoggedUser() { >>> Mitarbeiter user = null; >>> >>> if (isLoggedIn()) >>> user = (Mitarbeiter) >>> request.getSession(true).getAttribute(AUTH_TOKEN); >>> else >>> throw new IllegalStateException("The user is not logged >>> ! "); >>> return user; >>> } >>> >>> public boolean isLoggedIn() { >>> org.apache.tapestry5.services.Session session = >>> request.getSession(true); >>> if (session != null) { return >>> session.getAttribute(AUTH
Re: Securing page with Tapestry
PageRender(PageRenderRequestParameters parameters, ComponentRequestHandler handler) throws IOException { if (dispatchedToLoginPage(parameters.getLogicalPageName())) { return; } handler.handlePageRender(parameters); } private boolean dispatchedToLoginPage(String pageName) throws IOException { // line 57 if (authService.isLoggedIn()) { return false; } Component page = componentSource.getPage(pageName); if (!page.getClass().isAnnotationPresent(RequiresLogin.class)) { return false; } Link link = renderLinkSource.createPageRenderLink("Login"); response.sendRedirect(link); return true; } } public class AuthenticatorImp implements AuthenticatorInterface{ public static final String AUTH_TOKEN = "authToken"; /** * */ public AuthenticatorImp() { super(); // TODO Auto-generated constructor stub } /** * @param request */ public AuthenticatorImp(Request request) { super(); this.request = request; } @Inject private Request request; public Mitarbeiter getLoggedUser() { Mitarbeiter user = null; if (isLoggedIn()) user = (Mitarbeiter) request.getSession(true).getAttribute(AUTH_TOKEN); else throw new IllegalStateException("The user is not logged ! "); return user; } public boolean isLoggedIn() { org.apache.tapestry5.services.Session session = request.getSession(true); if (session != null) { return session.getAttribute(AUTH_TOKEN) != null; } return false; } @SuppressWarnings("unchecked") public void login(String nickName, String password, org.hibernate.Session session) throws NoSuchAlgorithmException, UnsupportedEncodingException { MitarbeiterDaoImpl mitarbeiterDao = new MitarbeiterDaoImpl( Mitarbeiter.class, session); Mitarbeiter authUser = mitarbeiterDao.authenticate(nickName, Encrypt.MD5(password)); try{ request.getSession(true).setAttribute(AUTH_TOKEN, authUser); } catch(NullPointerException e){ System.out.println("Beim Einlogen ist ein fehler aufgetreten"); } } public void logout() { org.apache.tapestry5.services.Session session = request.getSession(false); if (session != null) { session.setAttribute(AUTH_TOKEN, null); session.invalidate(); } } } De : Taha Hafeez Siddiqi À : Tapestry users Envoyé le : Mardi 6 août 2013 14h41 Objet : Re: Securing page with Tapestry Are you defining your own ComponentRequestFilter interface? As you have included the code for that I am assuming you have. You have to implement Tapestry's ComponentRequestFilter, not your own as you can't contribute to the RequestHandler any other implementation. regards Taha On 06-Aug-2013, at 5:53 PM, Will N. wrote: Am 06.08.2013 14:13, schrieb Thiago H de Paula Figueiredo: I'm sorry, I should have asked for your ComponentRequestFilter implementation source too. ;) On Tue, 06 Aug 2013 08:31:15 -0300, Will N. wrote: Am 06.08.2013 13:25, schrieb Thiago H de Paula Figueiredo: On Tue, 06 Aug 2013 05:10:37 -0300, Will N. wrote: Hi, Hi! I am trying secure some pages of my application as shown in this tutorial. http://tapestryjava.blogspot.co.uk/search/label/security But I am having following error message when I start the application. Since the RequiresLoginFilte class implements the ComponentRequestFilter interface, I am confused about the coertion error! The error is weird. Could you post your PmsModule.contributeComponentRequestHandler() method /** * This module is automatically included as part of the Tapestry IoC Registry, * it's a good place to configure and extend Tapestry, or to place your own * service definitions. spring */ public class PmsModule { //public static void bind(ServiceBinder binder) { //// binder.bind(MyServiceInterface.class, MyServiceImpl.class); // //// Make bind() calls on the binder object to define most IoC services. //// Use service builder methods (example below) when the implementation //// is provided inline, or requires more initialization than simply //// invoking the constructor. //binder.bind(ArbeitspaketDao.class, ArbeitspaketDaoImpl.class); //binder.bind(AufgabeDao.class, AufgabeDaoImpl.class); //binder.bind(BasicDao.class, BasicDaoImpl.class); //binder.bind(FunktionDao.class, FunktionDaoImpl.class); binder.bind(GrantedAuthorityBeanDao.class, GrantedAuthorityBeanDaoImpl.class); //binder.bind(MitarbeiterDao.class, MitarbeiterDaoImpl.class); //binder.bind(MitarbeiterProjektDao.class, //MitarbeiterProjektDaoImpl.class); //binder.bind(ModulDao.class, ModulDaoImpl.class); //binder.bind(PersonMonatDao.class, PersonMonatDaoImpl.class); //binder.bind(UserDataDao.class, UserDataDaoImpl.class); //
Re: Securing page with Tapestry
.handleComponentEvent(parameters); > > } > > public void handlePageRender(PageRenderRequestParameters parameters, > ComponentRequestHandler handler) throws IOException { > if (dispatchedToLoginPage(parameters.getLogicalPageName())) { > return; > } > > handler.handlePageRender(parameters); > } > > private boolean dispatchedToLoginPage(String pageName) throws IOException { > // line 57 > if (authService.isLoggedIn()) { > return false; > } > > Component page = componentSource.getPage(pageName); > > if (!page.getClass().isAnnotationPresent(RequiresLogin.class)) { > return false; > } > > Link link = renderLinkSource.createPageRenderLink("Login"); > > response.sendRedirect(link); > > return true; > } > } > > > > public class AuthenticatorImp implements AuthenticatorInterface{ > > public static final String AUTH_TOKEN = "authToken"; > /** > * > */ > public AuthenticatorImp() { > super(); > // TODO Auto-generated constructor stub > } > > /** > * @param request > */ > public AuthenticatorImp(Request request) { > super(); > this.request = request; > } > > > > > @Inject > private Request request; > public Mitarbeiter getLoggedUser() { > > Mitarbeiter user = null; > > if (isLoggedIn()) > user = (Mitarbeiter) > request.getSession(true).getAttribute(AUTH_TOKEN); > > else > throw new IllegalStateException("The user is not logged ! "); > > return user; > } > > public boolean isLoggedIn() { > org.apache.tapestry5.services.Session session = request.getSession(true); > if (session != null) { return session.getAttribute(AUTH_TOKEN) != > null; } > return false; > > } > > @SuppressWarnings("unchecked") > public void login(String nickName, String password, org.hibernate.Session > session) > throws NoSuchAlgorithmException, UnsupportedEncodingException { > MitarbeiterDaoImpl mitarbeiterDao = new MitarbeiterDaoImpl( > Mitarbeiter.class, session); > Mitarbeiter authUser = mitarbeiterDao.authenticate(nickName, > Encrypt.MD5(password)); > > try{ > request.getSession(true).setAttribute(AUTH_TOKEN, authUser); > } > catch(NullPointerException e){ > System.out.println("Beim Einlogen ist ein fehler aufgetreten"); > } > > > } > > public void logout() { > org.apache.tapestry5.services.Session session = request.getSession(false); > if (session != null) > { > session.setAttribute(AUTH_TOKEN, null); > session.invalidate(); > } > } > > > } > > > De : Taha Hafeez Siddiqi > À : Tapestry users > Envoyé le : Mardi 6 août 2013 14h41 > Objet : Re: Securing page with Tapestry > > > Are you defining your own ComponentRequestFilter interface? As you have > included the code for that I am assuming you have. > > You have to implement Tapestry's ComponentRequestFilter, not your own as you > can't contribute to the RequestHandler any other implementation. > > regards > Taha > > On 06-Aug-2013, at 5:53 PM, Will N. wrote: > >> Am 06.08.2013 14:13, schrieb Thiago H de Paula Figueiredo: >>> I'm sorry, I should have asked for your ComponentRequestFilter >>> implementation source too. ;) >>> >>> On Tue, 06 Aug 2013 08:31:15 -0300, Will N. wrote: >>> >>>> Am 06.08.2013 13:25, schrieb Thiago H de Paula Figueiredo: >>>>> On Tue, 06 Aug 2013 05:10:37 -0300, Will N. >>>>> wrote: >>>>> >>>>>> Hi, >>>>> Hi! >>>>> >>>>>> I am trying secure some pages of my application as shown in this >>>>>> tutorial. http://tapestryjava.blogspot.co.uk/search/label/security >>>>>> But I am having following error message when I start the application. >>>>>> Since the RequiresLoginFilte class implements the ComponentRequestFilter >>>>>> interface, I am confused about the coertion error! >>>>> The error is weird. Could you post your >>>>> PmsModule.contributeComponentRequestHandler() method >>>> /** >>>> * This module is automatically included as part of the Tapestry IoC >>>> Registry, >>>> * it's a good place to configure and extend Tapestry, or to place your >>>> own >>>> * service definitions. spring >>>> */ >>>> public class PmsModule {
Re: Securing page with Tapestry
* * @param request */ public AuthenticatorImp(Request request) { super(); this.request = request; } @Inject private Request request; public Mitarbeiter getLoggedUser() { Mitarbeiter user = null; if (isLoggedIn()) user = (Mitarbeiter) request.getSession(true).getAttribute(AUTH_TOKEN); else throw new IllegalStateException("The user is not logged ! "); return user; } public boolean isLoggedIn() { org.apache.tapestry5.services.Session session = request.getSession(true); if (session != null) { return session.getAttribute(AUTH_TOKEN) != null; } return false; } @SuppressWarnings("unchecked") public void login(String nickName, String password, org.hibernate.Session session) throws NoSuchAlgorithmException, UnsupportedEncodingException { MitarbeiterDaoImpl mitarbeiterDao = new MitarbeiterDaoImpl( Mitarbeiter.class, session); Mitarbeiter authUser = mitarbeiterDao.authenticate(nickName, Encrypt.MD5(password)); try{ request.getSession(true).setAttribute(AUTH_TOKEN, authUser); } catch(NullPointerException e){ System.out.println("Beim Einlogen ist ein fehler aufgetreten"); } } public void logout() { org.apache.tapestry5.services.Session session = request.getSession(false); if (session != null) { session.setAttribute(AUTH_TOKEN, null); session.invalidate(); } } } De : Taha Hafeez Siddiqi À : Tapestry users Envoyé le : Mardi 6 août 2013 14h41 Objet : Re: Securing page with Tapestry Are you defining your own ComponentRequestFilter interface? As you have included the code for that I am assuming you have. You have to implement Tapestry's ComponentRequestFilter, not your own as you can't contribute to the RequestHandler any other implementation. regards Taha On 06-Aug-2013, at 5:53 PM, Will N. wrote: > Am 06.08.2013 14:13, schrieb Thiago H de Paula Figueiredo: >> I'm sorry, I should have asked for your ComponentRequestFilter >> implementation source too. ;) >> >> On Tue, 06 Aug 2013 08:31:15 -0300, Will N. wrote: >> >>> Am 06.08.2013 13:25, schrieb Thiago H de Paula Figueiredo: >>>> On Tue, 06 Aug 2013 05:10:37 -0300, Will N. wrote: >>>> >>>>> Hi, >>>> >>>> Hi! >>>> >>>>> I am trying secure some pages of my application as shown in this >>>>> tutorial. http://tapestryjava.blogspot.co.uk/search/label/security >>>>> But I am having following error message when I start the application. >>>>> Since the RequiresLoginFilte class implements the ComponentRequestFilter >>>>> interface, I am confused about the coertion error! >>>> >>>> The error is weird. Could you post your >>>> PmsModule.contributeComponentRequestHandler() method >>> /** >>> * This module is automatically included as part of the Tapestry IoC >>>Registry, >>> * it's a good place to configure and extend Tapestry, or to place your own >>> * service definitions. spring >>> */ >>> public class PmsModule { >>> // public static void bind(ServiceBinder binder) { >>> // // binder.bind(MyServiceInterface.class, MyServiceImpl.class); >>> // >>> // // Make bind() calls on the binder object to define most IoC >>> services. >>> // // Use service builder methods (example below) when the >>> implementation >>> // // is provided inline, or requires more initialization than simply >>> // // invoking the constructor. >>> // binder.bind(ArbeitspaketDao.class, ArbeitspaketDaoImpl.class); >>> // binder.bind(AufgabeDao.class, AufgabeDaoImpl.class); >>> // binder.bind(BasicDao.class, BasicDaoImpl.class); >>> // binder.bind(FunktionDao.class, FunktionDaoImpl.class); >>> binder.bind(GrantedAuthorityBeanDao.class, >>> GrantedAuthorityBeanDaoImpl.class); >>> // binder.bind(MitarbeiterDao.class, MitarbeiterDaoImpl.class); >>> // binder.bind(MitarbeiterProjektDao.class, >>> // MitarbeiterProjektDaoImpl.class); >>> // binder.bind(ModulDao.class, ModulDaoImpl.class); >>> // binder.bind(PersonMonatDao.class, PersonMonatDaoImpl.class); >>> // binder.bind(UserDataDao.class, UserDataDaoImpl.class); >>> // binder.bind(ProjektDao.class, ProjektDaoImpl.class); >>> // binder.bind(UnteraufgabeDao.class, UnteraufgabeDaoImpl.class); >>> // binder.bind(Unterun
Re: Securing page with Tapestry
Hi, i also want to suggest tynamo tapestry-security. As a quickstart is missing, i recommend this post: http://comments.gmane.org/gmane.comp.java.tynamo.user/287 With the instructions given there, you can quickly setup tapestry-security and use this as a starting point. With kind regards David Am 06.08.2013 16:46, schrieb Lenny Primak: > Wy don't you use the wonderful tynamo tapestry-security library. > It works great out of the box and easy to integrate. > > On Aug 6, 2013, at 3:10 AM, "Will N." wrote: > >> Hi, >> I am trying secure some pages of my application as shown in this tutorial. >> http://tapestryjava.blogspot.co.uk/search/label/security >> But I am having following error message when I start the application. >> Since the RequiresLoginFilte class implements the ComponentRequestFilter >> interface, I am confused about the coertion error! >> >> >> [ERROR] ioc.Registry Error invoking service contribution method >> com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration): >> Could not find a coercion from type >> com.example.pms.services.RequiresLoginFilter to type >> org.apache.tapestry5.services.ComponentRequestFilter. >> [ERROR] ioc.Registry Operations trace: >> [ERROR] ioc.Registry [ 1] Realizing service ComponentRequestHandler >> [ERROR] ioc.Registry [ 2] Instantiating service ComponentRequestHandler >> implementation via >> org.apache.tapestry5.services.TapestryModule.buildComponentRequestHandler(List, >> ComponentRequestHandlerTerminator, Logger) (at TapestryModule.java:2690) >> [ERROR] ioc.Registry [ 3] Creating plan to invoke public >> org.apache.tapestry5.services.ComponentRequestHandler >> org.apache.tapestry5.services.TapestryModule.buildComponentRequestHandler(java.util.List,org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator,org.slf4j.Logger) >> [ERROR] ioc.Registry [ 4] Determining injection value for parameter #1 >> (java.util.List) >> [ERROR] ioc.Registry [ 5] Collecting ordered configuration for service >> ComponentRequestHandler >> [ERROR] ioc.Registry [ 6] Invoking >> com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration) >> (at PmsModule.java:146) >> [ERROR] TapestryModule.ComponentRequestHandler Construction of service >> ComponentRequestHandler failed: Error invoking service contribution method >> com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration): >> Could not find a coercion from type >> com.example.pms.services.RequiresLoginFilter to type >> org.apache.tapestry5.services.ComponentRequestFilter. >> org.apache.tapestry5.ioc.internal.OperationException: Error invoking service >> contribution method >> com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration): >> Could not find a coercion from type >> com.example.pms.services.RequiresLoginFilter to type >> org.apache.tapestry5.services.ComponentRequestFilter. >>at >> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121) >>at >> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88) >>at >> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:47) >>at >> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:76) >>at >> org.apache.tapestry5.ioc.internal.RegistryImpl.addToOrderedConfiguration(RegistryImpl.java:629) >>at >> org.apache.tapestry5.ioc.internal.RegistryImpl.getOrderedConfiguration(RegistryImpl.java:483) >>at >> org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$2.invoke(ServiceResourcesImpl.java:110)... >> >> >> >> - >> 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 > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Securing page with Tapestry
Wy don't you use the wonderful tynamo tapestry-security library. It works great out of the box and easy to integrate. On Aug 6, 2013, at 3:10 AM, "Will N." wrote: > Hi, > I am trying secure some pages of my application as shown in this tutorial. > http://tapestryjava.blogspot.co.uk/search/label/security > But I am having following error message when I start the application. > Since the RequiresLoginFilte class implements the ComponentRequestFilter > interface, I am confused about the coertion error! > > > [ERROR] ioc.Registry Error invoking service contribution method > com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration): > Could not find a coercion from type > com.example.pms.services.RequiresLoginFilter to type > org.apache.tapestry5.services.ComponentRequestFilter. > [ERROR] ioc.Registry Operations trace: > [ERROR] ioc.Registry [ 1] Realizing service ComponentRequestHandler > [ERROR] ioc.Registry [ 2] Instantiating service ComponentRequestHandler > implementation via > org.apache.tapestry5.services.TapestryModule.buildComponentRequestHandler(List, > ComponentRequestHandlerTerminator, Logger) (at TapestryModule.java:2690) > [ERROR] ioc.Registry [ 3] Creating plan to invoke public > org.apache.tapestry5.services.ComponentRequestHandler > org.apache.tapestry5.services.TapestryModule.buildComponentRequestHandler(java.util.List,org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator,org.slf4j.Logger) > [ERROR] ioc.Registry [ 4] Determining injection value for parameter #1 > (java.util.List) > [ERROR] ioc.Registry [ 5] Collecting ordered configuration for service > ComponentRequestHandler > [ERROR] ioc.Registry [ 6] Invoking > com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration) > (at PmsModule.java:146) > [ERROR] TapestryModule.ComponentRequestHandler Construction of service > ComponentRequestHandler failed: Error invoking service contribution method > com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration): > Could not find a coercion from type > com.example.pms.services.RequiresLoginFilter to type > org.apache.tapestry5.services.ComponentRequestFilter. > org.apache.tapestry5.ioc.internal.OperationException: Error invoking service > contribution method > com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration): > Could not find a coercion from type > com.example.pms.services.RequiresLoginFilter to type > org.apache.tapestry5.services.ComponentRequestFilter. >at > org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121) >at > org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88) >at > org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:47) >at > org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:76) >at > org.apache.tapestry5.ioc.internal.RegistryImpl.addToOrderedConfiguration(RegistryImpl.java:629) >at > org.apache.tapestry5.ioc.internal.RegistryImpl.getOrderedConfiguration(RegistryImpl.java:483) >at > org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$2.invoke(ServiceResourcesImpl.java:110)... > > > > - > 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
Re: Securing page with Tapestry
Are you defining your own ComponentRequestFilter interface? As you have included the code for that I am assuming you have. You have to implement Tapestry's ComponentRequestFilter, not your own as you can't contribute to the RequestHandler any other implementation. regards Taha On 06-Aug-2013, at 5:53 PM, Will N. wrote: > Am 06.08.2013 14:13, schrieb Thiago H de Paula Figueiredo: >> I'm sorry, I should have asked for your ComponentRequestFilter >> implementation source too. ;) >> >> On Tue, 06 Aug 2013 08:31:15 -0300, Will N. wrote: >> >>> Am 06.08.2013 13:25, schrieb Thiago H de Paula Figueiredo: On Tue, 06 Aug 2013 05:10:37 -0300, Will N. wrote: > Hi, Hi! > I am trying secure some pages of my application as shown in this > tutorial. http://tapestryjava.blogspot.co.uk/search/label/security > But I am having following error message when I start the application. > Since the RequiresLoginFilte class implements the ComponentRequestFilter > interface, I am confused about the coertion error! The error is weird. Could you post your PmsModule.contributeComponentRequestHandler() method >>> /** >>> * This module is automatically included as part of the Tapestry IoC >>> Registry, >>> * it's a good place to configure and extend Tapestry, or to place your own >>> * service definitions. spring >>> */ >>> public class PmsModule { >>> //public static void bind(ServiceBinder binder) { >>> //// binder.bind(MyServiceInterface.class, MyServiceImpl.class); >>> // >>> //// Make bind() calls on the binder object to define most IoC >>> services. >>> //// Use service builder methods (example below) when the >>> implementation >>> //// is provided inline, or requires more initialization than simply >>> //// invoking the constructor. >>> //binder.bind(ArbeitspaketDao.class, ArbeitspaketDaoImpl.class); >>> //binder.bind(AufgabeDao.class, AufgabeDaoImpl.class); >>> //binder.bind(BasicDao.class, BasicDaoImpl.class); >>> //binder.bind(FunktionDao.class, FunktionDaoImpl.class); >>> binder.bind(GrantedAuthorityBeanDao.class, >>> GrantedAuthorityBeanDaoImpl.class); >>> //binder.bind(MitarbeiterDao.class, MitarbeiterDaoImpl.class); >>> //binder.bind(MitarbeiterProjektDao.class, >>> //MitarbeiterProjektDaoImpl.class); >>> //binder.bind(ModulDao.class, ModulDaoImpl.class); >>> //binder.bind(PersonMonatDao.class, PersonMonatDaoImpl.class); >>> //binder.bind(UserDataDao.class, UserDataDaoImpl.class); >>> //binder.bind(ProjektDao.class, ProjektDaoImpl.class); >>> //binder.bind(UnteraufgabeDao.class, UnteraufgabeDaoImpl.class); >>> //binder.bind(UnterunteraufgabeDao.class, >>> UnterunteraufgabeDaoImpl.class); >>> // >>> //} >>> >>> public static void contributeFactoryDefaults( >>> MappedConfiguration configuration) { >>> // The application version number is incorprated into URLs for some >>> // assets. Web browsers will cache assets because of the far future >>> // expires >>> // header. If existing assets are changed, the version number should >>> // also >>> // change, to force the browser to download new versions. This >>> overrides >>> // Tapesty's default >>> // (a random hexadecimal number), but may be further overriden by >>> // DevelopmentModule or >>> // QaModule. >>> configuration.override(SymbolConstants.APPLICATION_VERSION, >>> "1.0-SNAPSHOT"); >>> } >>> >>> public static void contributeApplicationDefaults( >>> MappedConfiguration configuration) { >>> // Contributions to ApplicationDefaults will override any >>> contributions >>> // to >>> // FactoryDefaults (with the same key). Here we're restricting the >>> // supported >>> // locales to just "en" (English). As you add localised message >>> catalogs >>> // and other assets, >>> // you can extend this list of locales (it's a comma separated >>> series of >>> // locale names; >>> // the first locale name is the default when there's no reasonable >>> // match). >>> // configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en"); >>> configuration.add(SymbolConstants.SUPPORTED_LOCALES, "de"); >>> configuration.add(SymbolConstants.COMPRESS_WHITESPACE, "true"); >>> >>> } >>> >>> /** >>> * This is a service definition, the service will be named >>> "TimingFilter". >>> * The interface, RequestFilter, is used within the RequestHandler >>> service >>> * pipeline, which is built from the RequestHandler service >>> configuration. >>> * Tapestry IoC is responsible for passing in an appropriate Logger >>> * instance. Requests for static resources
Re: Securing page with Tapestry
Am 06.08.2013 14:13, schrieb Thiago H de Paula Figueiredo: I'm sorry, I should have asked for your ComponentRequestFilter implementation source too. ;) On Tue, 06 Aug 2013 08:31:15 -0300, Will N. wrote: Am 06.08.2013 13:25, schrieb Thiago H de Paula Figueiredo: On Tue, 06 Aug 2013 05:10:37 -0300, Will N. wrote: Hi, Hi! I am trying secure some pages of my application as shown in this tutorial. http://tapestryjava.blogspot.co.uk/search/label/security But I am having following error message when I start the application. Since the RequiresLoginFilte class implements the ComponentRequestFilter interface, I am confused about the coertion error! The error is weird. Could you post your PmsModule.contributeComponentRequestHandler() method /** * This module is automatically included as part of the Tapestry IoC Registry, * it's a good place to configure and extend Tapestry, or to place your own * service definitions. spring */ public class PmsModule { //public static void bind(ServiceBinder binder) { //// binder.bind(MyServiceInterface.class, MyServiceImpl.class); // //// Make bind() calls on the binder object to define most IoC services. //// Use service builder methods (example below) when the implementation //// is provided inline, or requires more initialization than simply //// invoking the constructor. //binder.bind(ArbeitspaketDao.class, ArbeitspaketDaoImpl.class); //binder.bind(AufgabeDao.class, AufgabeDaoImpl.class); //binder.bind(BasicDao.class, BasicDaoImpl.class); //binder.bind(FunktionDao.class, FunktionDaoImpl.class); binder.bind(GrantedAuthorityBeanDao.class, GrantedAuthorityBeanDaoImpl.class); //binder.bind(MitarbeiterDao.class, MitarbeiterDaoImpl.class); //binder.bind(MitarbeiterProjektDao.class, //MitarbeiterProjektDaoImpl.class); //binder.bind(ModulDao.class, ModulDaoImpl.class); //binder.bind(PersonMonatDao.class, PersonMonatDaoImpl.class); //binder.bind(UserDataDao.class, UserDataDaoImpl.class); //binder.bind(ProjektDao.class, ProjektDaoImpl.class); //binder.bind(UnteraufgabeDao.class, UnteraufgabeDaoImpl.class); //binder.bind(UnterunteraufgabeDao.class, UnterunteraufgabeDaoImpl.class); // //} public static void contributeFactoryDefaults( MappedConfiguration configuration) { // The application version number is incorprated into URLs for some // assets. Web browsers will cache assets because of the far future // expires // header. If existing assets are changed, the version number should // also // change, to force the browser to download new versions. This overrides // Tapesty's default // (a random hexadecimal number), but may be further overriden by // DevelopmentModule or // QaModule. configuration.override(SymbolConstants.APPLICATION_VERSION, "1.0-SNAPSHOT"); } public static void contributeApplicationDefaults( MappedConfiguration configuration) { // Contributions to ApplicationDefaults will override any contributions // to // FactoryDefaults (with the same key). Here we're restricting the // supported // locales to just "en" (English). As you add localised message catalogs // and other assets, // you can extend this list of locales (it's a comma separated series of // locale names; // the first locale name is the default when there's no reasonable // match). // configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en"); configuration.add(SymbolConstants.SUPPORTED_LOCALES, "de"); configuration.add(SymbolConstants.COMPRESS_WHITESPACE, "true"); } /** * This is a service definition, the service will be named "TimingFilter". * The interface, RequestFilter, is used within the RequestHandler service * pipeline, which is built from the RequestHandler service configuration. * Tapestry IoC is responsible for passing in an appropriate Logger * instance. Requests for static resources are handled at a higher level, so * this filter will only be invoked for Tapestry related requests. * * * Service builder methods are useful when the implementation is inline as * an inner class (as here) or require some other kind of special * initialization. In most cases, use the static bind() method instead. * * * If this method was named "build", then the service id would be taken from * the service interface and would be "RequestFilter". Since Tapestry * already defines a service named "RequestFilter" we use an explicit * service id that we can reference inside the contribution m
Re: Securing page with Tapestry
I'm sorry, I should have asked for your ComponentRequestFilter implementation source too. ;) On Tue, 06 Aug 2013 08:31:15 -0300, Will N. wrote: Am 06.08.2013 13:25, schrieb Thiago H de Paula Figueiredo: On Tue, 06 Aug 2013 05:10:37 -0300, Will N. wrote: Hi, Hi! I am trying secure some pages of my application as shown in this tutorial. http://tapestryjava.blogspot.co.uk/search/label/security But I am having following error message when I start the application. Since the RequiresLoginFilte class implements the ComponentRequestFilter interface, I am confused about the coertion error! The error is weird. Could you post your PmsModule.contributeComponentRequestHandler() method /** * This module is automatically included as part of the Tapestry IoC Registry, * it's a good place to configure and extend Tapestry, or to place your own * service definitions. spring */ public class PmsModule { //public static void bind(ServiceBinder binder) { //// binder.bind(MyServiceInterface.class, MyServiceImpl.class); // //// Make bind() calls on the binder object to define most IoC services. //// Use service builder methods (example below) when the implementation //// is provided inline, or requires more initialization than simply //// invoking the constructor. //binder.bind(ArbeitspaketDao.class, ArbeitspaketDaoImpl.class); //binder.bind(AufgabeDao.class, AufgabeDaoImpl.class); //binder.bind(BasicDao.class, BasicDaoImpl.class); //binder.bind(FunktionDao.class, FunktionDaoImpl.class); binder.bind(GrantedAuthorityBeanDao.class, GrantedAuthorityBeanDaoImpl.class); //binder.bind(MitarbeiterDao.class, MitarbeiterDaoImpl.class); //binder.bind(MitarbeiterProjektDao.class, //MitarbeiterProjektDaoImpl.class); //binder.bind(ModulDao.class, ModulDaoImpl.class); //binder.bind(PersonMonatDao.class, PersonMonatDaoImpl.class); //binder.bind(UserDataDao.class, UserDataDaoImpl.class); //binder.bind(ProjektDao.class, ProjektDaoImpl.class); //binder.bind(UnteraufgabeDao.class, UnteraufgabeDaoImpl.class); //binder.bind(UnterunteraufgabeDao.class, UnterunteraufgabeDaoImpl.class); // //} public static void contributeFactoryDefaults( MappedConfiguration configuration) { // The application version number is incorprated into URLs for some // assets. Web browsers will cache assets because of the far future // expires // header. If existing assets are changed, the version number should // also // change, to force the browser to download new versions. This overrides // Tapesty's default // (a random hexadecimal number), but may be further overriden by // DevelopmentModule or // QaModule. configuration.override(SymbolConstants.APPLICATION_VERSION, "1.0-SNAPSHOT"); } public static void contributeApplicationDefaults( MappedConfiguration configuration) { // Contributions to ApplicationDefaults will override any contributions // to // FactoryDefaults (with the same key). Here we're restricting the // supported // locales to just "en" (English). As you add localised message catalogs // and other assets, // you can extend this list of locales (it's a comma separated series of // locale names; // the first locale name is the default when there's no reasonable // match). // configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en"); configuration.add(SymbolConstants.SUPPORTED_LOCALES, "de"); configuration.add(SymbolConstants.COMPRESS_WHITESPACE, "true"); } /** * This is a service definition, the service will be named "TimingFilter". * The interface, RequestFilter, is used within the RequestHandler service * pipeline, which is built from the RequestHandler service configuration. * Tapestry IoC is responsible for passing in an appropriate Logger * instance. Requests for static resources are handled at a higher level, so * this filter will only be invoked for Tapestry related requests. * * * Service builder methods are useful when the implementation is inline as * an inner class (as here) or require some other kind of special * initialization. In most cases, use the static bind() method instead. * * * If this method was named "build", then the service id would be taken from * the service interface and would be "RequestFilter". Since Tapestry * already defines a service named "RequestFilter" we use an explicit * service id that we can reference inside the contribution method. */ p
Re: Securing page with Tapestry
Am 06.08.2013 13:25, schrieb Thiago H de Paula Figueiredo: On Tue, 06 Aug 2013 05:10:37 -0300, Will N. wrote: Hi, Hi! I am trying secure some pages of my application as shown in this tutorial. http://tapestryjava.blogspot.co.uk/search/label/security But I am having following error message when I start the application. Since the RequiresLoginFilte class implements the ComponentRequestFilter interface, I am confused about the coertion error! The error is weird. Could you post your PmsModule.contributeComponentRequestHandler() method /** * This module is automatically included as part of the Tapestry IoC Registry, * it's a good place to configure and extend Tapestry, or to place your own * service definitions. spring */ public class PmsModule { //public static void bind(ServiceBinder binder) { //// binder.bind(MyServiceInterface.class, MyServiceImpl.class); // //// Make bind() calls on the binder object to define most IoC services. //// Use service builder methods (example below) when the implementation //// is provided inline, or requires more initialization than simply //// invoking the constructor. //binder.bind(ArbeitspaketDao.class, ArbeitspaketDaoImpl.class); //binder.bind(AufgabeDao.class, AufgabeDaoImpl.class); //binder.bind(BasicDao.class, BasicDaoImpl.class); //binder.bind(FunktionDao.class, FunktionDaoImpl.class); binder.bind(GrantedAuthorityBeanDao.class, GrantedAuthorityBeanDaoImpl.class); //binder.bind(MitarbeiterDao.class, MitarbeiterDaoImpl.class); //binder.bind(MitarbeiterProjektDao.class, //MitarbeiterProjektDaoImpl.class); //binder.bind(ModulDao.class, ModulDaoImpl.class); //binder.bind(PersonMonatDao.class, PersonMonatDaoImpl.class); //binder.bind(UserDataDao.class, UserDataDaoImpl.class); //binder.bind(ProjektDao.class, ProjektDaoImpl.class); //binder.bind(UnteraufgabeDao.class, UnteraufgabeDaoImpl.class); //binder.bind(UnterunteraufgabeDao.class, UnterunteraufgabeDaoImpl.class); // //} public static void contributeFactoryDefaults( MappedConfiguration configuration) { // The application version number is incorprated into URLs for some // assets. Web browsers will cache assets because of the far future // expires // header. If existing assets are changed, the version number should // also // change, to force the browser to download new versions. This overrides // Tapesty's default // (a random hexadecimal number), but may be further overriden by // DevelopmentModule or // QaModule. configuration.override(SymbolConstants.APPLICATION_VERSION, "1.0-SNAPSHOT"); } public static void contributeApplicationDefaults( MappedConfiguration configuration) { // Contributions to ApplicationDefaults will override any contributions // to // FactoryDefaults (with the same key). Here we're restricting the // supported // locales to just "en" (English). As you add localised message catalogs // and other assets, // you can extend this list of locales (it's a comma separated series of // locale names; // the first locale name is the default when there's no reasonable // match). // configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en"); configuration.add(SymbolConstants.SUPPORTED_LOCALES, "de"); configuration.add(SymbolConstants.COMPRESS_WHITESPACE, "true"); } /** * This is a service definition, the service will be named "TimingFilter". * The interface, RequestFilter, is used within the RequestHandler service * pipeline, which is built from the RequestHandler service configuration. * Tapestry IoC is responsible for passing in an appropriate Logger * instance. Requests for static resources are handled at a higher level, so * this filter will only be invoked for Tapestry related requests. * * * Service builder methods are useful when the implementation is inline as * an inner class (as here) or require some other kind of special * initialization. In most cases, use the static bind() method instead. * * * If this method was named "build", then the service id would be taken from * the service interface and would be "RequestFilter". Since Tapestry * already defines a service named "RequestFilter" we use an explicit * service id that we can reference inside the contribution method. */ public RequestFilter buildTimingFilter(final Logger log) { return new RequestFilter() { public boolean service(Request request, Response response, RequestHandler handler) throws IOException { lon
Re: Securing page with Tapestry
On Tue, 06 Aug 2013 05:10:37 -0300, Will N. wrote: Hi, Hi! I am trying secure some pages of my application as shown in this tutorial. http://tapestryjava.blogspot.co.uk/search/label/security But I am having following error message when I start the application. Since the RequiresLoginFilte class implements the ComponentRequestFilter interface, I am confused about the coertion error! The error is weird. Could you post your PmsModule.contributeComponentRequestHandler() method please? -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Securing page with Tapestry
Hi, I am trying secure some pages of my application as shown in this tutorial. http://tapestryjava.blogspot.co.uk/search/label/security But I am having following error message when I start the application. Since the RequiresLoginFilte class implements the ComponentRequestFilter interface, I am confused about the coertion error! [ERROR] ioc.Registry Error invoking service contribution method com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration): Could not find a coercion from type com.example.pms.services.RequiresLoginFilter to type org.apache.tapestry5.services.ComponentRequestFilter. [ERROR] ioc.Registry Operations trace: [ERROR] ioc.Registry [ 1] Realizing service ComponentRequestHandler [ERROR] ioc.Registry [ 2] Instantiating service ComponentRequestHandler implementation via org.apache.tapestry5.services.TapestryModule.buildComponentRequestHandler(List, ComponentRequestHandlerTerminator, Logger) (at TapestryModule.java:2690) [ERROR] ioc.Registry [ 3] Creating plan to invoke public org.apache.tapestry5.services.ComponentRequestHandler org.apache.tapestry5.services.TapestryModule.buildComponentRequestHandler(java.util.List,org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator,org.slf4j.Logger) [ERROR] ioc.Registry [ 4] Determining injection value for parameter #1 (java.util.List) [ERROR] ioc.Registry [ 5] Collecting ordered configuration for service ComponentRequestHandler [ERROR] ioc.Registry [ 6] Invoking com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration) (at PmsModule.java:146) [ERROR] TapestryModule.ComponentRequestHandler Construction of service ComponentRequestHandler failed: Error invoking service contribution method com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration): Could not find a coercion from type com.example.pms.services.RequiresLoginFilter to type org.apache.tapestry5.services.ComponentRequestFilter. org.apache.tapestry5.ioc.internal.OperationException: Error invoking service contribution method com.example.pms.services.PmsModule.contributeComponentRequestHandler(OrderedConfiguration): Could not find a coercion from type com.example.pms.services.RequiresLoginFilter to type org.apache.tapestry5.services.ComponentRequestFilter. at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:47) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:76) at org.apache.tapestry5.ioc.internal.RegistryImpl.addToOrderedConfiguration(RegistryImpl.java:629) at org.apache.tapestry5.ioc.internal.RegistryImpl.getOrderedConfiguration(RegistryImpl.java:483) at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$2.invoke(ServiceResourcesImpl.java:110)... - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org