2016-03-15 77 views
8

Tôi đang triển khai SSO dựa trên SAML cho một trong các ứng dụng web php. Tôi đang sử dụng google làm IDP. Tôi đã sử dụng Laravel 5 - Saml2 plugin và được định cấu hình theo các bước được đưa vào tài liệu của nó. Tôi cũng đã thêm ứng dụng này trong bảng điều khiển dành cho quản trị viên của google làm ứng dụng SAML bằng cách sử dụng các bước được cung cấp here và url cấu hình entityId và acs trong saml2_settings.php. Tuy nhiên, tôi không thể định cấu hình chứng chỉ x509cert. Khi tôi nhấn url đăng nhập, người dùng được chuyển hướng đến google để xác thực tuy nhiên khi tôi bước vào thông tin nó không trở lại để ứng dụng và đưa ra báo lỗi sau:SSO dựa trên SAML với Laravel

  1. That’s an error.

Error: app_not_configured_for_user

Service is not configured for this user.

Sau đây là saml2_settings tập tin của tôi:

'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' => '', 
), 

Ai đó có thể giúp tôi.

Trả lời

3

'sp' => array(

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

Bạn đang sử dụng Google làm IdP, tại sao bạn sử dụng chứng chỉ công khai của google trên phần sp?

Nếu bạn có kế hoạch ký các tin nhắn SAML được gửi bởi SP, thì bạn cần đặt khóa chứng nhận/khóa riêng của mình ở đó. Bạn có thể tạo chứng chỉ tự ký với công cụ này: https://www.samltool.com/self_signed_certs.php

Nếu bạn nghi ngờ về một số trường cài đặt, hãy xem lại tài liệu về plugin SAML của Lavarel, nhưng cũng xem lại bộ công cụ SAML mà plugin sử dụng.

Để gỡ lỗi những gì đang diễn ra, tôi cũng khuyên bạn nên sử dụng tiện ích mở rộng trình duyệt để ghi lại Thư SAML của bạn, sử dụng ví dụ SAML Tracer và xem lại Trạng thái phản hồi sẽ thông báo cho bạn về một lỗi có thể xảy ra.

+0

Smartin, có vẻ như bạn biết rất nhiều về SAML2 trong Laravel 5. Bạn có thể giúp tôi với điều này không? http://stackoverflow.com/questions/42396868/laravel-5-integrate-with-saml-2-with-existing-idp – ihue

Các vấn đề liên quan