ConsumerServlet as Action

125 views
Skip to first unread message

Dimas Cassimiro

unread,
Oct 19, 2009, 10:01:08 AM10/19/09
to openi...@googlegroups.com
Hi guys,

I've downloaded the servlet and jsp code avaliable on:
http://code.google.com/p/openid4java/source/browse/#svn/trunk/samples/consumer-servlet

So, it worked properly and it retrieved my openid account informations.
But then i tried to turn the ConsumerServlet code into an Action. (for enabling struts 2)

My Action is actually implementing ServletRequestAware and ServletResponseAware so i can get HttpServletRequest and HttpServletResponse as i used before on ConsumerServlet code. I'm also implementing Preparable interface so i can initialize my attributes as i did on init() method.

But after i login with my openId and redirect the request to my action, it then call methods processReturn and verifyResponse.
On verifyResponse method the code line above is throwing an Exception:

VerificationResult verification = manager.verify(receivingURL.toString(), response, discovered);

The Exception is:
[http-8080-1] ERROR org.openid4java.consumer.ConsumerManager - Verification fail
ed for: http://xxx.myopenid.com/ reason: Direct signature verification failed
where xxx is my openId

 As consequence, when it call:
 Identifier verified = verification.getVerifiedId();
 verified is actually null, so i can't get my openId informations.

Does anyone can help to solve it?

--
Dimas Cassimiro
Federal University of Campina Grande

Zhou Sutra

unread,
Oct 19, 2009, 1:39:58 PM10/19/09
to openi...@googlegroups.com
Set the openid4java log debug enabled follow this: http://code.google.com/p/openid4java/wiki/LoggingConfiguration

And then, paste the log here please.

Dimas Cassimiro

unread,
Oct 26, 2009, 2:30:10 PM10/26/09
to openi...@googlegroups.com
Hi Zhou,

I'll try configure my lo4j.properties like u said.
Meanwhile, does this log help?

 WARN - 2009-10-23 17:40:02,671 [http-8080-1] - (RealmVerifier.java:107) - RP discovery / realm validation disabled;
 INFO - 2009-10-23 17:40:03,093 [http-8080-1] - (Discovery.java:128) - Starting discovery on URL identifier: http://cnfcnf.myopenid.com/
 INFO - 2009-10-23 17:40:04,250 [http-8080-1] - (YadisResolver.java:245) - Yadis discovered 3 endpoints from: http://cnfcnf.myopenid.com/
 INFO - 2009-10-23 17:40:04,250 [http-8080-1] - (Discovery.java:151) - Discovered 3 OpenID endpoints.
 INFO - 2009-10-23 17:40:04,265 [http-8080-1] - (ConsumerManager.java:707) - Trying to associate with http://www.myopenid.com/server attempts left: 4
 WARN - 2009-10-23 17:40:04,265 [http-8080-1] - (ConsumerManager.java:894) - Could not create association of type: no-encryption:HMAC-SHA1:OpenID2
 WARN - 2009-10-23 17:40:04,265 [http-8080-1] - (ConsumerManager.java:894) - Could not create association of type: no-encryption:HMAC-SHA256:OpenID2
 INFO - 2009-10-23 17:40:05,281 [http-8080-1] - (ConsumerManager.java:804) - Associated with http://www.myopenid.com/server handle: {HMAC-SHA256}{4ae214a1}{kmOSew==}
 INFO - 2009-10-23 17:40:05,281 [http-8080-1] - (ConsumerManager.java:1065) - Creating authentication request for OP-endpoint: http://www.myopenid.com/server claimedID: http://cnfcnf.myopenid.com/ OP-specific ID: http://cnfcnf.myopenid.com/
 INFO - 2009-10-23 17:40:05,281 [http-8080-1] - (RealmVerifier.java:278) - Return URL: http://localhost:8080/SCS/jsp/openid/requerOpenIdLogin?is_return=true matches realm: http://localhost:8080/SCS/jsp/openid/requerOpenIdLogin?is_return=true
 WARN - 2009-10-23 17:40:05,296 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [org.apache.catalina.jsp_file]
 WARN - 2009-10-23 17:40:11,218 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [struts.valueStack]
 WARN - 2009-10-23 17:40:11,234 [http-8080-1] - (RealmVerifier.java:107) - RP discovery / realm validation disabled;
 INFO - 2009-10-23 17:40:11,390 [http-8080-1] - (LoginAction.java:313) - recieving url: http://localhost:8080/SCS/jsp/openid/requerOpenIdLogin?is_return=true&openid.assoc_handle=%7BHMAC-SHA256%7D%7B4ae214a1%7D%7BkmOSew%3D%3D%7D&openid.claimed_id=http%3A%2F%2Fcnfcnf.myopenid.com%2F&openid.identity=http%3A%2F%2Fcnfcnf.myopenid.com%2F&openid.mode=id_res&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.sreg=http%3A%2F%2Fopenid.net%2Fsreg%2F1.0&openid.op_endpoint=http%3A%2F%2Fwww.myopenid.com%2Fserver&openid.response_nonce=2009-10-23T20%3A40%3A07ZIOPD68&openid.return_to=http%3A%2F%2Flocalhost%3A8080%2FSCS%2Fjsp%2Fopenid%2FrequerOpenIdLogin%3Fis_return%3Dtrue&openid.sig=2S2p%2Bihk5L11jmfBtWWG8zfkU9adKSiQhsKZneH2LGw%3D&openid.signed=assoc_handle%2Cclaimed_id%2Cidentity%2Cmode%2Cns%2Cns.sreg%2Cop_endpoint%2Cresponse_nonce%2Creturn_to%2Csigned%2Csreg.country%2Csreg.email%2Csreg.fullname%2Csreg.gender%2Csreg.language%2Csreg.nickname%2Csreg.postcode%2Csreg.timezone&openid.sreg.country=US&openid.sreg.email=a%40a.com&openid.sreg.fullname=Test+Full+Name&openid.sreg.gender=M&openid.sreg.language=EN&openid.sreg.nickname=Test+NickName&openid.sreg.postcode=Test+Postal+Code&openid.sreg.timezone=America%2FJamaica
 INFO - 2009-10-23 17:40:11,390 [http-8080-1] - (LoginAction.java:314) - response: openid.op_endpoint:http://www.myopenid.com/server
openid.signed:assoc_handle,claimed_id,identity,mode,ns,ns.sreg,op_endpoint,response_nonce,return_to,signed,sreg.country,sreg.email,sreg.fullname,sreg.gender,sreg.language,sreg.nickname,sreg.postcode,sreg.timezone
openid.sig:2S2p+ihk5L11jmfBtWWG8zfkU9adKSiQhsKZneH2LGw=
openid.sreg.postcode:Test Postal Code
openid.response_nonce:2009-10-23T20:40:07ZIOPD68
openid.claimed_id:http://cnfcnf.myopenid.com/
openid.sreg.gender:M
openid.sreg.language:EN
openid.assoc_handle:{HMAC-SHA256}{4ae214a1}{kmOSew==}
openid.sreg.country:US
is_return:true
openid.sreg.fullname:Test Full Name
openid.sreg.nickname:Test NickName
openid.ns:http://specs.openid.net/auth/2.0
openid.sreg.timezone:America/Jamaica
openid.identity:http://cnfcnf.myopenid.com/
openid.ns.sreg:http://openid.net/sreg/1.0
openid.mode:id_res
openid.sreg.email:a...@a.com
openid.return_to:http://localhost:8080/SCS/jsp/openid/requerOpenIdLogin?is_return=true

 INFO - 2009-10-23 17:40:11,390 [http-8080-1] - (LoginAction.java:315) - discovered : OpenID2
OP-endpoint:http://www.myopenid.com/server
ClaimedID:http://cnfcnf.myopenid.com/
Delegate:http://cnfcnf.myopenid.com/
 INFO - 2009-10-23 17:40:11,390 [http-8080-1] - (ConsumerManager.java:1123) - Verifying authentication response...
 INFO - 2009-10-23 17:40:11,390 [http-8080-1] - (ConsumerManager.java:1147) - Received positive auth response.
 INFO - 2009-10-23 17:40:11,390 [http-8080-1] - (ConsumerManager.java:1801) - No association found, contacting the OP for direct verification...
ERROR - 2009-10-23 17:40:11,953 [http-8080-1] - (ConsumerManager.java:1853) - Verification failed for: http://cnfcnf.myopenid.com/ reason: Direct signature verification failed.
 WARN - 2009-10-23 17:40:11,953 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [org.apache.catalina.jsp_file]
 WARN - 2009-10-23 17:40:11,968 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [identifier]
 WARN - 2009-10-23 17:40:11,968 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [nickname]
 WARN - 2009-10-23 17:40:11,968 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [email]
 WARN - 2009-10-23 17:40:11,968 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [fullname]
 WARN - 2009-10-23 17:40:11,968 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [dob]
 WARN - 2009-10-23 17:40:11,968 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [gender]
 WARN - 2009-10-23 17:40:11,968 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [postcode]
 WARN - 2009-10-23 17:40:11,968 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [country]
 WARN - 2009-10-23 17:40:11,984 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [language]
 WARN - 2009-10-23 17:40:11,984 [http-8080-1] - (CommonsLogger.java:45) - Could not find property [timezone]

2009/10/19 Zhou Sutra <zhous...@gmail.com>

Sutra Zhou

unread,
Nov 6, 2009, 9:47:37 AM11/6/09
to openi...@googlegroups.com
2009/10/27 Dimas Cassimiro <dima...@gmail.com>:

Please ensure that the instance of ConsumerManager is constructed only
one time in the whole servlet lifetime.

Reply all
Reply to author
Forward
0 new messages