Test if required secret elements are set to sign JWT

This commit is contained in:
Christophe Maudoux 2019-05-02 14:33:56 +02:00
parent a382d919ae
commit c8dd4554aa

View File

@ -1165,6 +1165,11 @@ sub createJWT {
my $client_secret =
$self->conf->{oidcRPMetaDataOptions}->{$rp}
->{oidcRPMetaDataOptionsClientSecret};
unless ($client_secret) {
$self->logger->error(
"Algorithm $alg needs a Client Secret to sign JWT");
return;
}
my $digest;
@ -1194,6 +1199,12 @@ sub createJWT {
# Get signing private key
my $priv_key = $self->conf->{oidcServicePrivateKeySig};
unless ($priv_key) {
$self->logger->error(
"Algorithm $alg needs a Private Key to sign JWT");
return;
}
my $rsa_priv = Crypt::OpenSSL::RSA->new_private_key($priv_key);
if ( $alg eq "RS256" ) {