2017年5月25日木曜日

Shibboleth SPの設定

今回、SSO実現するためのSP側の設定となる。主に3つのXMLが中心的な役割を果たす。デフォルトの場所は、C:\opt\shibboleth-sp\etc\shibboleth にある
1)shibboleth2.xml、一番重要な設定ファイル。
①InProcess/ISAPI/Site
IISのSitesのIDとBindingポート番号と同じように設定する。また、nameはサイトのURLとなる。
 <Site id="1" name="sp.xxxxx.jp"/>
 <Site id="2" name="sp.xxxxx.jp" scheme="http" port="1116"/>
 <Site id="3" name="sp.xxxxx.jp" port="1117"/>

②RequestMapper/RequestMap/Host
nameは上記Siteのname:portとなる。アクセス認証必要な部分は、Pathで設定。今回の場合sp.xxxxx.jp/ssoにアクセスする場合、認証が必要。複数ポートがある場合、デフォルト以外のapplicationIdを指定する必要がある。
<Host name="sp.xxxxx.jp">
    <Path name="sso" authType="shibboleth" requireSession="true"/>
</Host>
<Host name="sp.xxxxx.jp:1116" applicationId="1116AAA">
    <Path name="sso" authType="shibboleth" requireSession="true"/>
</Host>
<Host name="sp.xxxxx.jp:1117" applicationId="1117BBB">
    <Path name="sso" authType="shibboleth" requireSession="true"/>
</Host>

③ApplicationDefaults
entityIDは任意の値でも良いが、一般的に以下のような形
http://sp.xxxxx.jp/shibboleth

SSO entityIDはIdP側のentityIDで、3)のmetadataにあるものと一致させる
http://openam.xxxxx.local:8080/openam
discovery serviceを使っていないため、discoveryProtocolとdiscoveryURL項目を削除

下記3)のmetadataを指定
<MetadataProvider type="XML" file="idp-metadata.xml"/>

複数ポートの場合、先定義したapplicationIdを使用する
<ApplicationOverride id="1116AAA" entityID="http://sp.xxxxx.jp:1116/shibboleth"/>
<ApplicationOverride id="1117BBB" entityID="http://sp.xxxxx.jp:1117/shibboleth"/>

2)attribute-map.xml
IdP側が送られたユーザー情報のattributeをどのようにマッピングするかの定義。デフォルトLDAP-based attributesがコメントしているため、コメントアウトする。このファイルが更新された場合、Shibboleth Daemonを再起動。

<Attribute name="urn:oid:0.9.2342.19200300.100.1.1" id="uid"/>
上記記述の意味は、IdPからPOSTされたSAMLの情報に、Name="urn:oid:0.9.2342.19200300.100.1.1"の値「test1」を$_SERVER["HTTP_UID"]に保存される(PHPの場合)

<saml:Attribute Name="urn:oid:0.9.2342.19200300.100.1.1">
    <saml:AttributeValue
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:type="xs:string"
        >test1</saml:AttributeValue>
SAMLファイルにあるNameはIdP側で設定する必要がある。別途IdPの設定を参照

3)以下のIdPサーバーにアクセスし、Matadataを入手、C:\opt\shibboleth-sp\etc\shibbolethにidp-metadata.xmlとして保存。このファイルには、IdPのアクセスポイント、証明書などが定義されている。
http://openam.xxxxx.local:8080/openam/saml2/jsp/exportmetadata.jsp?entityid=


参考:http://blogs.forgerock.org/petermajor/2010/09/how-to-access-federation-metadata-from-browser/

0 件のコメント:

コメントを投稿