From 655fb1d4a5f0d03d8bc0437d83a7e6d54dbff2b1 Mon Sep 17 00:00:00 2001 From: James Rouzier Date: Thu, 9 Jan 2025 20:55:31 +0000 Subject: [PATCH] Have better error handling --- lib/pf/Authentication/Source/SAMLSource.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/pf/Authentication/Source/SAMLSource.pm b/lib/pf/Authentication/Source/SAMLSource.pm index 07404a77a38..1fd141350cf 100644 --- a/lib/pf/Authentication/Source/SAMLSource.pm +++ b/lib/pf/Authentication/Source/SAMLSource.pm @@ -180,8 +180,16 @@ sub handle_response { } my $assertion = $lassoLogin->get_assertion(); - my @attribute_list = $assertion->AttributeStatement->Attribute; - + if (!$assertion) { + return ($FALSE, "No assertion found"); + } + + my $attribute_statement = $assertion->AttributeStatement; + if (!$attribute_statement) { + return ($FALSE, "No assertion statement found"); + } + + my @attribute_list = $attribute_statement->Attribute; my $username; # For debug foreach my $attribute (@attribute_list){