非対話型クライアント ログインの構成

Version: 10.4
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

Sitecoreインスタンスでクライアント資格情報フローを使用して非対話型クライアント ログインを有効にするには、Identity ServerインスタンスとContent Managementインスタンスに追加の設定を追加する必要があります。

非対話型クライアント・ログインを構成するには、次のようにします。

  1. Sitecore Identity ServerのConfig/ フォルダーに、以下を含むSitecore.IdentityServer.DevEx.xmlという名前のファイルを作成します。

    RequestResponse
    <?xml version="1.0" encoding="utf-8"?>
    <Settings>
      <Sitecore>
        <IdentityServer>
          <Clients>
            <!-- used to authenticate servers with client id and client secret -->
            <CliServerClient>
                <ClientId>SitecoreCLIServer</ClientId>
                <ClientName>SitecoreCLIServer</ClientName>
                <AccessTokenType>0</AccessTokenType>
                <AccessTokenLifetimeInSeconds>3600</AccessTokenLifetimeInSeconds>
                <IdentityTokenLifetimeInSeconds>3600</IdentityTokenLifetimeInSeconds>
                <RequireClientSecret>true</RequireClientSecret>
                <AllowOfflineAccess>false</AllowOfflineAccess>
                <AllowedGrantTypes>
                    <!--
                        client_credentials authenticates with client ID and client secret
                        which is good for CI, tools, etc. However, it's not tied to a USER,
                        it's tied to a client ID.
                    -->
                    <AllowedGrantType1>client_credentials</AllowedGrantType1>
                </AllowedGrantTypes>
                <ClientSecrets>
                    <!--<ClientSecret1>SUPERLONGSECRETHERE</ClientSecret1>-->
                </ClientSecrets>
                <AllowedScopes>
                    <!-- this is required even if not a 'user' for Sitecore to like us -->
                    <AllowedScope1>sitecore.profile.api</AllowedScope1>
                </AllowedScopes>
            </CliServerClient>
          </Clients>
        </IdentityServer>
      </Sitecore>
    </Settings>
    
  2. <CliServerClient>要素には、任意の名前を付けます。

    メモ

    <Clients>要素の下では、一意の名前が付けられている限り、無制限のクライアント構成を行うことができます。

  3. <ClientId>要素に、クライアントの一意のIDを入力します。

  4. <ClientSecrets> 要素で、クライアントのシークレットを含む <ClientSecret1> 要素を作成します。

    手記

    クライアントシークレットでサポートされる最大長は100文字です。

  5. Sitecore.IdenityServer.DevEx.xmlファイルを保存します。

  6. Sitecore Content ManagementサーバーのApp_Config/Include/ フォルダーに、次の内容を含む " Sitecore.Owin.Authentication.ClientCredentialsMapping.config " という名前のファイルを作成します。

    RequestResponse
    <?xml version="1.0" encoding="utf-8"?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
      <sitecore role:require="ContentManagement">
        <federatedAuthentication>
          <identityProviders>
            <identityProvider id="SitecoreIdentityServer" type="Sitecore.Owin.Authentication.IdentityServer.IdentityServerProvider, Sitecore.Owin.Authentication.IdentityServer" resolve="true">
              <transformations hint="list:AddTransformation">
                <transformation name="admin-ify client credentials users" type="Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication">
                  <sources hint="raw:AddSource">
                    <claim name="client_id" value="SitecoreCLIServer" />
                  </sources>
                  <targets hint="raw:AddTarget">
                    <claim name="name" value="sitecore\superuser" />
                    <claim name="http://www.sitecore.net/identity/claims/isAdmin" value="true" />
                  </targets>
                  <keepSource>true</keepSource>
                </transformation>
              </transformations>
              
            </identityProvider>
          </identityProviders>
        </federatedAuthentication>
      </sitecore>
    </configuration>
  7. <claim name="client_id"> 要素のvalue属性に、クライアントの一意のIDを入力します。

  8. web.configファイルでSQLメンバーシップ プロバイダーを確認します。ソリューションのrequiresUniqueEmail属性がtrueに設定されている場合は、次の構成行をSitecore.Owin.Authentication.ClientCredentialsMapping.configファイルに追加します。

    RequestResponse
    <targets hint="raw:AddTarget">
        ...
        <claim name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" value="[email protected]" />
    </targets>
  9. Sitecore.Owin.Authentication.ClientCredentialsMapping.configファイルを保存します。

  10. Sitecore Identity ServerとContent Managementロールを再起動します。

  11. Sitecore Identity Serverアプリケーション プールをリサイクルします。

  12. CLIの認証および許可のドキュメントで説明されているクライアント ログイン手順を実行して、設定を検証します。

何かフィードバックはありますか?

この記事を改善するための提案がある場合は、