1

simpleSAMLphp を symfony アプリケーションに統合しようとしています。サービス プロバイダは外部アプリケーションです。私のアプリケーションは ID プロバイダーとして機能しています。

認証をチェックせずにいくつかの属性を返すように simpleSAMLphp を構成しました。アプリケーションから idp リクエストを開始する方法がわからないので、saml2/idp/SSOService.php から次のコピーをコピーしました。

require_once('ServiceProvider/ssp/www/_include.php');

\SimpleSAML_Logger::info('SAML2.0 -...e');


$metadata = \SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();

$_GET['spentityid']='https://saml.serviceprovider.example.com';

$idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');

$idp = \SimpleSAML_IdP::getById('saml2:' . $idpEntityId);

\sspmod_saml_IdP_SAML2::receiveAuthnRequest($idp);


assert('FALSE');

しかし、それはエラーを与えます

in /lib/SAML2/Binding.php at line 95        
            throw new Exception('Unable to find the current binding.');

at SAML2_Binding ::getCurrentBinding () modules/saml/lib/IdP/SAML2.php at line 285 
at sspmod_saml_IdP_SAML2 ::receiveAuthnRequest (object(SimpleSAML_IdP))

アプリケーションからidpリクエストを開始する方法を知っている人はいますか?

4

1 に答える 1

2

API はSP API リファレンスに記載されています。

まず、simpleSAMLphp クラスをオートローダーに登録するファイルをロードします。ssp ディレクトリを指すようにパスを調整します (アプリの場所によって異なります)。

require_once('../../lib/_autoload.php');

認証ソースを選択します。ldap-auth選択した認証ソースに置き換えます。

$as = new SimpleSAML_Auth_Simple('ldap-auth');

次に、認証を要求します。

$as->requireAuth();

属性を出力します。

$attributes = $as->getAttributes();
print_r($attributes);

その他のオプションもご利用いただけます。すべてのパラメーターのリストについては、SP API リファレンスのドキュメントを参照してください。

于 2012-09-24T06:09:18.767 に答える