view release on metacpan or search on metacpan
lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm view on Meta::CPAN
. " no longer exists, removing offline session" );
$session->remove;
}
else {
$self->logger->error( "Could not resolve user: " . $req->user );
}
return 0;
}
# Change the ID of secondary sessions (during upgrade)
sub updateOidcSecondarySessions {
my ( $self, $req, $old_session_id, $new_session_id ) = @_;
my $module = "Lemonldap::NG::Common::Apache::Session";
my %opts = $self->_storeOpts;
my $options = $opts{storageModuleOptions};
$options->{backend} = $opts{storageModule};
my $oidc_sessions =
$module->searchOn( $options, "user_session_id", $old_session_id );
lib/Lemonldap/NG/Portal/Lib/2fDevices.pm view on Meta::CPAN
=item key, value: update the device whose 'key' field equals value
=item update_key, update_value: set the matched devices' 'update_key' field to update_value
=back
Returns true if the update was sucessful
=cut
sub update2fDevice {
my ( $self, $req, $info, $type, $key, $value, $update_key, $update_value )
= @_;
my $user = $info->{ $self->conf->{whatToTrace} };
my $_2fDevices = $self->get2fDevices( $req, $info );
return 0 unless $_2fDevices;
my @found =
grep { $_->{type} eq $type and $_->{$key} eq $value } @{$_2fDevices};
lib/Lemonldap/NG/Portal/Lib/CAS.pm view on Meta::CPAN
return $self->sendSoapResponse(
$req, "<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
\t<cas:proxySuccess>
\t\t<cas:proxyTicket>$ticket</cas:proxyTicket>
\t</cas:proxySuccess>
</cas:serviceResponse>\n"
);
}
# Change the ID of secondary sessions (during upgrade)
sub updateCasSecondarySessions {
my ( $self, $req, $old_session_id, $new_session_id ) = @_;
# Find CAS sessions
my $moduleOptions;
if ( $self->conf->{casStorage} ) {
$moduleOptions = $self->conf->{casStorageOptions} || {};
$moduleOptions->{backend} = $self->conf->{casStorage};
}
else {
$moduleOptions = $self->conf->{globalStorageOptions} || {};
lib/Lemonldap/NG/Portal/Lib/OneTimeToken.pm view on Meta::CPAN
unless ($tsession) {
$self->logger->notice("Bad (or expired) token $id");
return undef;
}
my %h = %{ $tsession->{data} };
$tsession->remove unless ($keep);
return \%h;
}
}
sub updateToken {
my ( $self, $id, $k, $v ) = @_;
if ( $self->cache ) {
my $data;
unless ( $data = $self->cache->get($id) ) {
$self->logger->notice("Bad (or expired) token $id");
return undef;
}
my $h = from_json( $data, { allow_nonref => 1 } );
$h->{$k} = $v;
$self->cache->set( $id, to_json($h), $self->timeout . ' s' );
lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm view on Meta::CPAN
# Get existing Refresh Token
# @param id
# @return new Lemonldap::NG::Common::Session object
sub getRefreshToken {
my ( $self, $id ) = @_;
return $self->getOpenIDConnectSession( $id, "refresh_token", noCache => 1 );
}
sub updateRefreshToken {
my $self = shift;
return $self->updateToken(@_);
}
sub updateToken {
my ( $self, $id, $infos ) = @_;
my $oidcSession = Lemonldap::NG::Common::Session->new( {
$self->_storeOpts(),
cacheModule => $self->conf->{localSessionStorage},
cacheModuleOptions => $self->conf->{localSessionStorageOptions},
hashStore => $self->conf->{hashedSessionStore},
id => $id,
info => $infos,
}
lib/Lemonldap/NG/Portal/Lib/SAML.pm view on Meta::CPAN
eval {
Lasso::Provider::set_encryption_mode( $provider, $encryption_mode );
};
return $self->checkLassoError($@);
}
## @method boolean updateSAMLSecondarySessions(string old_session_id, string new_session_id)
# Update _saml_id of secondary sessions when the session ID is changed (upgrade)
sub updateSAMLSecondarySessions {
my ( $self, $req, $old_session_id, $new_session_id ) = @_;
# Find SAML sessions
my $saml_sessions =
Lemonldap::NG::Common::Apache::Session->searchOn( $self->amOpts,
"_saml_id", $old_session_id );
if (
my @saml_sessions_keys =
grep { $saml_sessions->{$_}->{_session_kind} eq $self->sessionKind }
lib/Lemonldap/NG/Portal/Main/Run.pm view on Meta::CPAN
return $ps;
}
# Update persistent session.
# Call updateSession() and store %$infos in a persistent session.
# Note that if the session does not exists, it will be created.
# @param infos hash reference of information to update
# @param uid optional Unhashed persistent session ID
# @param id optional SSO session ID
# @return nothing
sub updatePersistentSession {
my ( $self, $req, $infos, $uid, $id ) = @_;
# Return if no infos to update
return ()
unless ( ref $infos eq 'HASH'
and %$infos
and !$self->conf->{disablePersistentStorage} );
$uid ||= $req->{sessionInfo}->{ $self->conf->{whatToTrace} }
|| $req->userData->{ $self->conf->{whatToTrace} };
lib/Lemonldap/NG/Portal/Main/Run.pm view on Meta::CPAN
}
# Update session stored.
# If no id is given, try to get it from cookie.
# If the session is available, update data with $info.
# Note that outdated session data may remain some time on
# server local cache, if there are several LL::NG servers.
# @param infos hash reference of information to update
# @param id Session ID
# @return nothing
sub updateSession {
my ( $self, $req, $infos, $id ) = @_;
# Return if no infos to update
return () unless ( ref $infos eq 'HASH' and %$infos );
# Recover session ID unless given
$id ||= $req->id || $req->userData->{_session_id};
if ($id) {
lib/Lemonldap/NG/Portal/Plugins/RESTServer.pm view on Meta::CPAN
"REST authentication result for $req->{user}: code $req->{error}");
if ( $req->error != 0 ) {
$self->p->deleteSession($req);
return $self->p->sendError( $req, 'Unauthorized', 401 );
}
return $self->session( $req,
$self->conf->{hashedSessionStore} ? id2storage($id) : $id );
}
sub updateSession {
my ( $self, $req, $id ) = @_;
$self->logger->debug("REST request to update session $id");
my $mod = $self->getMod($req)
or return $self->p->sendError( $req, undef, 400 );
return $self->p->sendError( $req, 'ID is required', 400 ) unless ($id);
# Get new info
my $infos = $req->jsonBodyToObj
or return $self->p->sendError( $req, undef, 400 );
lib/Lemonldap/NG/Portal/Plugins/RESTServer.pm view on Meta::CPAN
$keys =~ s/\[|\]//g;
$keys =~ s/,/, /g;
$self->logger->debug("REST request to get exported attributes: $keys");
}
my $id = $req->userData->{_session_id};
$id = id2storage($id) if $req->userData->{_session_hashed};
return $self->session( $req, $id, $key || $self->exportedAttr );
}
sub updateMySession {
my ( $self, $req ) = @_;
# All /my/ API are called with user's session, so indicates here that
# it uses hashed store if available
$req->data->{hashStore} = 1;
my $res = 0;
my $mKeys = [];
if ( my $token = $req->param('token') ) {
if ( $self->ott->getToken($token) ) {
t/43-MailPasswordReset-Combination.t view on Meta::CPAN
# Check that new password works
expectCookie( try( 'jkirk', 'kobayashi' ) );
}
count(0);
clean_sessions();
done_testing( count() );
sub updatePassword {
my $query = shift;
my $newpassword = shift;
my $res;
ok(
$res = $client->_get(
'/resetpwd',
query => $query,
accept => 'text/html'
),