比較バージョン

キー

  • この行は追加されました。
  • この行は削除されました。
  • 書式設定が変更されました。

...

  • このガイドでは、uApprove JPはLinuxシステムにインストールされると仮定しています。Windows等の他のオペレーティングシステムにインストールすることも可能です。その場合は、いくつかのパスやコマンドを適切なものに置き換えてください。
  • このガイドでは、パスやコマンドは$IDP_HOME$$UAPPROVE_INSTALL$といった変数で示されます。明示的に置き換えが不要と書かれていない限りは、これらの変数は実際のパスに置き換えてください。

...

目次

目次
maxLevel2

想定

  • Shibboleth Identity Providerは、 $IDP_HOME$ (例: /opt/shibboleth-idp) にインストールされているものとします。
  • Tomcatは、$CATALINA_HOME$ (例: /usr/java/tomcat) にインストールされているものとし、$CATALINA_BASE$ (例: $CATALINA_HOME$)にIdPインスタンスの設定がされているものとします。
  • uApprove JP は、$UAPPROVE_INSTALL$ (例: /usr/local/src/uApproveJP-#version#) にダウンロード、展開されているものとします。

前提条件

  • Shibboleth Identity Provider 3.4.0以降がインストールされている必要があります。

    警告

    Shibboleth Identity Provider 3.4.0未満のバージョンでは動作しません。

1 基本的なデプロイ

1.1 ライブラリのインストール

ライブラリをIdPのライブラリディレクトリにコピーします:

...

注意

$IDP_HOME$/edit-webapp/WEB-INF/libにはそれぞれのライブラリの単一のバージョンのみが存在するようにしてください。

1.2 Velocity テンプレートファイル

属性選択画面用のVelocityテンプレートファイルをIdPのviewsディレクトリに上書きコピーします:

書式設定済み
# cp $UAPPROVE_INSTALL$/manual/examples/views/intercept/* $IDP_HOME$/views/intercept/
以下のメッセージが表示される場合がありますが、y を入力してください。
cp: `/opt/shibboleth-idp/views/intercept/attribute-release.vm' を上書きしますか?

1.3 CSS ファイル

CSSファイルをIdPのedit-webappディレクトリにコピーします:

書式設定済み
# cp $UAPPROVE_INSTALL$/manual/examples/edit-webapp/css/* $IDP_HOME$/edit-webapp/css/

1.4 メッセージファイル

メッセージファイルをIdPのメッセージディレクトリにコピーします:

...

パネル
borderColorsilver
titleBGColorwhite
borderStylesolid
title$IDP_HOME$/conf/services.xml

...

<!--
This collection of resources differs slightly in that it should not include the file extension.
Message sources are internationalized, and Spring will search for a compatible language extension
and fall back to one with only a .properties extension.
-->
<util:list id="shibboleth.MessageSourceResources">
    <value>%{idp.home}/messages/uApproveJP</value>
    <value>%{idp.home}/messages/messages</value>
    <value>%{idp.home}/system/messages/messages</value>
</util:list>

...

1.5 設定のカスタマイズ

$IDP_HOME$/conf/idp.propertiesに、以下の変更を行います。idp.consent.allowPerAttributeidp.consent.compareValuesの値をtrueに設定してください:

...

パネル
borderColorsilver
bgColorwhite
title$IDP_HOME$/system/flows/intercept/attribute-release-beans.xml

...

<bean id="IsConsentRequiredPredicate"
    class="jp.gakunin.idp.consent.logic.impl.IsConsentRequiredPredicate" />

...

1.6 カスタムテンプレート

テンプレートをカスタマイズしたい場合は、 コピー ~ uApproveJP-3.4.0 のインストールおよび設定方法テンプレートのカスタマイズ を参照してください。

少なくとも、所属機関のロゴを変更する必要があります。変更方法は以下のリンク先を参照してください。

GakuNinShare:Shibboleth IdP 3 - ロゴの変更

1.7 ログの設定

uApprove JPのログを出力するには、$IDP_HOME$/conf/logback.xmlに以下を追加します:

パネル
borderColorsilver
bgColorwhite
title$IDP_HOME$/conf/logback.xml

...

<!-- Logging level shortcuts. -->
<variable name="idp.loglevel.uApproveJP" value="${idp.loglevel.uApproveJP:-INFO}" />

...

<!-- =========================================================== -->
<!-- ============== Logging Categories and Levels ============== -->
<!-- =========================================================== -->

<logger name="jp.gakunin.idp" level="${idp.loglevel.uApproveJP}"/>

...

1.8 デプロイ

IdP で uApprove JP を有効にするには IdP を再デプロイする必要があります:

...

書式設定済み
# systemctl restart tomcat

2 高度なデプロイ

この節では高度な設定についてのトピックを取り上げます。

2.1 リレーショナルデータベースを用いたユーザ同意情報の保存

リレーショナルデータベース(以下、「RDB」とします)を用いて、ユーザ同意情報の保存を行うことができます。

2.1.1. MySQLの設定

注意

以下のデータベースパラメータは一例です。実際の値は必要に応じて変更してください。特にパスワードは安全なものを用意してください。

...

  1. データベース shibbolethの作成
    Shibboleth IdPで使用するデータベース shibbolethを作成します:

    情報

    rootにパスワードが設定してあってコマンドが以下のエラーで失敗する場合は、-pオプションを追加してください。

    書式設定済み
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    パネル
    borderColorsilver
    bgColorwhite

    db$ mysql -u root
    mysql>
    CREATE DATABASE shibboleth;

  2. ユーザ作成
    IdPからデータベース shibbolethにアクセスするためのユーザ shibbolethを作成し、データベース shibbolethへの権限を付与します:

    パネル
    borderColorsilver
    bgColorwhite

    db$ mysql -u root
    mysql>
    CREATE USER 'shibboleth'@'localhost' IDENTIFIED BY 'shibpassword';           #←任意のパスワード
    GRANT INSERT, SELECT, UPDATE, DELETE ON shibboleth.* TO 'shibboleth'@'localhost';

  3. StorageRecordsテーブル作成

    JPAStorageServiceが使用するテーブル StorageRecordsを作成します:

    パネル
    borderColorsilver
    bgColorwhite

    db$ mysql -u root
    mysql>
    use shibboleth;
    CREATE TABLE `StorageRecords` (
        `context` varchar(255) NOT NULL,
        `id` varchar(255) NOT NULL,
        `expires` bigint(20) DEFAULT NULL,
        `value` longtext NOT NULL,
        `version` bigint(20) NOT NULL,
        PRIMARY KEY (`context`,`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

2.1.3. MySQL Connector/Jのインストール

  1. MySQLへのアクセスに必要なMySQL Connector/J(mysql-connector-java.jar)をインストールします:

    書式設定済み
    # yum install mysql-connector-java
  2. /usr/share/java配下にインストールされているので、edit-webapp/ 配下のlibディレクトリにシンボリックリンクを作成します:

    パネル
    # rpm -ql mysql-connector-java
    (省略)
    /usr/share/java/mysql-connector-java.jar
    (省略)
    # ln -s /usr/share/java/mysql-connector-java.jar $IDP_HOME$/edit-webapp/WEB-INF/lib/
  3. コピー ~ uApproveJP-3.4.0 のインストールおよび設定方法1.8 デプロイの手順に従って再デプロイします。

2.1.4. idp.consent.StorageServiceの設定変更

idp.consent.StorageServiceの設定をshibboleth.JPAStorageServiceに変更します:

パネル
borderColorsilver
bgColorwhite
title$IDP_HOME$/conf/idp.properties

# Set to "shibboleth.StorageService" or custom bean for alternate storage of consent 
idp.consent.StorageService = shibboleth.JPAStorageService

2.1.5. shibboleth.JPAStorageServiceの設定

コピー ~ uApproveJP-32.1.4. 0 のインストールおよび設定方法idp.consent.StorageServiceの設定変更idp.sesssion.StorageServiceに設定したshibboleth.JPAStorageServiceを定義します。

id="Shibboleth.MySQLDataSource"bean定義のp:url, p:username, p:passwordは、コピー ~ uApproveJP-3.4.0 のインストールおよび設定方法2.1.1. MySQLの設定に合わせて設定します:

パネル
borderColorsilver
bgColorwhite
title$IDP_HOME$/conf/global.xml

<!-- Use this file to define any custom beans needed globally. -->
<bean id="shibboleth.JPAStorageService"
      class="org.opensaml.storage.impl.JPAStorageService"
      p:cleanupInterval="%{idp.storage.cleanupInterval:PT10M}"
      c:factory-ref="shibboleth.JPAStorageService.entityManagerFactory" />

<bean id="shibboleth.JPAStorageService.entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
     <property name="packagesToScan" value="org.opensaml.storage.impl" />
     <property name="dataSource" ref="shibboleth.MySQLDataSource" />
     <property name="jpaVendorAdapter" ref="shibboleth.JPAStorageService.JPAVendorAdapter" />
     <property name="jpaDialect">
          <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
     </property>
</bean>

<bean id="shibboleth.JPAStorageService.JPAVendorAdapter"
      class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
      p:database="MYSQL" />

<bean id="shibboleth.MySQLDataSource"
      class="org.apache.commons.dbcp2.BasicDataSource"
      p:driverClassName="com.mysql.jdbc.Driver"
      p:url="jdbc:mysql://localhost:3306/shibboleth"
      p:username="shibboleth"
      p:password="shibpassword"
      p:maxTotal="10"
      p:maxIdle="5"
      p:maxWaitMillis="15000"
      p:testOnBorrow="true"
      p:validationQuery="select 1"
      p:validationQueryTimeout="5" />

2.1.6. Tomcatの再起動

Tomcatを再起動します:

書式設定済み
# systemctl restart tomcat

2.2 テンプレート

テンプレートのカスタマイズ

$IDP_HOME$/views/にある Velocityテンプレートファイル 、 $IDP_HOME$/edit-webapp/にあるCSS や画像ファイルは自由にカスタマイズすることができます。 Velocity を用いているので容易にカスタマイズ出来るようになっています。

Velocity については Velocity User Guide を参照してください。

2.3 ローカライズ

Relying Partyの名前と説明

現状では、ローカライズされた Relying Party の名前と説明を取得する際には、メタデータのうち<AttributeConsumingService>要素および<mdui:UIInfo>要素がサポートされています。

...

ヒント

両方記載されている場合には<mdui:UIInfo>要素が優先されます。

学認のSPについても海外SPの一部を除いてこの情報が含まれています。

3 AttributeInMetadata

3.1 AttributeInMetadataマッチングルールの設定

このルールは、SP がその属性を必要とした場合に、そのメタデータにより属性の送信を許可します。属性は<SPSSODescriptor>中の<AttributeConsumingService>によって示されます。 <RequestedAttribute>isRequired="true"を記述した属性は必須とマークされ、isRequired="false"を記述した属性はオプションとマークされます。詳細は SAMLメタデータを参照してください。

注意

以下の点に注意してください:

  • このフィルタの利用には属性の要求者のメタデータがロードされ利用可能である必要があります。
  • 要求者のメタデータは<SPSSODescriptor>ロールを持っている必要があります。このロールがリストされた属性を持っているためです。
  • AttributeInMetadataマッチングルールは値のルールとしてのみ働き、<PermitValueRule>の場合のみ意味をなします。

名前空間の定義

属性フィルタのポリシーにおいて、このプラグイン用に名前空間の定義を加える必要があります。以下のように行います:

  • ルート <AttributeFilterPolicyGroup>xmlns:xsi属性の前xmlns:uajpmf="http://www.gakunin.jp/ns/uapprove-jp/afp/mf" 属性を追加します。
  • xsi:schemaLocation属性のホワイトスペースで区切られた値のリストの最後に以下を追加します:
    http://www.gakunin.jp/ns/uapprove-jp/afp/mf http://www.gakunin.jp/schema/idp/gakunin-afp-mf-uapprovejp.xsd

ルールの定義

このルールは<PermitValueRule xsi:type="uajpmf:AttributeInMetadata">のように記述します。以下のオプショナルな属性を使用できます:

...

パネル
borderColorsilver
bgColorwhite
<!--    ==================================================================================
case 1: mail 属性、eduPersonPrincipalName属性、eduPersonAffiliation属性を、メタデータの
        定義と照合するルールです。

        メタデータでisRequired="true"が指定されている属性は、すべて必須情報になり常に
        送信されます。

        メタデータでisRequired="false"が指定されている属性は以下の通りです。
        * mail属性は必須情報となり常に送信されます。
        * eduPersonPrincipalName属性はオプション情報となります。属性選択画面ではチェック
          ボックスつきで表示されます。利用者がチェックボックスをチェックした場合に限り送信
          されます。
        * eduPersonAffiliation属性は送信されません。

        メタデータにAttributeConsumingServiceをもたないSPの場合はどの属性も送信しません。
        ================================================================================== -->
<afp:AttributeFilterPolicy id="PolicyforSPwithAttributeConsumingService">
    <afp:PolicyRequirementRule xsi:type="basic:ANY" />

    <afp:AttributeRule attributeID="mail">
        <afp:PermitValueRule xsi:type="uajpmf:AttributeInMetadata"
                             onlyIfRequired="false" />
    </afp:AttributeRule>

    <afp:AttributeRule attributeID="eduPersonPrincipalName">
        <afp:PermitValueRule xsi:type="uajpmf:AttributeInMetadata"
                             onlyIfRequired="false"
                             onlyIfChecked="true" />
    </afp:AttributeRule>

    <afp:AttributeRule attributeID="eduPersonAffiliation">
        <afp:PermitValueRule xsi:type="uajpmf:AttributeInMetadata" />
    </afp:AttributeRule>

</afp:AttributeFilterPolicy>

<!--    ==================================================================================
case 2: メタデータに AttributeConsumingServiceがないSPに対するルールを追加したルール
        です。

        AttributeConsumingService要素を持たないSPの場合は以下の通りです。
        * mail属性は必須情報となり常に送信されます。
        * eduPersonPrincipalName属性はオプション情報となります。属性選択画面ではチェック
          ボックスつきで表示されます。利用者がチェックボックスをチェックした場合に限り送信
          されます。
        * eduPersonAffiliation属性は送信されません。

        AttributeConsumingService要素を持つSPの場合はcase 1と同じです。
        ================================================================================== -->
<afp:AttributeFilterPolicy id="PolicyforSPwithoutAttributeConsumingService">
    <afp:PolicyRequirementRule xsi:type="basic:ANY" />

    <afp:AttributeRule attributeID="mail">
        <afp:PermitValueRule xsi:type="uajpmf:AttributeInMetadata"
                             matchIfMetadataSilent="true"
                             onlyIfRequired="false" />
    </afp:AttributeRule>

    <afp:AttributeRule attributeID="eduPersonPrincipalName">
        <afp:PermitValueRule xsi:type="uajpmf:AttributeInMetadata"
                             matchIfMetadataSilent="true"
                             onlyIfRequired="false"
                             onlyIfChecked="true" />
    </afp:AttributeRule>

    <afp:AttributeRule attributeID="eduPersonAffiliation">
        <afp:PermitValueRule xsi:type="uajpmf:AttributeInMetadata" />
    </afp:AttributeRule>

</afp:AttributeFilterPolicy>

4 トラブルシューティング

4.1 トラブルシューティング

  • ERROR ないしWARN メッセージについては、$IDP_HOME$/logs/idp-process.logをチェックしてください。

  • $CATALINA_BASE$/logsにあるTomcatのログファイルにエラーメッセージがないかチェックしてください。

4.2 詳細なログ設定

DEBUG ないしTRACEログレベルを有効にしたい場合は、$IDP_HOME$/conf/idp.propertiesにて以下を追加します:

パネル
borderColorsilver
bgColorwhite
languagexml
title$IDP_HOME$/conf/idp.properties
idp.loglevel.uApproveJP = DEBUG

A SPでの属性使用用途通知

SP管理者はSPのメタデータに属性の使用用途を記述することで、SPの利用者に属性の使用用途 (例えば、プロファイルの初期値として使用) をuApprove JPで表示することができます。

A.1 設定

属性使用用途通知機能は、<RequestedAttribute>uajpmd:description属性を追加する、または、<SPSSODescriptor><Extensions><uajpmd:RequestedAttributeExtension>を追加することで利用できます。

...

これらを使う場合はメタデータの先頭に名前空間 xmlns:uajpmd="http://www.gakunin.jp/ns/uapprove-jp/metadata" の宣言を忘れないでください。

uajpmd:description

この属性は<ResquestedAttribute>にて定義します:

...

パネル
borderColorsilver
bgColorwhite
<md:RequestedAttribute FriendlyName="mail"
        Name="urn:oid:0.9.2342.19200300.100.1.3"
        NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
        uajpmd:description="The mail attribute is used as the initial value of the mail address field of the registration form."/>

<uajpmd:RequestedAttributeExtension>

<uajpmd:RequestedAttributeExtension>は以下の必須属性と一つ以上の<uajpmd:Description>と共に設定します:

...