2017-02-09 176 views
1

我試圖理解SAML並構建一個簡單的PHP應用程序,該應用程序將與a docker image of a SAML IDP對話。我設置了一個得到它運行在端口8081在onelogin中與SAML集成

我設置的IDP配置:

'idp' => [ 
    // Identifier of the IdP entity (must be a URI) 
    'entityId' => 'app.example.com', 
    // SSO endpoint info of the IdP. (Authentication Request protocol) 
    'singleSignOnService' => [ 
    // URL Target of the IdP where the Authentication Request Message 
    // will be sent. 
    'url' => 'http://localhost:8081/simplesaml/saml2/idp/metadata.php', 

我不確定要放什麼東西在SP配置的URL值,但:

'sp' => [ 
    // Identifier of the SP entity (must be a URI) 
    'entityId' => 'http://authproxy.example.com', 
    // Specifies info about where and how the <AuthnResponse> message MUST be 
    // returned to the requester, in this case our SP. 
    'assertionConsumerService' => [ 
     // URL Location where the <Response> from the IdP will be returned 
     'url' => '', 

我必須自己寫這個端點嗎?如果是這樣,它必須返回什麼?

回答

2

在服務提供商(SP)發起SSO工作流程中的typical workflow是:

  1. SP重定向到的IdP用於認證與AuthnRequest
  2. 的IdP進行認證和授權,
  3. IdP重定向回SP特定的斷言消費者服務(ACS)的結果。

身份驗證請求(AuthnRequest)可能包含ACS URL,或者它可能被硬編碼爲靜態設置的一部分(如您的示例所示)。

是的,SP提供此URL。如果你想推出自己的產品,那麼你可以考慮一般使用OpenSAML,或者像OneLogin for PHP這樣的特定於平臺的軟件包。否則,如果您使用的是SP服務,那麼該服務提供了一個衆所周知的終端。 (例如,ADFS provides /adfs/ls。)

+0

php-saml存儲庫包含一個演示應用程序(https://github.com/onelogin/php-saml/tree/master/demo1)。用它來了解SAML的工作原理。 demo1應用在這裏描述: https://github.com/onelogin/php-saml#demo1 – smartin