Clément OUDOT > Lemonldap-NG-Handler-1.2.3 > Lemonldap::NG::Handler::CGI

Download:
Lemonldap-NG-Handler-1.2.3.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.2.3   Source   Latest Release: Lemonldap-NG-Handler-1.4.2

NAME ^

Lemonldap::NG::Handler::CGI - Perl extension for using Lemonldap::NG authentication in Perl CGI without using Lemonldap::NG::Handler

SYNOPSIS ^

  use Lemonldap::NG::Handler::CGI;
  my $cgi = Lemonldap::NG::Handler::CGI->new ( {
      # Local storage used for sessions and configuration
      localStorage        => "Cache::FileCache",
      localStorageOptions => {...},
      # How to get my configuration
      configStorage       => {
          type                => "DBI",
          dbiChain            => "DBI:mysql:database=lemondb;host=$hostname",
          dbiUser             => "lemonldap",
          dbiPassword          => "password",
      },
      https               => 0,
      # Optional
      protection    => 'rule: $uid eq "admin"',
      # Or to use rules from manager
      protection    => 'manager',
      # Or just to authenticate without managing authorization
      protection    => 'authenticate',
    }
  );
  
  # Lemonldap::NG cookie validation (done if you set "protection")
  $cgi->authenticate();
  
  # Optional Lemonldap::NG authorization (done if you set "protection")
  $cgi->authorize();
  
  # See CGI(3) for more about writing HTML pages
  print $cgi->header;
  print $cgi->start_html;
  
  # Since authentication phase, you can use user attributes and macros
  my $name = $cgi->user->{cn};
  
  # Instead of using "$cgi->user->{groups} =~ /\badmin\b/", you can use
  if( $cgi->group('admin') ) {
    # special html code for admins
  }
  else {
    # another HTML code
  }

DESCRIPTION ^

Lemonldap::NG::Handler provides the protection part of Lemonldap::NG web-SSO system. It can be used with any system used with Apache (PHP or JSP pages for example). If you need to protect only few Perl CGI, you can use this library instead.

Warning, this module must not be used in a Lemonldap::NG::Handler protected area because it hides Lemonldap::NG cookies.

SEE ALSO ^

http://lemonldap-ng.org/ CGI, Lemonldap::NG::Handler, Lemonldap::NG::Manager, Lemonldap::NG::Portal

AUTHOR ^

Clement Oudot, <clem.oudot@gmail.com>
Xavier Guimard, <x.guimard@free.fr>
Sandro Cazzaniga, <cazzaniga.sandro@gmail.com>

BUG REPORT ^

Use OW2 system to report bug or ask for features: http://jira.ow2.org

DOWNLOAD ^

Lemonldap::NG is available at http://forge.objectweb.org/project/showfiles.php?group_id=274

COPYRIGHT AND LICENSE ^

Copyright (C) 2007, 2008, 2009, 2010, 2012 by Xavier Guimard, <x.guimard@free.fr>
Copyright (C) 2012 by Sandro Cazzaniga, <cazzaniga.sandro@gmail.com>
Copyright (C) 2010, 2011, 2012 by Clement Oudot, <clem.oudot@gmail.com>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

syntax highlighting: