AuthCAS

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

use warnings;
use Module::Build;

my $builder = Module::Build->new(
    module_name         => 'AuthCAS',
    license             => 'perl',
    dist_author         => 'Olivier Salaun <os AT cru.fr>',
    dist_version_from   => 'lib/AuthCAS.pm',
    create_license    => 1,
    requires => {
        'IO::Socket::SSL' => 0,
    	'LWP::UserAgent' => 0,
    },
    build_requires    => {
        'Test::More' => 0,
    },
    add_to_cleanup      => [ 'AuthCAS-*' ],
    meta_add           => {
        resources => {
            homepage => 'https://sourcesup.renater.fr/projects/perlcas/',
            repository => 'https://subversion.renater.fr/perlcas/',

META.json  view on Meta::CPAN

            "Test::More" : "0"
         }
      },
      "configure" : {
         "requires" : {
            "Module::Build" : "0.42"
         }
      },
      "runtime" : {
         "requires" : {
            "IO::Socket::SSL" : "0",
            "LWP::UserAgent" : "0"
         }
      }
   },
   "provides" : {
      "AuthCAS" : {
         "file" : "lib/AuthCAS.pm",
         "version" : "1.7"
      }
   },

META.yml  view on Meta::CPAN

license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: AuthCAS
provides:
  AuthCAS:
    file: lib/AuthCAS.pm
    version: '1.7'
requires:
  IO::Socket::SSL: '0'
  LWP::UserAgent: '0'
resources:
  homepage: https://sourcesup.renater.fr/projects/perlcas/
  repository: https://subversion.renater.fr/perlcas/
version: '1.7'

Makefile.PL  view on Meta::CPAN

use strict;
use warnings;
use ExtUtils::MakeMaker;

WriteMakefile(
    NAME                => 'AuthCAS',
    AUTHOR              => 'Olivier Salaun <os AT cru.fr>',
    VERSION_FROM        => 'lib/AuthCAS.pm',
    ABSTRACT_FROM       => 'lib/AuthCAS.pm',
    PREREQ_PM => {
        'IO::Socket::SSL' => 0,
	'LWP::UserAgent' => 0,
    },
    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
    clean               => { FILES => 'AuthCAS-*' },
);

lib/AuthCAS.pm  view on Meta::CPAN


Version 1.7

=head1 DESCRIPTION

AuthCAS aims at providing a Perl API to JA-SIG Central Authentication System (CAS). 
Only a basic Perl library is provided with CAS whereas AuthCAS is a full object-oriented library. 

=head1 PREREQUISITES

This script requires IO::Socket::SSL and LWP::UserAgent

=head1 SYNOPSIS

  A simple example with a direct CAS authentication

  use AuthCAS;
  my $cas = new AuthCAS(casUrl => 'https://cas.myserver, 
		    CAFile => '/etc/httpd/conf/ssl.crt/ca-bundle.crt',
		    );

lib/AuthCAS.pm  view on Meta::CPAN


=item serviceValidatePath - '/serviceValidate'

=item proxyPath - '/proxy'

=item proxyValidatePath - '/proxyValidate'

=item SSL_version - unset

Sets the version of the SSL protocol used to transmit data. If the default causes connection issues, setting it to 'SSLv3' may help.
see the documentation for L<IO::Socket::SSL/"METHODS"> for more information
see L<http://www.perlmonks.org/?node_id=746493> for more details.

=back

Returns a new B<AuthCAS> or dies on error.

=cut

sub new {
    my ( $pkg, %param ) = @_;

lib/AuthCAS.pm  view on Meta::CPAN

    my $trusted_ca_path = $ssl_data->{'capath'};

    if (   ( $trusted_ca_file && !( -r $trusted_ca_file ) )
        || ( $trusted_ca_path && !( -d $trusted_ca_path ) ) )
    {
        $errors = sprintf
"error : incorrect access to cafile ".($trusted_ca_file||'<empty>')." or capath ".($trusted_ca_path||'<empty>')."\n";
        return undef;
    }

    unless ( eval "require IO::Socket::SSL" ) {
        $errors = sprintf
"Unable to use SSL library, IO::Socket::SSL required, install IO-Socket-SSL (CPAN) first\n";
        return undef;
    }
    require IO::Socket::SSL;

    unless ( eval "require LWP::UserAgent" ) {
        $errors = sprintf
"Unable to use LWP library, LWP::UserAgent required, install LWP (CPAN) first\n";
        return undef;
    }
    require LWP::UserAgent;

    my $ssl_socket;

lib/AuthCAS.pm  view on Meta::CPAN

    $ssl_options{'SSL_ca_file'} = $trusted_ca_file if ($trusted_ca_file);
    $ssl_options{'SSL_ca_path'} = $trusted_ca_path if ($trusted_ca_path);

    ## If SSL_ca_file or SSL_ca_path => verify peer certificate
    $ssl_options{'SSL_verify_mode'} = 0x01
      if ( $trusted_ca_file || $trusted_ca_path );

    $ssl_options{'SSL_version'} = $ssl_data->{'SSL_version'}
      if defined( $ssl_data->{'SSL_version'} );

    $ssl_socket = new IO::Socket::SSL(%ssl_options);

    unless ($ssl_socket) {
        $errors = sprintf "error %s unable to connect https://%s:%s/\n",
          &IO::Socket::SSL::errstr, $host, $port;
        return undef;
    }

    my $request = "GET $path HTTP/1.0\r\nHost: $host\r\n\r\n";
    print $ssl_socket "$request";

    my @result;
    while ( my $line = $ssl_socket->getline ) {
        push @result, $line;
    }



( run in 0.553 second using v1.01-cache-2.11-cpan-4d50c553e7e )