Skip to content

Commit

Permalink
Merge pull request #200 from waterkip/GH-195-nameformatid_deprecation…
Browse files Browse the repository at this point in the history
…_warning

Add deprecation warning for nameid_format in Protocol::AuthnRequest
  • Loading branch information
waterkip authored Jan 31, 2024
2 parents 4920a03 + 70890a1 commit a4f7aff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lib/Net/SAML2/Protocol/AuthnRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ around BUILDARGS => sub {

my %params = @_;
if ($params{nameid_format} && !defined $params{nameidpolicy_format}) {
warn "You are using nameid_format, this field has changed to "
. "nameidpolicy_format. This field will be used for other purposes "
. "in an upcoming release. Please change your code ASAP.";
$params{nameidpolicy_format} = $params{nameid_format};
}

Expand Down
8 changes: 4 additions & 4 deletions lib/Net/SAML2/SP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ sub authn_request {
my (%params) = @_;

return Net::SAML2::Protocol::AuthnRequest->new(
issueinstant => DateTime->now,
issuer => $self->id,
destination => $destination,
nameid_format => $nameid_format || '',
issueinstant => DateTime->now,
issuer => $self->id,
destination => $destination,
nameidpolicy_format => $nameid_format || '',
%params,
);

Expand Down
2 changes: 1 addition & 1 deletion t/09-authn-request.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $override->override('Net::SAML2::Protocol::AuthnRequest::_build_id' =>
{
my ($ar, $xp) = net_saml2_authnreq(
nameid => 'mynameid',
nameid_format =>
nameidpolicy_format =>
'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
nameid_allow_create => 1,
issuer_namequalifier => 'bar',
Expand Down

0 comments on commit a4f7aff

Please sign in to comment.