It works!!!!

I don't get the point why it did not work the other way round, but now
everything is just fine now :

package Apache::AuthenIntra;

#use strict;
use     Apache::AuthenSmb;
use     Apache::AuthSybase;
use     Apache::Constants;

sub handler {
        my $r = shift;
        my($res, $sent_pw) = $r->get_basic_auth_pw;
        return $res if $res != OK;

        if (  Apache::AuthenSmb::handler($r) == OK ) {
                $r->log_reason("AuthenSmb is okay", $r->uri);
                return OK;
        } elsif ( Apache::AuthSybase::handler($r) == OK ) {
                $r->log_reason("AuthSybase is okay", $r->uri);
                return OK;
        }
        $r->note_basic_auth_failure;
        return AUTH_REQUIRED;
}
1;
__END__


Like this, you may take every authentication module you'd like, wether it
returns DECLINE or AUTH_REQUIRED and it will give an OK if one of the two
works.

Thanks to all who helped me!!!!

Marcel



-----Ursprüngliche Nachricht-----
Von: Stathy G. Touloumis [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 12. Februar 2002 21:17
An: Marcel Weber; [EMAIL PROTECTED]
Betreff: RE: Multiple authentication methods


That is odd, I would check the interface for the authentication modules and
be sure that they are being used properly.  It may help to also put in some
debug/trace statements to figure out where things are failing or not working
as expected : )

> This way, I do not get any failure messages, but the
> authenication does not
> work at all. Say, it does not matter wat password your typing in, you get
> always authenticated. Even when one auf the handlers logs a violation and
> return AUTH_REQUIRED / DECLINED.
>
> package Apache::AuthenIntra;
>
> use strict;
> use     Apache::AuthenSmb;
> use     Apache::AuthSybase;
> use     Apache::Constants;
>
> sub handler {
>         my $r = shift;
>         my($res, $sent_pw) = $r->get_basic_auth_pw;
>         return $res if $res != OK;
>
>         if (  Apache::AuthenSmb::handler($r) == Apache::Constants::OK ) {
>                 return Apache::Constants::OK;
>         } elsif ( Apache::AuthSybase::handler($r) ==
> Apache::Constants::OK )
> {
>                 return Apache::Constants::OK;
>         }
>         $r->note_basic_auth_failure;
>         return Apache::Constant::AUTH_REQUIRED;
> }
>
> Marcel
>
>
> -----Ursprüngliche Nachricht-----
> Von: Stathy G. Touloumis [mailto:[EMAIL PROTECTED]]
> Gesendet: Dienstag, 12. Februar 2002 18:32
> An: Marcel Weber; [EMAIL PROTECTED]
> Betreff: RE: Multiple authentication methods
>
>
> > The get_handlers code is out of AuthenSmb as I do not have the slightest
> > idea of how to get the results of the called function.
> Hmmm, It would seem that it would be better to call the function directly
> from your handler.  I am not sure how the AuthenSmb handlers should be
> called but you should get the idea.
>
> sub handler {
>   my $r = shift;
>   my($res, $sent_pw) = $r->get_basic_auth_pw;
>   return $res if $res != OK;
>
>   if ( Apache::AuthSybase->handler($r) == Apache::Constants::OK ) {
>     return Apache::Constants::OK;
>
>   } elsif ( Apache::AuthenSmb->handler($r) == Apache::Constants::OK ) {
>     return Apache::Constants::OK;
>
>   } else {
>     return Apache::Constant::DECLINED;
>
>   }
>
>
> }
>
> > I get just as far, as I can authenticate via AuthSybase, but the second
> > method is never executed. Well, probably some expirienced perl
> coder would
> > laugh at me...
>
> He he, we all had to start from the beginning ; )
>
>
> > Hmm, I fiddled a bit around whith this code but, it does not
> > really work the
> > way I want it to.
> >
> > This is what I coded:
> >
> > sub handler {
> >         my $r = shift;
> >         my($res, $sent_pw) = $r->get_basic_auth_pw;
> >         return $res if $res != OK;
> >
> >         $r->push_handlers( PerlAuthenHandler=> Apache::AuthSybase );
> >         if (@{ $r->get_handlers("PerlAuthenHandler") || []}) {
> >         return OK;
> >         }
> >         $r->push_handlers( PerlAuthenHandler=> Apache::AuthenSmb );
> >         if (@{ $r->get_handlers("PerlAuthenHandler") || []}) {
> >         return OK;
> >         }
> >         return DECLINED;
> > }
> >
> > The get_handlers code is out of AuthenSmb as I do not have the slightest
> > idea of how to get the results of the called function.
> >
> > What the code should do is: Call AuthSybase, check return value, if OK
> > return OK, else call AuthenSMB, return return value.
> >
>
>


Reply via email to