0

私は2つのsimplesamlphpサーバーをセットアップしています。それらは両方とも同じ物理サーバー上にありますが、仮想ホストによって分離されています。彼らは現在ドメインにいます。

id.saml.domain.com<- ID プロバイダー

sp.saml.domain.com<- サービス プロバイダー

また、実際にシングル サインオンを実装する予定の Web アプリケーションである 3 番目のサイトもあります。私たちはそれを呼びます

test.domain.com/webapplication

example-authを使用して、サービスプロバイダーとIDプロバイダーが互いに通信しています。サービス プロバイダーに移動し、[認証ソースのテスト] をクリックして ID サーバーに送信し、ログイン プロンプトを取得して、例の資格情報を入力し、[送信] をクリックして、サービス プロバイダーに送り返すことができます。

この時点で、すべてが良さそうです。

私の問題は、Web サイトにサービス プロバイダーを実装しようとするときです。

サービスプロバイダーコードを呼び出すために、次のログインコードを用意しています

    $lib = "/ltsites/saml/service/lib";
    $sp = "default-sp";  // Name of SP defined in config/authsources.php

    try {
        // Autoload simplesamlphp classes.
        if(!file_exists("{$lib}/_autoload.php")) {
            throw(new Exception("simpleSAMLphp lib loader file does not exist: ".
            "{$lib}/_autoload.php"));
        }

        include_once("{$lib}/_autoload.php");
        $as = new SimpleSAML_Auth_Simple($sp);

        // Take the user to IdP and authenticate.
        $as->requireAuth();
        $valid_saml_session = $as->isAuthenticated();

    } catch (Exception $e) {
        // SimpleSAMLphp is not configured correctly.
        throw(new Exception("SSO authentication failed: ". $e->getMessage()));
        return;
    }

    if (!$valid_saml_session) {
        // Not valid session. Redirect a user to Identity Provider
        try {
            $as = new SimpleSAML_Auth_Simple($sp);
            $as->requireAuth();
        } catch (Exception $e) {
            // SimpleSAMLphp is not configured correctly.
            throw(new Exception("SSO authentication failed: ". $e->getMessage()));
            return;
        }
    }

    // At this point, the user is authenticated by the Identity Provider, and has access
    // to the attributes received with SAML assertion.
    $attributes = $as->getAttributes();

それは私をアイデンティティサーバーまでずっと転送し、資格情報を要求します. しかし、サービスプロバイダーに戻るとエラーが発生します

State information lost   
SimpleSAML_Error_NoState: NOSTATE

この wiki ページhttps://code.google.com/p/simplesamlphp/wiki/LostStateを見つけましたが、それを読んだ後に何もしませんでした (ページを無限更新ループに送った'session.cookie.domain'inの変更など) は機能しましたconfig\config.php

誰かアイデアはありますか?私はそれを間違って設定しましたか?Web アプリケーション自体がサービス プロバイダーである必要があるのではないかと考えています。つまりtest.domain.com/webapplication/simplesaml/、2 つが同じドメイン上にあるようにするには?

4

1 に答える 1