Full name mapping when using SAML

Hi there,

does anyone know how to map the full name when using SAML as login method?
My SAML response looks like this and I can map any other other attribute in my IdP if necessary:

<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" 
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Destination="https://logon.xyz.de/auth/saml/callback" ID="idLwrewprewewGG1wewe0X4VZKDDby1Htv8I" InResponseTo="_ade6fd8b-0ce0-48d0-afff-b0ad3375d8e6" IssueInstant="2018-10-18T08:05:37Z" Version="2.0">
    <saml:Issuer>https://logon.xyz.de/nidp/saml2/metadata</saml:Issuer>
    <samlp:Status>
        <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
    </samlp:Status>
    <saml:Assertion ID="id9sd5jjrejb3ererIZCJkrYjoG9_PI0" IssueInstant="2018-10-18T08:05:37Z" Version="2.0">

        ...

    <saml:AttributeStatement>
        <saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="name" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
            <saml:AttributeValue xsi:type="xs:string">USERID</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="last_name" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
            <saml:AttributeValue xsi:type="xs:string">Surname</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="first_name" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
            <saml:AttributeValue xsi:type="xs:string">Givenname</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
            <saml:AttributeValue xsi:type="xs:string">mail@example.org</saml:AttributeValue>
        </saml:Attribute>
    </saml:AttributeStatement>
</saml:Assertion>
</samlp:Response>

Regards,
Thilo

لأي شخص آخر يبحث عن حل:

واجهتنا نفس المشكلة ولم نجد حلاً إلا عند النظر في الكود المصدري:

يتم تجاهل fullName.
يجب أن يكون لديك تعيين للحقول firstName و lastName لـ discourse في موفر الهوية الخاص بك (استخدمنا Keycloak)

إعجابَين (2)

شكراً لك على تخصيص الوقت للتعمق في الكود! يبدو لي أن هذا خطأ - نحن نتحقق من fullName، ثم نستبدله بـ firstName lastName. السطر 133 في هذا المقتطف عديم الفائدة تمامًا :thinking:

لقد كنت أعمل على إضافة SAML هذا الأسبوع على أي حال، لذا إليك إصلاح:

بمجرد دمج هذا، سيتم إعطاء الأولوية لـ fullName بشكل صحيح.

3 إعجابات

@david شكراً على الإصلاح السريع!

يبدو هذا خطأً بالنسبة لي - نحن نتحقق من fullName، ثم نستبدله بـ firstName lastName. السطر 133 في هذا المقتطف عديم الفائدة تمامًا.

كان لدي نفس الانطباع ولكن لم أكن متأكدًا لأنني لست على دراية بصيغة Ruby…

إعجابَين (2)