Loading ...
Sorry, an error occurred while loading the content.

About Authenticate Dialog

Expand Messages
  • Kai
    Hi List, I am going to write a HTTP authentication by using mod_perl.And I wrote ... #!/usr/bin/perl -w use CGI; my $p=new CGI; print $p- header(-status= 401,
    Message 1 of 5 , Dec 8, 2003
    • 0 Attachment
      Hi List,
      I am going to write a HTTP authentication by using mod_perl.And I wrote
      some code like the following:
      ---
      #!/usr/bin/perl -w
      use CGI;
      my $p=new CGI;
      print $p->header(-status=>401,
      -www_authenticate='Basic realm="test area"',
      -type=>'text/html');
      ---
      Now,if I open this script,the brower will pop a authenticate box.
      I want to know,how can I get the id and password that the client inputed in
      that authenticate box .
      Would someone give any advice ?
      Thanx.

      Regards,
      Kai



      --
      Reporting bugs: http://perl.apache.org/bugs/
      Mail list info: http://perl.apache.org/maillist/modperl.html
    • Matthew Darwin
      In mod_perl 2: sub handler { my ($r) = shift; my ($res, $password) = ($r- get_basic_auth_pw); return $res if $res; #decline if not Basic my $username =
      Message 2 of 5 , Dec 8, 2003
      • 0 Attachment
        In mod_perl 2:

        sub handler {
        my ($r) = shift;

        my ($res, $password) = ($r->get_basic_auth_pw);
        return $res if $res; #decline if not Basic
        my $username = $r->user;

        if ($username eq '') {
        $r->note_basic_auth_failure;
        $r->log_error ("no account given for uri=<" . $r->uri . ">");
        return Apache::AUTH_REQUIRED;
        }

        # etc...

        return Apache::OK;
        }



        Kai wrote:
        > Hi List,
        > I am going to write a HTTP authentication by using mod_perl.And I wrote
        > some code like the following:
        > ---
        > #!/usr/bin/perl -w
        > use CGI;
        > my $p=new CGI;
        > print $p->header(-status=>401,
        > -www_authenticate='Basic realm="test area"',
        > -type=>'text/html');
        > ---
        > Now,if I open this script,the brower will pop a authenticate box.
        > I want to know,how can I get the id and password that the client inputed in
        > that authenticate box .
        > Would someone give any advice ?
        > Thanx.
        >
        > Regards,
        > Kai
        >
        >
        >

        --
        Matthew Darwin
        matthew@...
        http://www.mdarwin.ca

        --
        Reporting bugs: http://perl.apache.org/bugs/
        Mail list info: http://perl.apache.org/maillist/modperl.html
      • Geoffrey Young
        ... see http://www.modperlcookbook.org/code/ch13/Cookbook/Authenticate.pm you can also read the authentication chapter online for free
        Message 3 of 5 , Dec 8, 2003
        • 0 Attachment
          Kai wrote:
          > Hi List,
          > I am going to write a HTTP authentication by using mod_perl.

          > Now,if I open this script,the brower will pop a authenticate box.
          > I want to know,how can I get the id and password that the client inputed in
          > that authenticate box .
          > Would someone give any advice ?

          see

          http://www.modperlcookbook.org/code/ch13/Cookbook/Authenticate.pm

          you can also read the authentication chapter online for free

          http://www.modperlcookbook.org/chapters/ch13.pdf

          --Geoff


          --
          Reporting bugs: http://perl.apache.org/bugs/
          Mail list info: http://perl.apache.org/maillist/modperl.html
        • Kai
          Hi List, I am a newbie. I don t know howto invoke the following subroutine to complete authenticate. Would you give me a whole sample? Thanx a lot ! ...
          Message 4 of 5 , Jan 8, 2004
          • 0 Attachment
            Hi List,
            I am a newbie.
            I don't know howto invoke the following subroutine to complete
            authenticate.
            Would you give me a whole sample?
            Thanx a lot !

            > sub handler {
            > my ($r) = shift;
            >
            > my ($res, $password) = ($r->get_basic_auth_pw);
            > return $res if $res; #decline if not Basic
            > my $username = $r->user;
            >
            > if ($username eq '') {
            > $r->note_basic_auth_failure;
            > $r->log_error ("no account given for uri=<" . $r->uri . ">");
            > return Apache::AUTH_REQUIRED;
            > }
            >
            > # etc...
            >
            > return Apache::OK;
            > }



            Regards,
            Kai



            --
            Reporting bugs: http://perl.apache.org/bugs/
            Mail list info: http://perl.apache.org/maillist/modperl.html
          • Geoffrey Young
            ... see recipe 13.3 in the mod_perl developer s cookbook http://www.modperlcookbook.org/chapters/ch13.pdf as well as the many other books and docs listed on
            Message 5 of 5 , Jan 8, 2004
            • 0 Attachment
              Kai wrote:
              > Hi List,
              > I am a newbie.
              > I don't know howto invoke the following subroutine to complete
              > authenticate.
              > Would you give me a whole sample?

              see recipe 13.3 in the mod_perl developer's cookbook

              http://www.modperlcookbook.org/chapters/ch13.pdf

              as well as the many other books and docs listed on perl.apache.org

              HTH

              --Geoff


              --
              Reporting bugs: http://perl.apache.org/bugs/
              Mail list info: http://perl.apache.org/maillist/modperl.html
            Your message has been successfully submitted and would be delivered to recipients shortly.