Return-Path: X-Original-To: apmail-roller-user-archive@www.apache.org Delivered-To: apmail-roller-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B053F4F81 for ; Wed, 29 Jun 2011 16:46:42 +0000 (UTC) Received: (qmail 15300 invoked by uid 500); 29 Jun 2011 16:46:42 -0000 Delivered-To: apmail-roller-user-archive@roller.apache.org Received: (qmail 15212 invoked by uid 500); 29 Jun 2011 16:46:41 -0000 Mailing-List: contact user-help@roller.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@roller.apache.org Delivered-To: mailing list user@roller.apache.org Received: (qmail 15203 invoked by uid 99); 29 Jun 2011 16:46:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jun 2011 16:46:41 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [62.196.48.11] (HELO mx02.infracom.it) (62.196.48.11) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jun 2011 16:46:34 +0000 Received: from EXCHTMI02.iex.lcl (192.168.212.137) by mx02.infracom.it (62.196.48.11) with Microsoft SMTP Server (TLS) id 8.2.255.0; Wed, 29 Jun 2011 18:44:54 +0200 Received: from EXCMBMI01.iex.lcl ([192.168.212.140]) by EXCHTMI02.iex.lcl ([192.168.212.137]) with mapi; Wed, 29 Jun 2011 18:46:07 +0200 From: Scappatura Rocco To: "user@roller.apache.org" Date: Wed, 29 Jun 2011 18:46:06 +0200 Subject: RE: Comment authentication problem Thread-Topic: Comment authentication problem Thread-Index: AcwzOp4LZfWemY+wTBGIe4HT/wMR+QADbU+wALkJm2A= Message-ID: <0823F40AC6FB5C4DA45102360349C21559D7BF24@EXCMBMI01.iex.lcl> References: <0823F40AC6FB5C4DA45102360349C21558CD6EFC@EXCMBMI01.iex.lcl> <52758.10.72.252.99.1308007920.squirrel@webmail.sttspa.it> <51139.10.3.252.70.1308214049.squirrel@webmail.sttspa.it> <0823F40AC6FB5C4DA45102360349C21559AF95B8@EXCMBMI01.iex.lcl> <0823F40AC6FB5C4DA45102360349C21559AF98BF@EXCMBMI01.iex.lcl> <0823F40AC6FB5C4DA45102360349C21559AF99FB@EXCMBMI01.iex.lcl> <0823F40AC6FB5C4DA45102360349C21559AF9A6E@EXCMBMI01.iex.lcl> <0823F40AC6FB5C4DA45102360349C21559C27556@EXCMBMI01.iex.lcl> <0823F40AC6FB5C4DA45102360349C21559C27559@EXCMBMI01.iex.lcl> In-Reply-To: <0823F40AC6FB5C4DA45102360349C21559C27559@EXCMBMI01.iex.lcl> Accept-Language: it-IT Content-Language: it-IT X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: it-IT Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Hello Dave, do you figure out why I can't see any debug information in my log file even= after I compile my authentication module=20 > -----Original Message----- > From: Scappatura Rocco [mailto:Rocco.Scappatura@infracom.it] > Sent: Saturday, June 25, 2011 5:03 PM > To: user@roller.apache.org > Subject: RE: Comment authentication problem >=20 > > -----Original Message----- > > From: Dave [mailto:snoopdave@gmail.com] > > Sent: Saturday, June 25, 2011 3:20 PM > > To: user@roller.apache.org > > Subject: Re: Comment authentication problem > > > > I believe your package name should be this: > > > > package org.rocsca; >=20 > You have right.. I'm sorry for the trivial error. >=20 > I have succesfull compiled the class, jarred it into rocsca.jar and put i= t > into %ROLLER%\WEB-INF\lib. >=20 > Into my roller-custom.properties I have: >=20 > comment.authenticator.classname=3Dorg.rocsca.MathCommentAuthenticator >=20 > log4j.category.org.apache.roller.weblogger.ui.rendering.plugins.comments= =3DDEBUG >=20 > But also after have restarted roller application, I cant see any debug > messages into roller.log file.. >=20 > It is possible that rocsca.jar archive has not been loaded? Or what else = it > can be happened? >=20 > Thanks, >=20 > > - Dave >=20 > rocsca >=20 > > > > On Sat, Jun 25, 2011 at 9:07 AM, Scappatura Rocco > > wrote: > > >> -----Original Message----- > > >> From: Dave [mailto:snoopdave@gmail.com] > > >> Sent: Wednesday, June 22, 2011 9:02 PM > > >> To: user@roller.apache.org > > >> Subject: Re: Comment authentication problem > > >> > > >> Looks like my original suggestion should work for you: > > >> Add this to your imports: > > >> > > >> =A0 =A0 import > > >> > > > org.apache.roller.weblogger.ui.rendering.plugins.comments.CommentAuthenti= cator > > > > > > Hello, > > > > > > compiling is success full but I get this runtime error: > > > > > > java.lang.NoClassDefFoundError: org/rocsca/MathCommentAuthenticator (= wrong > > name: org/rocsca/MathCommentAuthenticator/MathCommentAuthenticator) > > > =A0 =A0 =A0 =A0java.lang.ClassLoader.defineClass1(Native Method) > > > =A0 =A0 =A0 =A0java.lang.ClassLoader.defineClass(Unknown Source) > > > =A0 =A0 =A0 =A0java.security.SecureClassLoader.defineClass(Unknown So= urce) > > > > > > =A0org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappC= lassLoa > > der.java:1880) > > > > > > =A0org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoad= er.java > > :889) > > > > > > =A0org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoad= er.java > > :1353) > > > > > > =A0org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoad= er.java > > :1232) > > > =A0 =A0 =A0 =A0java.lang.ClassLoader.loadClassInternal(Unknown Source= ) > > > =A0 =A0 =A0 =A0java.lang.Class.forName0(Native Method) > > > =A0 =A0 =A0 =A0java.lang.Class.forName(Unknown Source) > > > > > > =A0org.apache.roller.weblogger.ui.rendering.servlets.CommentServlet.init(= Comment > > Servlet.java:91) > > > > > > =A0org.apache.roller.weblogger.ui.rendering.WeblogRequestMapper.handleReq= uest(We > > blogRequestMapper.java:231) > > > > > > =A0org.apache.roller.weblogger.ui.rendering.filters.RequestMappingFilter.= doFilte > > r(RequestMappingFilter.java:128) > > > > > > =A0org.apache.roller.weblogger.ui.core.filters.InitFilter.doFilter(InitFi= lter.ja > > va:71) > > > > > > =A0org.apache.roller.weblogger.ui.core.filters.PersistenceSessionFilter.d= oFilter > > (PersistenceSessionFilter.java:60) > > > > > > =A0org.apache.roller.weblogger.ui.core.filters.BootstrapFilter.doFilter(B= ootstra > > pFilter.java:67) > > > > > > =A0org.springframework.security.util.FilterChainProxy$VirtualFilterChain.= doFilte > > r(FilterChainProxy.java:378) > > > > > > =A0org.springframework.security.intercept.web.FilterSecurityInterceptor.i= nvoke(F > > ilterSecurityInterceptor.java:109) > > > > > > =A0org.springframework.security.intercept.web.FilterSecurityInterceptor.d= oFilter > > (FilterSecurityInterceptor.java:83) > > > > > > =A0org.springframework.security.util.FilterChainProxy$VirtualFilterChain.= doFilte > > r(FilterChainProxy.java:390) > > > > > > =A0org.springframework.security.ui.SessionFixationProtectionFilter.doFilt= erHttp( > > SessionFixationProtectionFilter.java:52) > > > > > > =A0org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSe= curityF > > ilter.java:53) > > > > > > =A0org.springframework.security.util.FilterChainProxy$VirtualFilterChain.= doFilte > > r(FilterChainProxy.java:390) > > > > > > =A0org.springframework.security.ui.ExceptionTranslationFilter.doFilterHtt= p(Excep > > tionTranslationFilter.java:101) > > > > > > =A0org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSe= curityF > > ilter.java:53) > > > > > > =A0org.springframework.security.util.FilterChainProxy$VirtualFilterChain.= doFilte > > r(FilterChainProxy.java:390) > > > > > > =A0org.springframework.security.ui.rememberme.RememberMeProcessingFilter.= doFilte > > rHttp(RememberMeProcessingFilter.java:109) > > > > > > =A0org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSe= curityF > > ilter.java:53) > > > > > > =A0org.springframework.security.util.FilterChainProxy$VirtualFilterChain.= doFilte > > r(FilterChainProxy.java:390) > > > > > > =A0org.springframework.security.wrapper.SecurityContextHolderAwareRequest= Filter. > > doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91) > > > > > > =A0org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSe= curityF > > ilter.java:53) > > > > > > =A0org.springframework.security.util.FilterChainProxy$VirtualFilterChain.= doFilte > > r(FilterChainProxy.java:390) > > > > > > =A0org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(= Abstrac > > tProcessingFilter.java:278) > > > > > > =A0org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSe= curityF > > ilter.java:53) > > > > > > =A0org.springframework.security.util.FilterChainProxy$VirtualFilterChain.= doFilte > > r(FilterChainProxy.java:390) > > > > > > =A0org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(= Abstrac > > tProcessingFilter.java:278) > > > > > > =A0org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSe= curityF > > ilter.java:53) > > > > > > =A0org.springframework.security.util.FilterChainProxy$VirtualFilterChain.= doFilte > > r(FilterChainProxy.java:390) > > > > > > =A0org.springframework.security.context.HttpSessionContextIntegrationFilt= er.doFi > > lterHttp(HttpSessionContextIntegrationFilter.java:235) > > > > > > =A0org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSe= curityF > > ilter.java:53) > > > > > > =A0org.springframework.security.util.FilterChainProxy$VirtualFilterChain.= doFilte > > r(FilterChainProxy.java:390) > > > > > > =A0org.springframework.security.util.FilterChainProxy.doFilter(FilterChai= nProxy. > > java:175) > > > > > > =A0org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(De= legatin > > gFilterProxy.java:236) > > > > > > =A0org.springframework.web.filter.DelegatingFilterProxy.doFilter(Delegati= ngFilte > > rProxy.java:167) > > > > > > =A0org.apache.roller.weblogger.ui.core.filters.SchemeEnforcementFilter.do= Filter( > > SchemeEnforcementFilter.java:121) > > > > > > =A0org.apache.roller.weblogger.ui.core.filters.CharEncodingFilter.doFilte= r(CharE > > ncodingFilter.java:81) > > > > > >> - Dave > > > > > > Rocsca > > > > > >> On Tue, Jun 21, 2011 at 3:30 AM, Scappatura Rocco > > >> wrote: > > >> >> -----Original Message----- > > >> >> From: Dave [mailto:snoopdave@gmail.com] > > >> >> Sent: Monday, June 20, 2011 10:09 PM > > >> >> To: user@roller.apache.org > > >> >> Subject: Re: Comment authentication problem > > >> >> > > >> >> Unfortunately, we don't accept attachments. > > >> >> Please paste into an email message. > > >> > > > >> > package org.rocsca.MathCommentAuthenticator; > > >> > > > >> > import java.util.ResourceBundle; > > >> > import javax.servlet.http.HttpServletRequest; > > >> > import javax.servlet.http.HttpSession; > > >> > import org.apache.commons.logging.Log; > > >> > import org.apache.commons.logging.LogFactory; > > >> > > > >> > > > >> > /** > > >> > =A0* Asks the commenter to answer a simple math question. > > >> > =A0*/ > > >> > public class MathCommentAuthenticator implements CommentAuthentica= tor { > > >> > > > >> > =A0 =A0private transient ResourceBundle bundle =3D > > >> > =A0 =A0 =A0 =A0 =A0 =A0ResourceBundle.getBundle("ApplicationResour= ces"); > > >> > > > >> > =A0 =A0private static Log mLogger =3D > > >> LogFactory.getLog(MathCommentAuthenticator.class); > > >> > > > >> > > > >> > =A0 =A0public String getHtml(HttpServletRequest request) { > > >> > > > >> > =A0 =A0 =A0 =A0String answer =3D ""; > > >> > > > >> > =A0 =A0 =A0 =A0HttpSession session =3D request.getSession(true); > > >> > =A0 =A0 =A0 =A0if (session.getAttribute("mathAnswer") =3D=3D null)= { > > >> > =A0 =A0 =A0 =A0 =A0 =A0// starting a new test > > >> > =A0 =A0 =A0 =A0 =A0 =A0int value1 =3D (int)(Math.random()*10.0); > > >> > =A0 =A0 =A0 =A0 =A0 =A0int value2 =3D (int)(Math.random()*100.0); > > >> > =A0 =A0 =A0 =A0 =A0 =A0int sum =3D value1 + value2; > > >> > =A0 =A0 =A0 =A0 =A0 =A0session.setAttribute("mathValue1", new Inte= ger(value1)); > > >> > =A0 =A0 =A0 =A0 =A0 =A0session.setAttribute("mathValue2", new Inte= ger(value2)); > > >> > =A0 =A0 =A0 =A0 =A0 =A0session.setAttribute("mathAnswer", new Inte= ger(sum)); > > >> > =A0 =A0 =A0 =A0} else { > > >> > =A0 =A0 =A0 =A0 =A0 =A0// preserve user's answer > > >> > =A0 =A0 =A0 =A0 =A0 =A0answer =3D request.getParameter("answer"); > > >> > =A0 =A0 =A0 =A0 =A0 =A0answer =3D (answer =3D=3D null) ? "" : answ= er; > > >> > =A0 =A0 =A0 =A0} > > >> > > > >> > =A0 =A0 =A0 =A0// pull existing values out of session > > >> > =A0 =A0 =A0 =A0Integer value1o =3D > > >> (Integer)request.getSession().getAttribute("mathValue1"); > > >> > =A0 =A0 =A0 =A0Integer value2o =3D > > >> (Integer)request.getSession().getAttribute("mathValue2"); > > >> > > > >> > =A0 =A0 =A0 =A0StringBuffer sb =3D new StringBuffer(); > > >> > > > >> > =A0 =A0 =A0 =A0sb.append("

"); > > >> > > =A0sb.append(bundle.getString("comments.mathAuthenticatorQuestion")); > > >> > =A0 =A0 =A0 =A0sb.append("

"); > > >> > =A0 =A0 =A0 =A0sb.append(value1o); > > >> > =A0 =A0 =A0 =A0sb.append(" + "); > > >> > =A0 =A0 =A0 =A0sb.append(value2o); > > >> > =A0 =A0 =A0 =A0sb.append(" =3D "); > > >> > =A0 =A0 =A0 =A0sb.append(" > >> > =A0 =A0 =A0 =A0sb.append(answer); > > >> > =A0 =A0 =A0 =A0sb.append("\" />

"); > > >> > =A0 =A0 =A0 =A0sb.append(" > >> > =A0 =A0 =A0 =A0sb.append(mathAnswer); > > >> > =A0 =A0 =A0 =A0sb.append("\" />"); > > >> > > > >> > =A0 =A0 =A0 =A0return sb.toString(); > > >> > =A0 =A0} > > >> > > > >> > > > >> > =A0 =A0public boolean authenticate(HttpServletRequest request) { > > >> > > > >> > =A0 =A0 =A0 =A0boolean authentic =3D false; > > >> > > > >> > =A0 =A0 =A0 =A0HttpSession session =3D request.getSession(false); > > >> > =A0 =A0 =A0 =A0String answerString =3D request.getParameter("answe= r"); > > >> > > > >> > =A0 =A0 =A0 =A0if (answerString !=3D null && session !=3D null) { > > >> > =A0 =A0 =A0 =A0 =A0 =A0try { > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0int answer =3D Integer.parseInt(ans= werString); > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Integer sum =3D (Integer) > > session.getAttribute("mathAnswer"); > > >> > > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (mathAnswerString !=3D null && a= nswer =3D=3D > > >> Integer.parseInt(mathAnswerString)) { > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0authentic =3D true; > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.removeAttribute("ma= thAnswer"); > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.removeAttribute("ma= thValue1"); > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.removeAttribute("ma= thValue2"); > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > > >> > =A0 =A0 =A0 =A0 =A0 =A0} catch (NumberFormatException ignored) { > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// ignored ... someone is just real= ly bad at math > > >> > =A0 =A0 =A0 =A0 =A0 =A0} catch (Exception e) { > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// unexpected > > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mLogger.error(e); > > >> > =A0 =A0 =A0 =A0 =A0 =A0} > > >> > =A0 =A0 =A0 =A0} > > >> > > > >> > =A0 =A0 =A0 =A0return authentic; > > >> > =A0 =A0} > > >> > > > >> > } > > >> > > > >> >> - Dave > > >> > > > >> > rocsca > > >> > > > >> >> > > >> >> > > >> >> > > >> >> On Mon, Jun 20, 2011 at 3:57 PM, Scappatura Rocco > > >> >> wrote: > > >> >> >> -----Original Message----- > > >> >> >> From: Dave [mailto:snoopdave@gmail.com] > > >> >> >> Sent: Monday, June 20, 2011 5:20 PM > > >> >> >> To: user@roller.apache.org > > >> >> >> Subject: Re: Comment authentication problem > > >> >> >> > > >> >> >> On Mon, Jun 20, 2011 at 9:28 AM, Scappatura Rocco > > >> >> >> wrote: > > >> >> >> >> > import java.util.ResourceBundle; > > >> >> >> >> > import javax.servlet.http.HttpServletRequest; > > >> >> >> >> > import javax.servlet.http.HttpSession; > > >> >> >> >> > import org.apache.commons.logging.Log; > > >> >> >> >> > import org.apache.commons.logging.LogFactory; > > >> >> >> >> > > >> >> >> >> I don't see any org.apache.roller packages there. > > >> >> >> >> > > >> >> >> >> What is the package name of the class your are defining? > > >> >> >> > package org.rocsca.MathCommentAuthenticator; > > >> >> >> > > >> >> >> The problem is that you code cannot find the "CommentAuthentic= ator" > > >> >> >> > > >> >> >> You might be able to fix this by adding this to your imports: > > >> >> >> =A0 =A0import > > >> >> >> > > >> >> > > >> > > > org.apache.roller.weblogger.ui.rendering.plugins.comments.CommentAuthenti= cator > > >> >> >> > > >> >> >> But it's hard to tell because I don't have your full source. > > >> >> > > > >> >> > Obviously my code is open source! :-P > > >> >> > > > >> >> > In attachment there is the java code. > > >> >> > > > >> >> >> Thanks, > > >> >> >> Dave > > >> >> > > > >> >> > Thanks to you! > > >> >> > rocsca > > >> >> > > > >> > > > >