SP Logout Flow problems #101
-
My project must implement SP-initiated Logout (we're the SP). I followed the code, implementing this (anonimized a bit)
And I'm consistently failing logout at the last else. The typical response looks like
Do you have any suggestion as to what I could be doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 10 replies
-
It would be good to see the LogoutRequest too. There are a couple of possibilities possibly the Issuer in your request or the SessionIndex (it should be the SessionIndex from the Assertion:
|
Beta Was this translation helpful? Give feedback.
-
A logout request from yesterday's tries was:
and the corresponding response:
|
Beta Was this translation helpful? Give feedback.
-
Can you also confirm that you are using the NameID from the Assertion? In my setup although Microsoft claims in my assertion that it is an email it is using e1e43e43-a2d5-a3a1-1e44-3aca41a62de1 as the NameID |
Beta Was this translation helpful? Give feedback.
-
Here's data from a complete flow:
callback:
logout:
I also tried changing the nameid_format and the nameid to the identifier, but with the same results. |
Beta Was this translation helpful? Give feedback.
-
You are missing the NameID. I will look at my Azure settings when I get
home.
…On Fri., Aug. 12, 2022, 4:50 p.m. Adriano Varoli Piazza, < ***@***.***> wrote:
Here's data from a complete flow:
init:
#$authn_request
$VAR1 = bless( {
'id' => 'NETSAML2_ae99c55f5e3e64a8f772ec4cb9311db7',
'issuer' => bless( do{\(my $o = 'https://[our sp domain]/[our project]/stat/saml_data/sp_federationmetadata.xml')}, 'URI::https' ),
'provider_name' => 'https://[our sp domain]/[our project]/stat/saml_data/sp_federationmetadata.xml',
'issue_instant' => '2022-08-12T19:41:23Z',
'AuthnContextClassRef' => [],
'AuthnContextDeclRef' => [],
'destination' => bless( do{\(my $o = 'https://[idp domain]/adfs/ls/')}, 'URI::https' ),
'RequestedAuthnContext_Comparison' => 'exact'
}, 'Net::SAML2::Protocol::AuthnRequest' );
SAML request ID: NETSAML2_ae99c55f5e3e64a8f772ec4cb9311db7
callback:
#%assertion_data:
$VAR1 = {
'session' => '_8e34077a-c125-44f1-9f46-d8c060ef4fd5',
'id' => 'NETSAML2_d958cfc58ce521990db1791140609c16',
'not_after' => 1660351284,
'email' => '[my test email]',
'in_response_to' => 'NETSAML2_ae99c55f5e3e64a8f772ec4cb9311db7',
'not_before' => 1660347684
};
#user_data for session:
$VAR1 = {
'expires' => 1660351284,
'token' => '_8e34077a-c125-44f1-9f46-d8c060ef4fd5',
'user_id' => 2,
'refresh' => '_8e34077a-c125-44f1-9f46-d8c060ef4fd5'
};
logout:
#mod. req:
<?xml version="1.0" standalone="yes"?>
<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
Version="2.0"
Destination="https://[idp domain]/adfs/ls/"
IssueInstant="2022-08-12T19:42:14Z"
ID="_8e34077a-c125-44f1-9f46-d8c060ef4fd5">
<saml:Issuer>https://[our sp domain]/[our project]/stat/saml_data/sp_federationmetadata.xml</saml:Issuer>
<saml:NameID NameQualifier="https://[idp domain]/adfs/ls/"
Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
>[my test email]</saml:NameID>
<samlp:SessionIndex>_8e34077a-c125-44f1-9f46-d8c060ef4fd5</samlp:SessionIndex>
</samlp:LogoutRequest>
#logout response
$VAR1 = '<samlp:LogoutResponse ID="_9ddf1a7f-4277-46b2-97d1-24d0adf8eee9" Version="2.0" IssueInstant="2022-08-12T19:42:16.425Z" Destination="https://[our sp domain]/cgi-cpn/[our cms]_logout.cgi?_[our cms]_id=[our project]" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" InResponseTo="_8e34077a-c125-44f1-9f46-d8c060ef4fd5" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"><Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">http://[idp domain]/adfs/services/trust</Issuer><samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Requester" /></samlp:Status></samlp:LogoutResponse>';
# logout response dump
$VAR1 = bless( {
'id' => '_9ddf1a7f-4277-46b2-97d1-24d0adf8eee9',
'issue_instant' => '2022-08-12T19:42:16Z',
'response_to' => '_8e34077a-c125-44f1-9f46-d8c060ef4fd5',
'issuer' => bless( do{\(my $o = 'http://[idp domain]/adfs/services/trust')}, 'URI::http' ),
'destination' => bless( do{\(my $o = 'https://[our sp domain]/cgi-cpn/[our cms]_logout.cgi?_[our cms]_id=[our project]')}, 'URI::https' ),
'substatus' => '',
'status' => 'urn:oasis:names:tc:SAML:2.0:status:Requester'
}, 'Net::SAML2::Protocol::LogoutResponse' );
I also tried changing the nameid_format and the nameid to the identifier,
but with the same results.
—
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH3N66IMR6TGZISL2CW2IDVY2THFANCNFSM56JFS2GA>
.
You are receiving this because you commented.Message ID:
<perl-net-saml2/perl-Net-SAML2/repo-discussions/101/comments/3386944@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
My Claims are:
![Claim](https://user-images.githubusercontent.com/1029883/184453806-bbf3a50a-10c2-4efd-ae52-8f3b643901e5.png)
This is a test SP and I suspect that the objectid is incorrect but that
does produce a nameID in the assertation.
Timothy Legge
***@***.***
***@***.***
…On Fri, Aug 12, 2022 at 6:24 PM Timothy Legge ***@***.***> wrote:
You are missing the NameID. I will look at my Azure settings when I get
home.
On Fri., Aug. 12, 2022, 4:50 p.m. Adriano Varoli Piazza, <
***@***.***> wrote:
> Here's data from a complete flow:
> init:
>
> #$authn_request
> $VAR1 = bless( {
> 'id' => 'NETSAML2_ae99c55f5e3e64a8f772ec4cb9311db7',
> 'issuer' => bless( do{\(my $o = 'https://[our sp domain]/[our project]/stat/saml_data/sp_federationmetadata.xml')}, 'URI::https' ),
> 'provider_name' => 'https://[our sp domain]/[our project]/stat/saml_data/sp_federationmetadata.xml',
> 'issue_instant' => '2022-08-12T19:41:23Z',
> 'AuthnContextClassRef' => [],
> 'AuthnContextDeclRef' => [],
> 'destination' => bless( do{\(my $o = 'https://[idp domain]/adfs/ls/')}, 'URI::https' ),
> 'RequestedAuthnContext_Comparison' => 'exact'
> }, 'Net::SAML2::Protocol::AuthnRequest' );
> SAML request ID: NETSAML2_ae99c55f5e3e64a8f772ec4cb9311db7
>
> callback:
>
> #%assertion_data:
> $VAR1 = {
> 'session' => '_8e34077a-c125-44f1-9f46-d8c060ef4fd5',
> 'id' => 'NETSAML2_d958cfc58ce521990db1791140609c16',
> 'not_after' => 1660351284,
> 'email' => '[my test email]',
> 'in_response_to' => 'NETSAML2_ae99c55f5e3e64a8f772ec4cb9311db7',
> 'not_before' => 1660347684
> };
> #user_data for session:
> $VAR1 = {
> 'expires' => 1660351284,
> 'token' => '_8e34077a-c125-44f1-9f46-d8c060ef4fd5',
> 'user_id' => 2,
> 'refresh' => '_8e34077a-c125-44f1-9f46-d8c060ef4fd5'
> };
>
> logout:
>
> #mod. req:
> <?xml version="1.0" standalone="yes"?>
> <samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
> xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
> Version="2.0"
> Destination="https://[idp domain]/adfs/ls/"
> IssueInstant="2022-08-12T19:42:14Z"
> ID="_8e34077a-c125-44f1-9f46-d8c060ef4fd5">
> <saml:Issuer>https://[our sp domain]/[our project]/stat/saml_data/sp_federationmetadata.xml</saml:Issuer>
> <saml:NameID NameQualifier="https://[idp domain]/adfs/ls/"
> Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
> >[my test email]</saml:NameID>
> <samlp:SessionIndex>_8e34077a-c125-44f1-9f46-d8c060ef4fd5</samlp:SessionIndex>
> </samlp:LogoutRequest>
>
> #logout response
> $VAR1 = '<samlp:LogoutResponse ID="_9ddf1a7f-4277-46b2-97d1-24d0adf8eee9" Version="2.0" IssueInstant="2022-08-12T19:42:16.425Z" Destination="https://[our sp domain]/cgi-cpn/[our cms]_logout.cgi?_[our cms]_id=[our project]" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" InResponseTo="_8e34077a-c125-44f1-9f46-d8c060ef4fd5" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"><Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">http://[idp domain]/adfs/services/trust</Issuer><samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Requester" /></samlp:Status></samlp:LogoutResponse>';
> # logout response dump
> $VAR1 = bless( {
> 'id' => '_9ddf1a7f-4277-46b2-97d1-24d0adf8eee9',
> 'issue_instant' => '2022-08-12T19:42:16Z',
> 'response_to' => '_8e34077a-c125-44f1-9f46-d8c060ef4fd5',
> 'issuer' => bless( do{\(my $o = 'http://[idp domain]/adfs/services/trust')}, 'URI::http' ),
> 'destination' => bless( do{\(my $o = 'https://[our sp domain]/cgi-cpn/[our cms]_logout.cgi?_[our cms]_id=[our project]')}, 'URI::https' ),
> 'substatus' => '',
> 'status' => 'urn:oasis:names:tc:SAML:2.0:status:Requester'
> }, 'Net::SAML2::Protocol::LogoutResponse' );
>
> I also tried changing the nameid_format and the nameid to the identifier,
> but with the same results.
>
> —
> Reply to this email directly, view it on GitHub
> <#101 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAH3N66IMR6TGZISL2CW2IDVY2THFANCNFSM56JFS2GA>
> .
> You are receiving this because you commented.Message ID:
> <perl-net-saml2/perl-Net-SAML2/repo-discussions/101/comments/3386944@
> github.com>
>
|
Beta Was this translation helpful? Give feedback.
-
Thanks to @timlegge, I managed to sort this out. He pointed me to https://stackoverflow.com/questions/44290083/proper-logoutrequest-for-single-logout-with-adfs-idp, in which it's mentioned that the NameID must be the same as in the SAML Response sent when logging in. In this case, I had to remove the Format, NameIdentifier and SPNameIdentifier attributes from the tag for the logout to work:
instead of
An alternative is coordinating with the IdP and change the relevant claims, as the SO answer states. |
Beta Was this translation helpful? Give feedback.
Thanks to @timlegge, I managed to sort this out. He pointed me to https://stackoverflow.com/questions/44290083/proper-logoutrequest-for-single-logout-with-adfs-idp, in which it's mentioned that the NameID must be the same as in the SAML Response sent when logging in. In this case, I had to remove the Format, NameIdentifier and SPNameIdentifier attributes from the tag for the logout to work:
instead of
An alternative is coordinating with the IdP and change the relevant…