view release on metacpan or search on metacpan
lib/Apache/Session/Browseable/LDAP.pm view on Meta::CPAN
base => $args->{ldapConfBase},
filter => "(&(objectClass="
. $args->{ldapObjectClass} . ")("
. $args->{ldapAttributeIndex}
. "=${selectField}_$value))",
#scope => 'base',
attrs => [ $args->{ldapAttributeContent}, $args->{ldapAttributeId} ],
);
$ldap->unbind();
$ldap->disconnect();
if ( $msg->code ) {
Apache::Session::Browseable::Store::LDAP->logError($msg);
}
else {
foreach my $entry ( $msg->entries ) {
my $id = $entry->get_value( $args->{ldapAttributeId} ) or die;
my $tmp = $entry->get_value( $args->{ldapAttributeContent} );
next unless ($tmp);
lib/Apache/Session/Browseable/LDAP.pm view on Meta::CPAN
# VERY STRANGE BUG ! With this filter, description isn't base64 encoded !!!
#filter => '(objectClass=applicationProcess)',
filter => '(&(objectClass='
. $args->{ldapObjectClass} . ')('
. $args->{ldapAttributeIndex} . '=*))',
attrs => [ $args->{ldapAttributeId}, $args->{ldapAttributeContent} ],
);
$ldap->unbind();
if ( $msg->code ) {
Apache::Session::Browseable::Store::LDAP->logError($msg);
}
else {
foreach my $entry ( $msg->entries ) {
my $id = $entry->get_value( $args->{ldapAttributeId} ) or die;
my $tmp = $entry->get_value( $args->{ldapAttributeContent} );
next unless ($tmp);
eval { $tmp = unserialize($tmp); };
lib/Apache/Session/Browseable/Store/Cassandra.pm view on Meta::CPAN
local $self->{dbh}->{LongReadLen} =
$session->{args}->{LongReadLen} || 8 * 2**10;
if ( !defined $self->{materialize_sth} ) {
$self->{materialize_sth} = $self->{dbh}->prepare_cached(
qq{
SELECT a_session FROM sessions WHERE id = ? FOR UPDATE}
);
}
$self->{materialize_sth}->bind_param( 1, $session->{data}->{_session_id} );
$self->{materialize_sth}->execute;
my $results = $self->{materialize_sth}->fetchrow_arrayref;
if ( !( defined $results ) ) {
die "Object does not exist in the data store";
}
$self->{materialize_sth}->finish;
lib/Apache/Session/Browseable/Store/DBI.pm view on Meta::CPAN
? $session->{args}->{Index}
: [ split /\s+/, $session->{args}->{Index} ];
$self->{insert_sth} //=
$self->{dbh}->prepare_cached( "INSERT INTO $self->{table_name} ("
. join( ',', 'id', 'a_session', map { s/'/''/g; $_ } @$index )
. ') VALUES ('
. join( ',', ('?') x ( 2 + @$index ) )
. ')' );
$self->{insert_sth}->bind_param( 1, $session->{data}->{_session_id} );
$self->{insert_sth}->bind_param( 2, $session->{serialized} );
my $i = 3;
foreach my $f (@$index) {
$self->{insert_sth}->bind_param( $i, $session->{data}->{$f} );
$i++;
}
$self->{insert_sth}->execute;
$self->{insert_sth}->finish;
}
sub update {
my $self = shift;
lib/Apache/Session/Browseable/Store/DBI.pm view on Meta::CPAN
? $session->{args}->{Index}
: [ split /\s+/, $session->{args}->{Index} ];
if ( !defined $self->{update_sth} ) {
$self->{update_sth} =
$self->{dbh}->prepare_cached( "UPDATE $self->{table_name} SET "
. join( ' = ?, ', 'a_session', @$index )
. ' = ? WHERE id = ?' );
}
$self->{update_sth}->bind_param( 1, $session->{serialized} );
my $i = 2;
foreach my $f (@$index) {
$self->{update_sth}->bind_param( $i, $session->{data}->{$f} );
$i++;
}
$self->{update_sth}->bind_param( $i, $session->{data}->{_session_id} );
$self->{update_sth}->execute;
$self->{update_sth}->finish;
}
1;
lib/Apache/Session/Browseable/Store/LDAP.pm view on Meta::CPAN
];
push @$attrs, ( $self->{args}->{ldapAttributeIndex} => $attrIndex )
if ($attrIndex);
my $msg = $self->ldap->add(
$self->{args}->{ldapAttributeId} . "=$id,"
. $self->{args}->{ldapConfBase},
attrs => $attrs,
);
$self->ldap->unbind() && delete $self->{ldap};
$self->logError($msg) if ( $msg->code );
}
sub update {
my $self = shift;
my $session = shift;
$self->{args} = $session->{args};
$self->{args}->{ldapObjectClass} ||= 'applicationProcess';
$self->{args}->{ldapAttributeId} ||= 'cn';
$self->{args}->{ldapAttributeContent} ||= 'description';
lib/Apache/Session/Browseable/Store/LDAP.pm view on Meta::CPAN
$attrs->{ $self->{args}->{ldapAttributeIndex} } = $attrIndex
if ($attrIndex);
my $msg = $self->ldap->modify(
$self->{args}->{ldapAttributeId} . "="
. $session->{data}->{_session_id} . ","
. $self->{args}->{ldapConfBase},
replace => $attrs,
);
$self->ldap->unbind() && delete $self->{ldap};
$self->logError($msg) if ( $msg->code );
}
sub materialize {
my $self = shift;
my $session = shift;
$self->{args} = $session->{args};
$self->{args}->{ldapObjectClass} ||= 'applicationProcess';
$self->{args}->{ldapAttributeId} ||= 'cn';
$self->{args}->{ldapAttributeContent} ||= 'description';
lib/Apache/Session/Browseable/Store/LDAP.pm view on Meta::CPAN
my $msg = $self->ldap->search(
base => $self->{args}->{ldapAttributeId} . "="
. $session->{data}->{_session_id} . ","
. $self->{args}->{ldapConfBase},
filter => '(objectClass=' . $self->{args}->{ldapObjectClass} . ')',
scope => 'base',
attrs => [ $self->{args}->{ldapAttributeContent} ],
);
$self->ldap->unbind() && delete $self->{ldap};
$self->logError($msg) if ( $msg->code );
eval {
$session->{serialized} = $msg->shift_entry()
->get_value( $self->{args}->{ldapAttributeContent} );
};
if ( !defined $session->{serialized} ) {
die "Object does not exist in data store";
}
lib/Apache/Session/Browseable/Store/LDAP.pm view on Meta::CPAN
$self->{args} = $session->{args};
$self->{args}->{ldapObjectClass} ||= 'applicationProcess';
$self->{args}->{ldapAttributeId} ||= 'cn';
$self->{args}->{ldapAttributeContent} ||= 'description';
$self->{args}->{ldapAttributeIndex} ||= 'ou';
$self->ldap->delete( $self->{args}->{ldapAttributeId} . "="
. $session->{data}->{_session_id} . ","
. $self->{args}->{ldapConfBase} );
$self->ldap->unbind() && delete $self->{ldap};
}
sub ldap {
my $self = shift;
return $self->{ldap} if ( $self->{ldap} );
# Parse servers configuration
my $useTls = 0;
my $tlsParam;
my @servers = ();
lib/Apache/Session/Browseable/Store/LDAP.pm view on Meta::CPAN
$h{cafile} ||= $caFile if ($caFile);
$h{capath} ||= $caPath if ($caPath);
my $start_tls = $ldap->start_tls(%h);
if ( $start_tls->code ) {
$self->logError($start_tls);
return;
}
}
# Bind with credentials
my $bind = $ldap->bind( $self->{args}->{ldapBindDN},
password => $self->{args}->{ldapBindPassword} );
if ( $bind->code ) {
$self->logError($bind);
return;
}
$self->{ldap} = $ldap;
return $ldap;
}
sub logError {
my $self = shift;
my $ldap_operation = shift;
lib/Apache/Session/Browseable/Store/SQLite.pm view on Meta::CPAN
local $self->{dbh}->{RaiseError} = 1;
if ( !defined $self->{materialize_sth} ) {
$self->{materialize_sth} = $self->{dbh}->prepare_cached(
qq{
SELECT a_session FROM $self->{'table_name'} WHERE id = ?}
);
}
$self->{materialize_sth}->bind_param( 1, $session->{data}->{_session_id} );
$self->{materialize_sth}->execute;
my $results = $self->{materialize_sth}->fetchrow_arrayref;
if ( !( defined $results ) ) {
$self->{materialize_sth}->finish;
die "Object does not exist in the data store";
}