example joid.war - how is the example app meant to work!?

13 views
Skip to first unread message

Alex Little

unread,
Nov 29, 2007, 7:29:27 AM11/29/07
to joid-dev
Hi,

I've deployed the joid.war and there are a few things I'm a bit
confused about in the example... (note that I'm using the actual url
in web.xml and when entering on forms etc - rather than localhost)

When I go to http://localhost:8080/joid I see the sample login page
and I enter an identity url, (eg http://lcoalhost:8080/joid/user/alex)
and then click login. At this point I could get a couple of different
things happen (I've not been able to work out the reasoning as to why
one or the other may happen). I might get an http500 error with the
message "user cannot claim this id". Alternatively I get taken to the
login form, which had at the top "Allow access to: null?". Again I'm a
bit confused (eaily done!), shouldn't this be giving me the URL of the
site I'm attempting to log in to. I'm assuming that as I'm using the
MemoryStore, I can just create a new user/password and this will exist
for the life of my tomcat server running?

If I create a new account, and click submit, I sometimes (but not
always!) get the message (in browser):
ns:http://specs.openid.net/auth/2.0
&mode:error&error:BAD_REQUEST

And in my tomcat console I get the error:
29-Nov-2007 12:25:45 org.verisign.joid.OpenId canHandle
INFO: org.verisign.joid.OpenIdException: Cannot parse request from
null
java.net.MalformedURLException
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at
org.verisign.joid.server.OpenIdServlet.returnError(OpenIdServlet.java:
212)
at
org.verisign.joid.server.OpenIdServlet.doQuery(OpenIdServlet.java:108)
at
org.verisign.joid.server.OpenIdServlet.doGet(OpenIdServlet.java:72)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:
689)
.....

I'm assuming this error is due to the fact it doesn't have the
trust_root/return_to URL?

Any help as to how to get this fixed would be much appreciated, or any
pointers as to where I'm going wrong :-)

Thanks,
Alex

Alex Little

unread,
Nov 29, 2007, 9:47:03 AM11/29/07
to joid-dev
For info I've got the bit about "Allow access to: null?" part resolved. The problem turned out to be in the login.jsp as it was looking for 'query' and 'openid.realm' in the request scope, but because the OpenIdServlet had forwarded to login.jsp and hadnt; added the query params - but tehy are in the session scope. So I added the following to the getParam method in login.jsp:

if(ret == null){
            HttpSession session = request.getSession ();
            ret = (String) session.getAttribute(s);        
        }

and that seemed to sort the 'null' error out. Please feel free to let me know if this isn't what I should have done!!

Think I'm getting there with it all ;-)
Alex

Hans Granqvist

unread,
Dec 6, 2007, 10:54:59 AM12/6/07
to joid...@googlegroups.com
Alex, do you have a patch (svn diff) for this that you want to commit?

-Hans

Alex Little

unread,
Dec 7, 2007, 4:44:37 AM12/7/07
to joid...@googlegroups.com
Hi Hans,

sure - see below for the diff patch (wasn't sure if this list accepted attachments) :-)

Alex

-----------------------
Index: D:/eclipse/workspace/JoidJar-SVN/examples/server/login.jsp
===================================================================
--- D:/eclipse/workspace/JoidJar-SVN/examples/server/login.jsp    (revision 78)
+++ D:/eclipse/workspace/JoidJar-SVN/examples/server/login.jsp    (working copy)
@@ -18,6 +18,12 @@
         if (ret == null) {
             ret = request.getParameter(s);
         }
+        // then try session
+        if(ret == null){
+            HttpSession session = request.getSession ();
+            ret = (String) session.getAttribute(s);
+           
+        }
         return ret;
     }
 
------------------------------------------------------------------------

> org.verisign.joid.server.OpenIdServlet.doQuery (OpenIdServlet.java:108)

michi

unread,
Jan 20, 2008, 5:34:06 PM1/20/08
to joid-dev


On Dec 7 2007, 10:44 am, "Alex Little" <alextlit...@googlemail.com>
wrote:
> Hi Hans,
>
> sure - see below for the diff patch (wasn't sure if this list accepted
> attachments) :-)

this patch seems to me makes a lot of sense, but hasn't been applied
yet. Can anyone apply this?

Thanks

Michael

>
> Alex
>
> -----------------------
> Index: D:/eclipse/workspace/JoidJar-SVN/examples/server/login.jsp
> ===================================================================
> --- D:/eclipse/workspace/JoidJar-SVN/examples/server/login.jsp (revision
> 78)
> +++ D:/eclipse/workspace/JoidJar-SVN/examples/server/login.jsp (working
> copy)
> @@ -18,6 +18,12 @@
> if (ret == null) {
> ret = request.getParameter(s);
> }
> + // then try session
> + if(ret == null){
> + HttpSession session = request.getSession();
> + ret = (String) session.getAttribute(s);
> +
> + }
> return ret;
> }
>
> ------------------------------------------------------------------------
>
> On Dec 6, 2007 3:54 PM, Hans Granqvist <h...@granqvist.com> wrote:
>
>
>
> > Alex, do you have a patch (svn diff) for this that you want to commit?
>
> > -Hans
>
> > On 11/29/07, Alex Little <alextlit...@googlemail.com> wrote:
> > > For info I've got the bit about "Allow access to: null?" part resolved.
> > The
> > > problem turned out to be in the login.jsp as it was looking for 'query'
> > and
> > > 'openid.realm' in the request scope, but because the OpenIdServlet had
> > > forwarded to login.jsp and hadnt; added the query params - but tehy are
> > in
> > > the session scope. So I added the following to the getParam method in
> > > login.jsp:
>
> > > if(ret == null){
> > > HttpSession session = request.getSession ();
> > > ret = (String) session.getAttribute(s);
> > > }
>
> > > and that seemed to sort the 'null' error out. Please feel free to let me
> > > know if this isn't what I should have done!!
>
> > > Think I'm getting there with it all ;-)
> > > Alex
>
> > > On Nov 29, 2007 12:29 PM, Alex Little <AlextLit...@googlemail.com>
> > wrote:
>
> > > > Hi,
>
> > > > I've deployed the joid.war and there are a few things I'm a bit
> > > > confused about in the example... (note that I'm using the actual url
> > > > in web.xml and when entering on forms etc - rather than localhost)
>
> > > > When I go tohttp://localhost:8080/joidI see the sample login page
> > > org.verisign.joid.server.OpenIdServlet.doQuery(OpenIdServlet.java:108)

Michael Wechner

unread,
Jan 20, 2008, 5:38:42 PM1/20/08
to joid...@googlegroups.com
michi wrote:

>
>On Dec 7 2007, 10:44 am, "Alex Little" <alextlit...@googlemail.com>
>wrote:
>
>
>>Hi Hans,
>>
>>sure - see below for the diff patch (wasn't sure if this list accepted
>>attachments) :-)
>>
>>
>
>this patch seems to me makes a lot of sense, but hasn't been applied
>yet. Can anyone apply this?
>
>

whereas I would suggest to slight enhance it

Index: examples/server/login.jsp
===================================================================
--- examples/server/login.jsp (Revision 80)
+++ examples/server/login.jsp (Arbeitskopie)
@@ -18,6 +18,10 @@


if (ret == null) {
ret = request.getParameter(s);
}

+ if (ret == null) {


+ HttpSession session = request.getSession();
+ ret = (String) session.getAttribute(s);
+ }

return ret;
}

@@ -105,7 +109,7 @@
value="<%=getParam(request, "openid.realm")%>"/>

<p>
- Allow access to: <%=getParam(request, "openid.realm")%>?
+ Allow access to: <a href="<%=getParam(request,
"openid.realm")%>"><%=getParam(request, "openid.realm")%></a>?
</p>
<table border="0">
<tr>
@@ -135,4 +139,4 @@
</p>

</body>


because otherwise the question mark could be confused with an empty
query string

Cheers

Michael


--
Michael Wechner
Wyona - Open Source Content Management - Yanel, Yulup
http://www.wyona.com
michael...@wyona.com, mi...@apache.org
+41 44 272 91 61

Travis Reeder

unread,
Jan 20, 2008, 6:23:24 PM1/20/08
to joid...@googlegroups.com
Ok, applied these patches and an old one from Alex that should fix your LiveJournal problem. 

Travis

michi

unread,
Jan 21, 2008, 4:48:48 PM1/21/08
to joid-dev


On Jan 21, 12:23 am, "Travis Reeder" <tree...@gmail.com> wrote:
> Ok, applied these patches

thanks very much

> and an old one from Alex that should fix your
> LiveJournal problem.

I think the problem still occurs, but will debug some more and let you
know about details asap

Thanks

Michael

>
> Travis
>
> On Jan 20, 2008 2:38 PM, Michael Wechner <michael.wech...@wyona.com> wrote:
>
>
>
> > michi wrote:
>
> > >On Dec 7 2007, 10:44 am, "Alex Little" <alextlit...@googlemail.com>
> > >wrote:
>
> > >>Hi Hans,
>
> > >>sure - see below for the diff patch (wasn't sure if this list accepted
> > >>attachments) :-)
>
> > >this patch seems to me makes a lot of sense, but hasn't been applied
> > >yet. Can anyone apply this?
>
> > whereas I would suggest to slight enhance it
>
> > Index: examples/server/login.jsp
> > ===================================================================
> > --- examples/server/login.jsp (Revision 80)
> > +++ examples/server/login.jsp (Arbeitskopie)
> > @@ -18,6 +18,10 @@
> > if (ret == null) {
> > ret = request.getParameter(s);
> > }
> > + if (ret == null) {
> > >>>>>When I go tohttp://localhost:8080/joidIsee the sample login page
> > michael.wech...@wyona.com, mi...@apache.org
Reply all
Reply to author
Forward
0 new messages