flipboxfactory / saml-sp

SAML Service Provider (SP) Plugin for Craft CMS
https://saml-sp.flipboxfactory.com/
Other
19 stars 5 forks source link

Custom User Fields causing Login Failure in RC2 #15

Closed jeffsikes closed 6 years ago

jeffsikes commented 6 years ago

If a custom user field is passed, the login process is failing because the parameter $craftProperty is an OBJECT rather than a string.

https://github.com/flipboxfactory/saml-sp/blob/9030fa5ce6725c56117614ef842daa6e574cf6c5/src/services/Login.php#L522

https://github.com/flipboxfactory/saml-sp/blob/9030fa5ce6725c56117614ef842daa6e574cf6c5/src/services/Login.php#L539

If you remove the string definition on the $craftProperty variable being passed in, then login is successful because it allows an object to be passed - the assignUserProperty functions already has logic to handle this (is_string($craftProperty)) so the SSO process seems to work after making this change. (Line 542)

    /**
     * @param User $user
     * @param Attribute $attribute
     * @param string $craftProperty
     */
    protected function assignUserProperty(
        User $user,
        Attribute $attribute,
        $craftProperty  // was "string $craftProperty"
    ) {
dsmrt commented 6 years ago

Good catch @jeffsikes ... so you are using a callable here, correct? I'll get a patch going for this ASAP.

jeffsikes commented 6 years ago

Yes, using a callable from the config/saml-sp.php

Thanks!

dsmrt commented 6 years ago

Got this patch up in RC3 -> https://github.com/flipboxfactory/saml-sp/commit/60d4dd5f4ca8057f1c4383caea9973f79417a4f4

Let me know how this works out for you.

Thanks!