Единый вход на основе SAML с Laravel


Я внедряю единый вход на основе SAML для одного из веб-приложений php. Я использую Google в качестве IDP. Я использовал плагин Laravel 5-Saml2 и настроил его в соответствии с шагами, приведенными в документации. Я также добавил это приложение в консоль администратора Google как приложение SAML, используя шаги, приведенные здесь, и настроил идентификатор сущности и URL acs в saml2_settings.php . Однако я не могу настроить сертификаты x509cert. Когда я нажимаю URL-адрес входа, пользователь перенаправляется в Google для аутентификация, однако, когда я ввожу учетные данные, она не возвращается в приложение и выдает следующую ошибку:

  1. Это ошибка.

Ошибка: app_not_configured_for_user_пользователь

Служба не настроена для этого пользователя.

Ниже приведен мой файл saml2_settings:

'sp' => array(

    // Specifies constraints on the name identifier to be used to
    // represent the requested subject.
    // Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported
    'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',

    // Usually x509cert and privateKey of the SP are provided by files placed at
    // the certs folder. But we can also provide them with the following parameters
    'x509cert' => 'I ADDED x509certs here which I downloaded from google',
    'privateKey' => '',

    //LARAVEL - You don't need to change anything else on the sp
    // Identifier of the SP entity  (must be a URI)
    'entityId' => 'snipeit', //LARAVEL: This would be set to saml_metadata route
    // Specifies info about where and how the <AuthnResponse> message MUST be
    // returned to the requester, in this case our SP.
    'assertionConsumerService' => array(
        // URL Location where the <Response> from the IdP will be returned
        'url' => 'http://dev.sb.com/snipeit/public/account/profile', //LARAVEL: This would be set to saml_acs route
        //SAML protocol binding to be used when returning the <Response>
        //message.  Onelogin Toolkit supports for this endpoint the
        //HTTP-Redirect binding only
        'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
    ),
    // Specifies info about where and how the <Logout Response> message MUST be
    // returned to the requester, in this case our SP.
    'singleLogoutService' => array(
        // URL Location where the <Response> from the IdP will be returned
        'url' => '', //LARAVEL: This would be set to saml_sls route
        // SAML protocol binding to be used when returning the <Response>
        // message.  Onelogin Toolkit supports for this endpoint the
        // HTTP-Redirect binding only
        'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
    ),
),

// Identity Provider Data that we want connect with our SP
'idp' => array(
    // Identifier of the IdP entity  (must be a URI)
    'entityId' => '',
    // SSO endpoint info of the IdP. (Authentication Request protocol)
    'singleSignOnService' => array(
        // URL Target of the IdP where the SP will send the Authentication Request Message
        'url' => $idp_host,
        // SAML protocol binding to be used when returning the <Response>
        // message.  Onelogin Toolkit supports for this endpoint the
        // HTTP-POST binding only
        'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
    ),
    // SLO endpoint info of the IdP.
    'singleLogoutService' => array(
        // URL Location of the IdP where the SP will send the SLO Request
        'url' => $idp_host . '/saml2/idp/SingleLogoutService.php',
        // SAML protocol binding to be used when returning the <Response>
        // message.  Onelogin Toolkit supports for this endpoint the
        // HTTP-Redirect binding only
        'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
    ),
    // Public x509 certificate of the IdP
    'x509cert' => 'SAME CERTIFICATES I ADDED HERE AS WELL',        /*
     *  Instead of use the whole x509cert you can use a fingerprint
     *  (openssl x509 -noout -fingerprint -in "idp.crt" to generate it)
     */
    // 'certFingerprint' => '',
),

Может кто-нибудь, пожалуйста, помочь мне.

Author: UnderDog, 2016-03-15

1 answers

'sp'=>массив(

'x509cert' => 'I ADDED x509certs here which I downloaded from google',
'privateKey' => '',

Вы используете Google в качестве IdP, так почему же вы используете публичный сертификат Google в разделе sp?

Если вы планируете подписывать сообщения SAML, отправляемые SP, то вам необходимо разместить там свой собственный сертификат/закрытый ключ. Вы можете создавать самозаверяющие сертификаты с помощью этого инструмента: https://www.samltool.com/self_signed_certs.php

Если у вас есть сомнения по поводу некоторых полей настроек, ознакомьтесь с документацией плагина Lavarel SAML, но также ознакомьтесь с документацией php-saml, инструментарием SAML, который использует плагин.

Чтобы отладить происходящее, я также рекомендую вам использовать расширение браузера для записи ваших сообщений SAML, используйте, например, SAML Tracer и просмотрите статус ответов, которые сообщат вам о возможной ошибке.

 4
Author: smartin, 2016-04-06 09:32:33