starena / jopenid

Automatically exported from code.google.com/p/jopenid
0 stars 0 forks source link

java.lang.IllegalArgumentException: Missing argument #25

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This occurs somewhat intermittently, I'm able to reproduce it using only the 
sample code.  Steps:

1. Open http://localhost:8080/sample/
2. Login using Yahoo, get successful authentication
3. Immediately clear the cache and try again

If you do it a few times, you will get this exception (or not, maybe it's just 
my computer)

500 Servlet Exception

[show] java.lang.IllegalArgumentException: Missing argument

java.lang.IllegalArgumentException: Missing argument
    at javax.crypto.spec.SecretKeySpec.<init>(DashoA13*..)
    at org.expressme.openid.OpenIdManager.getHmacSha1(OpenIdManager.java:170)
    at org.expressme.openid.OpenIdManager.getAuthentication(OpenIdManager.java:112)
    at jopenid.sample.OpenIdServlet.doGet(OpenIdServlet.java:54)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:96)
    at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
    at jopenid.sample.EncodingFilter.doFilter(EncodingFilter.java:24)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
    at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:811)
    at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1221)
    at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1177)
    at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1161)
    at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1084)
    at com.caucho.network.listen.TcpSocketLink.handleAcceptTask(TcpSocketLink.java:907)
    at com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:74)
    at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:97)
    at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:80)
    at com.caucho.network.listen.AcceptTask.run(AcceptTask.java:59)
    at com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:164)
    at com.caucho.env.thread.ResinThread.run(ResinThread.java:130)

Resin/4.0.25 Server: 'app-0'

Here's the Return-URL:

http://localhost:8080/sample/openid?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fau
th%2F2.0&openid.mode=id_res&openid.return_to=http%3A%2F%2Flocalhost%3A8080%2Fsam
ple%2Fopenid&openid.claimed_id=https%3A%2F%2Fme.yahoo.com%2Fa%2FXlvw4SQVwvTi_7GM
jd5GmxUUzr_i%231bac6&openid.identity=https%3A%2F%2Fme.yahoo.com%2Fa%2FXlvw4SQVwv
Ti_7GMjd5GmxUUzr_i&openid.assoc_handle=Qy3yfjXXhePIvr30olWBxFrYJm.qQfGgnvxvDP4DX
tDC4dmuNKyYyvgsimkANZJCae3tyDBg9TQbf.yM80HI6zfe1AhSIzUvYUey0WfT6HQ32oRv4Afcqcspn
xjb&openid.realm=http%3A%2F%2Flocalhost%3A8080%2F&openid.ns.ax=http%3A%2F%2Fopen
id.net%2Fsrv%2Fax%2F1.0&openid.ax.mode=fetch_response&openid.ax.value.email=ken_
love%40yahoo.com&openid.ax.value.fullname=Johnny%20Phan&openid.ax.value.language
=en-US&openid.ax.value.gender=M&openid.response_nonce=2012-02-27T13%3A10%3A22ZOg
BOjpj1sWrevul.iasWcyJgXiu14tE0ig--&openid.signed=assoc_handle%2Cclaimed_id%2Cide
ntity%2Cmode%2Cns%2Cop_endpoint%2Cresponse_nonce%2Creturn_to%2Csigned%2Cax.value
.email%2Cax.type.email%2Cax.value.fullname%2Cax.type.fullname%2Cax.value.languag
e%2Cax.type.language%2Cax.value.gender%2Cax.type.gender%2Cns.ax%2Cax.mode%2Cpape
.auth_level.nist&openid.op_endpoint=https%3A%2F%2Fopen.login.yahooapis.com%2Fope
nid%2Fop%2Fauth&openid.ax.type.email=http%3A%2F%2Faxschema.org%2Fcontact%2Femail
&openid.ax.type.fullname=http%3A%2F%2Faxschema.org%2FnamePerson&openid.ax.type.l
anguage=http%3A%2F%2Faxschema.org%2Fpref%2Flanguage&openid.ax.type.gender=http%3
A%2F%2Faxschema.org%2Fperson%2Fgender&openid.pape.auth_level.nist=0&openid.sig=8
a8w1KXaQCi3YXGpriZivAwzS%2BI%3D

Original issue reported on code.google.com by hai.phan on 27 Feb 2012 at 1:16

GoogleCodeExporter commented 8 years ago
OK, never mind, it happens because I was using the Back button.

But I discovered the real reason why it was occurring intermittently on my 
website.  I started out from "http://example.com" while my return-URL was 
"http://www.example.com", so that on the return the session could not be found, 
and the null HMAC was triggering the exception.

EXCEPT when the session COULD be found on the "www.example.com" from an earlier 
attempt, causing the intermittentness that kept me up till 5 this morning

Original comment by hai.phan on 27 Feb 2012 at 6:01

GoogleCodeExporter commented 8 years ago
It seems the best thing to do is set:

Realm = "*.example.com"
Return-URL = HttpServletRequest.getRequestURL()

Original comment by hai.phan on 27 Feb 2012 at 6:30

GoogleCodeExporter commented 8 years ago
Right, it has been specified in Main.java that "realm" and "return to" must be 
set.

Original comment by rpriyank...@gmail.com on 21 Aug 2012 at 9:58