web-dev-qa-db-ja.com

Laravel)を使用したSAMLベースのSSO

PhpWebアプリケーションの1つにSAMLベースのSSOを実装しています。私はIDPとしてグーグルを使用しています。私は Laravel 5 --Saml2 プラグインを使用し、そのドキュメントに記載されている手順に従って構成しました。また、指定された手順を使用して、このアプリをGoogle管理コンソールにSAMLアプリとして追加しました ここ そしてsaml2_settings.phpでentityIdとacsurlを構成しました。ただし、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' => '',
),

誰か助けてくれませんか。

10
Ashok Dongare

'sp' => array(

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

IdPとしてGoogleを使用しているのに、なぜspセクションでgoogle public certを使用しているのですか?

SPによって送信されたSAMLメッセージに署名する場合は、そこに独自の証明書/秘密鍵を配置する必要があります。このツールを使用して自己署名証明書を生成できます: https://www.samltool.com/self_signed_certs.php

一部の設定フィールドについて疑問がある場合は、Lavarel SAMLプラグインのドキュメントを確認するだけでなく、プラグインが使用するSAMLツールキットである php-samlのドキュメント も確認してください。

何が起こっているかをデバッグするために、ブラウザ拡張機能を使用してSAMLメッセージを記録することもお勧めします。たとえば、 SAML Tracer を使用し、エラーの可能性について通知する応答のステータスを確認します。

8
smartin