Skip to content

Commit

Permalink
fix: SSO user management
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed Sep 29, 2023
1 parent 5fe0f05 commit 125b2dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/Ravada/Auth.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use strict;
our $LDAP_OK;
our $SSO_OK;

use Data::Dumper;
use Ravada::Auth::SQL;

=head1 NAME
Expand Down
6 changes: 6 additions & 0 deletions lib/Ravada/Auth/SSO.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ sub _get_session_userid_by_ticket
my ($cookie) = @_;
my $result;
die 'Can\'t read pubkey file (sso->cookie->pub_key value at ravada.conf file)' if (! -r $$CONFIG->{sso}->{cookie}->{pub_key});

eval { $result = Authen::ModAuthPubTkt::pubtkt_verify(publickey => $$CONFIG->{sso}->{cookie}->{pub_key}, keytype => $$CONFIG->{sso}->{cookie}->{type}, ticket => $cookie); };
die $@ ? $@ : 'Cannot validate ticket' if ((! $result) || ($@));
my %data = Authen::ModAuthPubTkt::pubtkt_parse($cookie);
Expand Down Expand Up @@ -123,6 +124,11 @@ sub init {
return 0;
}
}
if (!$$CONFIG->{sso}->{cookie}->{type}) {
$ERR = "Error: missing sso / cookie / type in config file\n";
warn $ERR unless $warn++;
return 0;
}
for my $field (qw(priv_key pub_key)) {
if ( !exists $$CONFIG->{sso}->{cookie}->{$field}
|| ! $$CONFIG->{sso}->{cookie}->{$field}) {
Expand Down
2 changes: 1 addition & 1 deletion templates/main/manage_user.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(<%= ($user->external_auth or $origin) %>)
% }
</h2>
% if ($user->external_auth && $user->ldap_entry ) {
% if ($user->external_auth && $user->external_auth eq 'ldap' && $user->ldap_entry ) {
<%= $user->ldap_entry->dn %>
% }
</div> <!-- del panel heading-->
Expand Down

0 comments on commit 125b2dc

Please sign in to comment.