Plack-Middleware-LemonLDAP-BasicAuth

 view release on metacpan or  search on metacpan

lib/Plack/Middleware/LemonLDAP/BasicAuth.pm  view on Meta::CPAN


    my $soap_headers = HTTP::Headers->new( "X-Forwarded-For" => $xheader );

    my $soap = SOAP::Lite->proxy(
        $self->portal || '',
        default_headers => $soap_headers,
    )->uri('urn:Lemonldap::NG::Common::CGI::SOAPService');

    my $response = $soap->getCookies( $user, $password );
    my $cv;

    # Catch SOAP errors
    if ( $response->fault ) {
        return;
    }
    else {
        my $res = $response->result();

        # If authentication failed, display error
        if ( $res->{errorCode} ) {
            return;
        }

        $cv = $res->{cookies}->{ $self->cookiename };
    }

    return 1;
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Plack::Middleware::LemonLDAP::BasicAuth - Middleware to provide LemonLDAP support for Plack applications

=head1 VERSION

version 0.02

=head1 DESCRIPTION

LemonLDAP is a great tool to implement Single-Sign-On for webapplications.
Unfortunately it doesn't support nginx yet, but is tied to Apache (as it
is implemented using mod_perl handlers).

This middleware is one way to add LemonLDAP support for applications that
supports HTTP BasicAuth for authentication.

=head1 Example

One application that supports HTTP BasicAuth for authentication is 
L<OTRS|http://otrs.org>. It has a basic PSGI support so that you can run
it with L<Starman>.

  starman -e 'enable "LemonLDAP::BasicAuth", portal => "http://auth.example.com"' app.psgi

If no user is logged in, 

=head1 AUTHOR

Renee Bäcker <reneeb@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2014 by Renee Bäcker.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

=cut



( run in 0.930 second using v1.01-cache-2.11-cpan-e93a5daba3e )