@@ -50,7 +50,12 @@ Arguments:
5050The SP's (Service Provider) also known as your application's signing key
5151that your application uses to sign the AuthnRequest. Some IdPs may not
5252verify the signature.
53- Required with B<param > being C<SAMLRequest > .
53+
54+ Usually required when B<param > is C<SAMLRequest > .
55+
56+ If you don't want to sign the request, you can pass C<< insecure => 1
57+ >> and not provide a key; in this case, C<sign > will return a
58+ non-signed URL.
5459
5560=item B<cert >
5661
@@ -91,6 +96,8 @@ has 'cert' => (isa => 'ArrayRef[Str]', is => 'ro', required => 0, predicate => '
9196has ' url' => (isa => Uri, is => ' ro' , required => 0, coerce => 1, predicate => ' has_url' );
9297has ' key' => (isa => ' Str' , is => ' ro' , required => 0, predicate => ' has_key' );
9398
99+ has ' insecure' => (isa => ' Bool' , is => ' ro' , default => 0 );
100+
94101has ' param' => (
95102 isa => SAMLRequestType,
96103 is => ' ro' ,
@@ -120,7 +127,7 @@ sub BUILD {
120127
121128 if ($self -> param eq ' SAMLRequest' ) {
122129 croak(" Need to have an URL specified" ) unless $self -> has_url;
123- croak(" Need to have a key specified" ) unless $self -> has_key;
130+ croak(" Need to have a key specified" ) unless $self -> has_key || $self -> insecure ;
124131 }
125132 elsif ($self -> param eq ' SAMLResponse' ) {
126133 croak(" Need to have a cert specified" ) unless $self -> has_cert;
@@ -171,6 +178,8 @@ sub sign {
171178 $u -> query_param($self -> param, $req );
172179 $u -> query_param(' RelayState' , $relaystate ) if defined $relaystate ;
173180
181+ return $u -> as_string if $self -> insecure;
182+
174183 my $key_string = read_text($self -> key);
175184 my $rsa_priv = Crypt::OpenSSL::RSA-> new_private_key($key_string );
176185
0 commit comments