File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jersey Restful Service and Form authentication

 
gabi gaminde
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to everybody,

I have a Apache Tomcat 7 running without problems. I have deployed two webapp, one of them is consuming some webservices than run in the order. I have added Form authentication and a jdbc realm (this is defined in the Server.xml of the server). The server is running in https:localhost:8443. I can't access the webservices with the browser and get the content. Prior to that I login with my form and all is fine. Now I am going to specify what I whant to do and the weird problem I am getting:

  • First of all both applications are running in the same server.
  • They use the same jdbc realm (server.xml).
  • They both use the same roles defined in the web.xml of each web application (each webapp has its own web.xml)
  • For creating the client I use this example: https://gist.github.com/outbounder/1069465




  • After login in the webapp I try to consume the restful service and the call returns the code of the login page of the other application! But if I stay in the same session with the browser open I can access the webservices as if I where logged correctly.


  • I have tried unccomenting the tomcat valve singlesignon but it doesn't work.



  • What I am doing wrong? Is there any special way to consume the webservice? I use:




    To be honest I am totally lost of what I am doing wrong as it seems I am correctly authenticated.

    Thanks in advance

     
    gabi gaminde
    Greenhorn
    Posts: 4
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi to everybody,

    I think I have found what happens. It seems that if I create a client, I have tried with jersey or ApacheHttpClient, it somehow creates a new instance of the browser session. That is why I get the login page again, because I don't have the username and password when I try to consume the service. This seems weird to me. Is it possible to pass the session data to the client or get the current session? The onbly solution that I have now is making the calls trough Ajax which leads to build most of the web applicacion again!
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic