Our web site is java-based :(, with jboss and tomcat :/, and one of the things this setup provides is a user authentication system, using the HttpSession javax servlet package (or class, or whatever it is), which maintains a persistent data structure on the server as the user navigates around our intranet.

A typical pattern of user behavior here is that you go to a url (a .jsp page) which is protected by the user-authentication setup, and that jsp page checks for your HttpSession to see if you're logged in; if not, you are redirected to a login page, and on successful login you get redirected back to the original url you wanted.

I want to write perl/CGI apps that can use the existing authentication, and I'm wondering if there is some way (via module or ad-hoc coding) to access the HttpSession data.

Presumably, I could impose on our java guru/maintainer to supply some other method or resource via java/jsp, to write a cookie for the user as part of the login process; then my CGI script could just look for that cookie (and redirect to the standard login page if it's not there, and hopefully get redirected back once the user logs in).

But when I asked the java guru, who knows as much about perl/CGI as I know about java (i.e. not enough), the first thing he suggested was: "well, just get your cgi script to read the HttpSession data..." (esp. things called "attributes" in that object). Well, I think that would be a great way to proceed, if in fact there is a way to do that.

Does anybody know if there is a way to do that?


In reply to CGI for (or against) HttpSession? by graff

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.