<commit_before>## OpenXPKI::Server::Authentication::ClientSSO.pm 
##
## Based on code Written 2005 by <NAME> and <NAME>
## Re-Written 2007 by <NAME>
## Updated to use new Service::Default semantics 2007 by <NAME>
## (C) Copyright 2005-2007 by The OpenXPKI Project

package OpenXPKI::Server::Authentication::ClientSSO;

use strict;
use warnings;
use English;

use OpenXPKI::Debug;
use OpenXPKI::Exception;
use OpenXPKI::Server::Context qw( CTX );

use base qw( OpenXPKI::Server::Authentication::External );

sub login_step {
    ##! 1: 'start' 
    my $self    = shift;
    my $arg_ref = shift;
 
    my $name    = $arg_ref->{HANDLER};
    my $msg     = $arg_ref->{MESSAGE};
    my $answer  = $msg->{PARAMS};

    if (! exists $msg->{PARAMS}->{LOGIN}) {
        ##! 4: 'no login data received (yet)' 
        return (undef, undef, 
            {
		SERVICE_MSG => "GET_CLIENT_SSO_LOGIN",
		PARAMS      => {
                    NAME        => $self->{NAME},
                    DESCRIPTION => $self->{DESC},
	        },
            },
        );
    }

    my ($account, $pseudo_role) = ($answer->{LOGIN}, $answer->{PSEUDO_ROLE});

    ##! 2: "credentials ... present"
    ##! 2: "account ... $account"
    ##! 2: "pseudo_role ... $pseudo_role"

    if ($self->{COMMAND})
    {
        ## if you use a static role and you use (trust) the
        ## client SSO then you have nothing todo
        ## Example: Shibboleth

        # see security warning below (near $out=`$cmd`)

        foreach my $name (keys %{$self->{ENV}})
        {
            my $value = $self->{ENV}->{$name};
            # we don't want to see expanded credentials in the log file,
            # so we just replace the credentials after logging it
            $value =~ s/__USER__/$account/g;
            $value =~ s/__PSEUDO_ROLE__/$pseudo_role/g;
<commit_msg>Fix undef in ClientSSO auth plugin<commit_after>## OpenXPKI::Server::Authentication::ClientSSO.pm 
##
## Based on code Written 2005 by <NAME> and <NAME>
## Re-Written 2007 by <NAME>
## Updated to use new Service::Default semantics 2007 by <NAME>
## (C) Copyright 2005-2007 by The OpenXPKI Project

package OpenXPKI::Server::Authentication::ClientSSO;

use strict;
use warnings;
use English;

use OpenXPKI::Debug;
use OpenXPKI::Exception;
use OpenXPKI::Server::Context qw( CTX );

use base qw( OpenXPKI::Server::Authentication::External );

sub login_step {
    ##! 1: 'start' 
    my $self    = shift;
    my $arg_ref = shift;
 
    my $name    = $arg_ref->{HANDLER};
    my $msg     = $arg_ref->{MESSAGE};
    my $answer  = $msg->{PARAMS};

    if (! exists $msg->{PARAMS}->{LOGIN}) {
        ##! 4: 'no login data received (yet)' 
        return (undef, undef, 
            {
		SERVICE_MSG => "GET_CLIENT_SSO_LOGIN",
		PARAMS      => {
                    NAME        => $self->{NAME},
                    DESCRIPTION => $self->{DESC},
	        },
            },
        );
    }

    my ($account, $pseudo_role) = ($answer->{LOGIN}, $answer->{PSEUDO_ROLE});

    ##! 2: "credentials ... present"
    ##! 2: "account ... $account"
    ##! 2: "pseudo_role ... $pseudo_role"

    if ($self->{COMMAND})
    {
        ## if you use a static role and you use (trust) the
        ## client SSO then you have nothing todo
        ## Example: Shibboleth

        # see security warning below (near $out=`$cmd`)

        foreach my $name (keys %{$self->{ENV}})
        {
            my $value = $self->{ENV}->{$name} || '';
            # we don't want to see expanded credentials in the log file,
            # so we just replace the credentials after logging it
            $value =~ s/__USER__/$account/g;
            $value =~ s/__PSEUDO_ROLE__/$pseudo_role/g;

{'fraction_non_alphanumeric': 0.1529698942229455, 'fraction_numerical': 0.013561160835367507, 'mean_word_length': 2.3649635036496353, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3830421', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1191, 'n_words': 331}