5. intra-mart Accel Platform をセットアップする¶
項目
5.1. モジュールの選択¶
Salesforce 連携 のみ利用する場合は、Salesforce Streaming クライアント を選択する必要はありません。 Salesforce Streaming クライアント を利用する場合は、Salesforce 連携 を必ず選択してください。
5.2. 設定ファイルの編集¶
認証タイプ
oauth-client : 「プロバイダ設定」を利用してアクセストークンを取得します。 fixed-user-password : 指定されたSalesforceユーザのユーザ名とパスワードを利用してアクセストークンを取得します。 user-password : 「UserPasswordResolver」が解決するユーザ名とパスワードを利用してアクセストークンを取得します。
コラム
oauth-client : OAuth 2.0 Web サーバ認証フロー fixed-user-password : OAuth 2.0 ユーザ名パスワードフロー user-password : OAuth 2.0 ユーザ名パスワードフロー
OAuth によるアプリケーションの認証 (日本語) Authenticating Apps with OAuth (English) 使用 OAuth 验证应用程序 (中文)
5.2.1. 認証タイプ「oauth-client」を利用する場合¶
IM-Juggling の「ProjectNavigator」より <(プロジェクト名)/juggling.im> ファイルをダブルクリックで開き、「設定ファイル」タブを選択してください。Salesforce 連携 モジュールのSalesforce REST API 用 OAuth プロバイダ設定(oauth-provider-config/im_salesforce_rest_api.xml)を選択し、出力ボタンをクリックします。
「ProjectNavigator」内の <(プロジェクト名)/oauth-provider-config/im_salesforce_rest_api.xml> ファイルをダブルクリックで開き、「ソース」タブを選択してください。利用する Salesforce の環境に合わせた設定情報を記述します。
デフォルトでは、「oauth-provider」タグがコメントアウトされていますので、コメントアウトを解除してください。<?xml version="1.0" encoding="UTF-8"?> <oauth-provider-config xmlns="http://www.intra-mart.jp/system/oauth/client/config/oauth-provider-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.intra-mart.jp/system/oauth/client/config/oauth-provider-config ../schema/oauth-provider-config.xsd "> <oauth-providers> <!-- <oauth-provider id="Please_input_your_ID"> <provider-type>salesforce</provider-type> <name message-cd="CAP.Z.IWP.SALESFORCE.OAUTH.PROVIDER.NAME">Salesforce REST API</name> <description message-cd="CAP.Z.IWP.SALESFORCE.OAUTH.PROVIDER.DESCRIPTION">It is allow the use of the Salesforce REST API. It is possible to access a Salesforce Object by using the Salesforce REST API.</description> <icon-path>im_salesforce/images/salesforce_48.png</icon-path> <oauth-config> <authz-end-point>https://login.salesforce.com/services/oauth2/authorize</authz-end-point> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <client-id>[Please input your application's Client ID]</client-id> <client-secret>[Please input your application's Client Secret]</client-secret> </oauth-config> <extra-config> <parameter name="timeout-minutes">[Please input your Salesforce session timeout value (Unit: minutes)]</parameter> </extra-config> </oauth-provider> --> </oauth-providers> </oauth-provider-config> 任意のプロバイダIDを指定してください。<oauth-provider id="yourcompany.salesforce.com"> ・・・ </oauth-provider>コラム
以下のように intra-mart Accel Platform の 対象のテナントIDを指定することも可能です。テナントIDは半角スペースで区切って記載してください。<oauth-provider id="yourcompany.salesforce.com" target-tenant="default secondary"> ・・・ </oauth-provider> client-id、client-secret には Salesforce システム管理者 が「接続アプリケーションの登録」で登録した接続アプリケーションの「コンシューマ鍵」、「コンシューマの秘密」をそれぞれ指定してください。<oauth-provider id="yourcompany.salesforce.com"> ・・・ <oauth-config> <authz-end-point>https://login.salesforce.com/services/oauth2/authorize</authz-end-point> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <client-id>3MVG9ZL0ppGP5UrB0UWy89gD9mcHOhv1LOkliPQg.RPuiPisQQl0kDOvLNOeCg1pQwatADMMAfiaaOcdIMsn8</client-id> <client-secret>6021527967626201664</client-secret> </oauth-config> ・・・ </oauth-provider> 追加設定に timeout-minutes パラメータを定義して、「タイムアウト値の設定」で設定したタイムアウト値(分)を指定してください。<oauth-provider id="yourcompany.salesforce.com"> ・・・ <extra-config> <parameter name="timeout-minutes">60</parameter> </extra-config> ・・・ </oauth-provider> 「ProjectNavigator」内の <(プロジェクト名)/salesforce-client-config/salesforce-client-config.xml> ファイルをダブルクリックで開き、「ソース」タブを選択してください。
デフォルトでは、認証タイプ「oauth-client」の設定が定義されています。<?xml version="1.0" encoding="UTF-8"?> <salesforce-client-config xmlns="http://www.intra-mart.jp/system/salesforce/client/config/salesforce-client-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.intra-mart.jp/system/salesforce/client/config/salesforce-client-config ../schema/salesforce-client-config.xsd"> <salesforce-clients> <salesforce-client id="sample_1" type="oauth-client"> <oauth-provider-id>[Please input OAuth provider ID in oauth-provider-config]</oauth-provider-id> </salesforce-client> <!-- <salesforce-client id="sample_2" type="fixed-user-password" tenant="default"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>[Please input your Consumer Key]</consumer-key> <consumer-secret>[Please input your Consumer Secret]</consumer-secret> <user>[Please input your Salesforce user name]</user> <password cryption="sample-cryption-category">[Please input your Salesforce user password]</password> <extra-parameter name="timeout-minutes">[Please input your Salesforce session timeout value (Unit: minutes)]</extra-parameter> </salesforce-client> <salesforce-client id="sample_3" type="user-password" tenant="default secondary"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>[Please input your Consumer Key]</consumer-key> <consumer-secret cryption="sample-cryption-category">[Please input your Consumer Secret]</consumer-secret> <user-password-resolver>[Please input fully qualified class name which class is implements UserPasswordResolver]</user-password-resolver> <extra-parameter name="timeout-minutes">[Please input your Salesforce session timeout value (Unit: minutes)]</extra-parameter> <extra-parameter name="sample_key">sample_value</extra-parameter> </salesforce-client> --> </salesforce-clients> </salesforce-client-config> 「salesforce-client」の「id」属性に任意のクライアントID、「type」属性に「oauth-client」を指定してください。<salesforce-client id="salesforce_oauth" type="oauth-client"> ・・・ </salesforce-client>コラム
以下のように intra-mart Accel Platform の 対象のテナントIDを指定することも可能です。テナントIDは半角スペースで区切って記載してください。<salesforce-client id="salesforce_oauth" type="oauth-client" tenant="default secondary"> ・・・ </salesforce-client> 「oauth-provider-id」にSalesforce REST API 用 OAuth プロバイダ設定で設定したプロバイダIDを指定してください。<salesforce-client id="salesforce_oauth" type="oauth-client"> <oauth-provider-id>yourcompany.salesforce.com</oauth-provider-id> </salesforce-client>
5.2.2. 認証タイプ「fixed-user-password」を利用する場合¶
「ProjectNavigator」内の <(プロジェクト名)/salesforce-client-config/salesforce-client-config.xml> ファイルをダブルクリックで開き、「ソース」タブを選択してください。
デフォルトでは、認証タイプ「oauth-client」の設定が定義されています。 認証タイプ「fixed-user-password」のテンプレートは、コメントアウトされていますので、必要に応じてコメントアウトを解除して利用してください。<?xml version="1.0" encoding="UTF-8"?> <salesforce-client-config xmlns="http://www.intra-mart.jp/system/salesforce/client/config/salesforce-client-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.intra-mart.jp/system/salesforce/client/config/salesforce-client-config ../schema/salesforce-client-config.xsd"> <salesforce-clients> <salesforce-client id="sample_1" type="oauth-client"> <oauth-provider-id>[Please input OAuth provider ID in oauth-provider-config]</oauth-provider-id> </salesforce-client> <!-- <salesforce-client id="sample_2" type="fixed-user-password" tenant="default"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>[Please input your Consumer Key]</consumer-key> <consumer-secret>[Please input your Consumer Secret]</consumer-secret> <user>[Please input your Salesforce user name]</user> <password cryption="sample-cryption-category">[Please input your Salesforce user password]</password> <extra-parameter name="timeout-minutes">[Please input your Salesforce session timeout value (Unit: minutes)]</extra-parameter> </salesforce-client> <salesforce-client id="sample_3" type="user-password" tenant="default secondary"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>[Please input your Consumer Key]</consumer-key> <consumer-secret cryption="sample-cryption-category">[Please input your Consumer Secret]</consumer-secret> <user-password-resolver>[Please input fully qualified class name which class is implements UserPasswordResolver]</user-password-resolver> <extra-parameter name="timeout-minutes">[Please input your Salesforce session timeout value (Unit: minutes)]</extra-parameter> <extra-parameter name="sample_key">sample_value</extra-parameter> </salesforce-client> --> </salesforce-clients> </salesforce-client-config> 「salesforce-client」の「id」属性に任意のクライアントID、「type」属性に「fixed-user-password」を指定してください。<salesforce-client id="salesforce_fixed" type="fixed-user-password"> ・・・ </salesforce-client> 「consumer-key」、「consumer-secret」には Salesforce システム管理者が「接続アプリケーションの登録」で登録した接続アプリケーションの「コンシューマ鍵」、「コンシューマの秘密」をそれぞれ指定してください。<salesforce-client id="salesforce_fixed" type="fixed-user-password"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>3MVG9ZL0ppGP5UrB0UWy89gD9mcHOhv1LOkliPQg.RPuiPisQQl0kDOvLNOeCg1pQwatADMMAfiaaOcdIMsn8</consumer-key> <consumer-secret>6021527967626201664</consumer-secret> ・・・ </salesforce-client>「consumer-secret」に「cryption」属性が設定されている場合、指定の方式で暗号化された文字列を設定します。「cryption」属性に設定するカテゴリは、「暗号化設定」を参照してください。<salesforce-client id="salesforce_fixed" type="fixed-user-password"> ・・・ <consumer-secret cryption="sample-cryption-category">Dl2WiW+7HXcIv1hTt37GY7tTr1KCPVFJ</consumer-secret> ・・・ </salesforce-client>注意
パスワード文字列を暗号化するためのツールは提供されません。Java API CryptionUtil を利用して、指定したカテゴリで暗号化するプログラムを作成する必要があります。Java API CryptionUtil の詳細は「CryptionUtil APIドキュメント」を参照してください。 「user」、「password」には Salesforce にログイン可能なユーザIDとパスワードを指定してください。<salesforce-client id="salesforce_fixed" type="fixed-user-password"> ・・・ <user>aoyagi@intra-mart.jp</user> <password>myPassword</password> ・・・ </salesforce-client>「password」に「cryption」属性が設定されている場合、指定の方式で暗号化された文字列を設定します。「cryption」属性に設定するカテゴリは、「暗号化設定」を参照してください。<salesforce-client id="salesforce_fixed" type="fixed-user-password"> ・・・ <password cryption="sample-cryption-category">cNnnOz2rYGhyMBmERC9cfA==</password> ・・・ </salesforce-client>注意
Salesforce の API を利用する際は、 Salesforce が発行するセキュリティトークンを利用して Salesforce にログインする必要があります。例えば、ユーザのパスワードが myPassword で、セキュリティトークンが XXXXXXXXXX の場合は、パスワード値に myPasswordXXXXXXXXXX を指定する必要があります。<salesforce-client id="salesforce_fixed" type="fixed-user-password"> ・・・ <password>myPasswordXXXXXXXXXX</password> ・・・ </salesforce-client>セキュリティトークンの詳細は、以下の Salesforce オンラインヘルプを参照してください。
セキュリティトークンのリセット (日本語) Reset Your Security Token (English) 重置您的安全标记 (中文)セキュリティトークンを使用せずに Salesforce の API を利用するには、接続元の IP アドレスを許可する必要があります。詳細は、以下の Salesforce オンラインヘルプを参照してください。注意
パスワード文字列を暗号化するためのツールは提供されません。Java API CryptionUtil を利用して、指定したカテゴリで暗号化するプログラムを作成する必要があります。Java API CryptionUtil の詳細は「CryptionUtil APIドキュメント」を参照してください。「extra-parameter」の「name」属性 ”timeout-minutes” を定義して、「タイムアウト値の設定」で設定したタイムアウト値(分)を指定してください。
<salesforce-client id="salesforce_fixed" type="fixed-user-password"> ・・・ <extra-parameter name="timeout-minutes">60</extra-parameter> ・・・ </salesforce-client>
5.2.3. 認証タイプ「user-password」を利用する場合¶
「ProjectNavigator」内の <(プロジェクト名)/salesforce-client-config/salesforce-client-config.xml> ファイルをダブルクリックで開き、「ソース」タブを選択してください。
デフォルトでは、認証タイプ「oauth-client」の設定が定義されています。 認証タイプ「user-password」のテンプレートは、コメントアウトされていますので、必要に応じてコメントアウトを解除して利用してください。<?xml version="1.0" encoding="UTF-8"?> <salesforce-client-config xmlns="http://www.intra-mart.jp/system/salesforce/client/config/salesforce-client-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.intra-mart.jp/system/salesforce/client/config/salesforce-client-config ../schema/salesforce-client-config.xsd"> <salesforce-clients> <salesforce-client id="sample_1" type="oauth-client"> <oauth-provider-id>[Please input OAuth provider ID in oauth-provider-config]</oauth-provider-id> </salesforce-client> <!-- <salesforce-client id="sample_2" type="fixed-user-password" tenant="default"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>[Please input your Consumer Key]</consumer-key> <consumer-secret>[Please input your Consumer Secret]</consumer-secret> <user>[Please input your Salesforce user name]</user> <password cryption="sample-cryption-category">[Please input your Salesforce user password]</password> <extra-parameter name="timeout-minutes">[Please input your Salesforce session timeout value (Unit: minutes)]</extra-parameter> </salesforce-client> <salesforce-client id="sample_3" type="user-password" tenant="default secondary"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>[Please input your Consumer Key]</consumer-key> <consumer-secret cryption="sample-cryption-category">[Please input your Consumer Secret]</consumer-secret> <user-password-resolver>[Please input fully qualified class name which class is implements UserPasswordResolver]</user-password-resolver> <extra-parameter name="timeout-minutes">[Please input your Salesforce session timeout value (Unit: minutes)]</extra-parameter> <extra-parameter name="sample_key">sample_value</extra-parameter> </salesforce-client> --> </salesforce-clients> </salesforce-client-config> 「salesforce-client」の「id」属性に任意のクライアントID、「type」属性に「user-password」を指定してください。<salesforce-client id="salesforce_user_password" type="user-password"> ・・・ </salesforce-client> 「consumer-key」、「consumer-secret」には Salesforce システム管理者が「接続アプリケーションの登録」で登録した接続アプリケーションの「コンシューマ鍵」、「コンシューマの秘密」をそれぞれ指定してください。<salesforce-client id="salesforce_user_password" type="user-password"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>3MVG9ZL0ppGP5UrB0UWy89gD9mcHOhv1LOkliPQg.RPuiPisQQl0kDOvLNOeCg1pQwatADMMAfiaaOcdIMsn8</consumer-key> <consumer-secret>6021527967626201664</consumer-secret> ・・・ </salesforce-client> 「user-password-resolver」に「UserPasswordResolver」の 実装クラス を指定してください。<salesforce-client id="salesforce_user_password" type="user-password"> ・・・ <user-password-resolver>jp.co.intra_mart.system.salesforce.client.impl.UserPasswordResolverImplForPasswordCredentialsGrant</user-password-resolver> ・・・ </salesforce-client>コラム
「user-password-resolver」を省略した場合は、「UserPasswordResolverImplForPasswordCredentialsGrant」が利用されます。「UserPasswordResolverImplForPasswordCredentialsGrant」は、intra-mart Accel Platform のログインユーザのユーザコードとパスワードを返却します。注意
intra-mart Accel Platform のパスワード保存方式に「ハッシュ化」を利用している場合、デフォルト値「UserPasswordResolverImplForPasswordCredentialsGrant」は利用できません。(理由:平文パスワードを取得できないため)以下の代替案を検討してください。
認証タイプ oauth-client、または、fixed-user-password を利用する。注意
以下の全ての条件に該当する場合、デフォルト値「UserPasswordResolverImplForPasswordCredentialsGrant」は利用できません。(理由:「UserPasswordResolverImplForPasswordCredentialsGrant」は、Salesforceのセキュリティトークンを付与したパスワードを返却しないため)
Salesforce の REST API を利用する際にセキュリティトークンが必要な環境である。 アクセストークンを取得する際の認証タイプが user-password である。以下の代替案を検討してください。
認証タイプ oauth-client、または、fixed-user-password を利用する。 パスワードの末尾に Salesforceのセキュリティトークン付与する「UserPasswordResolver」を独自実装する。 セキュリティトークンを使用せずに Salesforce の REST API を利用できるように設定する。詳細は、以下の Salesforce オンラインヘルプを参照してください。「extra-parameter」の「name」属性 ”timeout-minutes” を定義して、「タイムアウト値の設定」で設定したタイムアウト値(分)を指定してください。
<salesforce-client id="salesforce_user_password" type="user-password"> ・・・ <extra-parameter name="timeout-minutes">60</extra-parameter> ・・・ </salesforce-client>
5.2.4. Salesforce クライアント設定ファイルの確認¶
<?xml version="1.0" encoding="UTF-8"?> <salesforce-client-config xmlns="http://www.intra-mart.jp/system/salesforce/client/config/salesforce-client-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.intra-mart.jp/system/salesforce/client/config/salesforce-client-config ../schema/salesforce-client-config.xsd"> <salesforce-clients> <!-- 認証タイプ「oauth-client」を利用する場合 --> <salesforce-client id="salesforce_oauth" type="oauth-client"> <oauth-provider-id>yourcompany.salesforce.com</oauth-provider-id> </salesforce-client> <!-- 認証タイプ「fixed-user-password」を利用する場合 --> <salesforce-client id="salesforce_fixed" type="fixed-user-password" tenant="default"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>3MVG9ZL0ppGP5UrB0UWy89gD9mcHOhv1LOkliPQg.RPuiPisQQl0kDOvLNOeCg1pQwatADMMAfiaaOcdIMsn8</consumer-key> <consumer-secret cryption="sample-cryption-category">Dl2WiW+7HXcIv1hTt37GY7tTr1KCPVFJ</consumer-secret> <user>aoyagi@intra-mart.jp</user> <password cryption="sample-cryption-category">cNnnOz2rYGhyMBmERC9cfA==</password> <extra-parameter name="timeout-minutes">60</extra-parameter> </salesforce-client> <!-- 認証タイプ「user-password」を利用する場合 --> <salesforce-client id="salesforce_user_password" type="user-password" tenant="default secondary"> <token-end-point>https://login.salesforce.com/services/oauth2/token</token-end-point> <consumer-key>3MVG9ZL0ppGP5UrB0UWy89gD9mcHOhv1LOkliPQg.RPuiPisQQl0kDOvLNOeCg1pQwatADMMAfiaaOcdIMsn8</consumer-key> <consumer-secret>6021527967626201664</consumer-secret> <user-password-resolver>jp.co.intra_mart.system.salesforce.client.impl.UserPasswordResolverImplForPasswordCredentialsGrant</user-password-resolver> <extra-parameter name="timeout-minutes">60</extra-parameter> </salesforce-client> </salesforce-clients> </salesforce-client-config>
5.3. テナント環境セットアップ¶
テナント環境セットアップについては、「intra-mart Accel Platform セットアップガイド」-「テナント環境セットアップ」を参照してください。
5.4. WebSphere Application Server 利用時の設定¶
5.4.1. Java VM引数に -Dhttps.protocols=TLSv1.2 を追加する¶
-Dhttps.protocols=TLSv1.2
5.4.2. VeriSign Class 3 Public PCA - Generation 5 (G5) を追加する¶
Salesforce を利用する場合の問題について
注意
以下のURLから「VeriSign Class 3 Public PCA - Generation 5 (G5)」証明書ファイルをダウンロードして、WebSphere Application Server 内の任意のディレクトリに配置します。
メニューから[セキュリティー]-[SSL 証明書および鍵管理]を選択します。
[鍵ストアおよび証明書]リンクをクリックします。
[NodeDefaultTrustStore]リンクをクリックします。
[署名者証明書]リンクをクリックします。
[追加]ボタンをクリックします。
- 以下の項目を入力・選択し、[OK]をクリックします。別名に任意の文字列を入力します。例: 「VeriSign Class 3 Public PCA」ファイル名に、ダウンロードした証明書ファイルへのパスを入力します。データ・タイプ 「Base64 エンコード ASCII データ」を選択します。
[保存]をクリックします。
WebSphere Application Server を再起動することで、設定が反映されます。