legacy-knowledge-base
公開されました Jul. 2, 2025

p_auth認証トークンはどのように生成するのですか?

written-by

Tony Ng

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • Liferayはp_auth認証トークンを生成することで、CSRF攻撃から自身を保護します。 このトークンはどのように作成するのですか?

Environment

  • dxp 7.0、7.1、7.2、7.3

解決策

  • 「auth.token.check.enabled=true」をportal-ext.propertiesで設定すると、認証トークン(p_auth値)がURLパラメータとして生成されます。 これは、 <portlet:actionURL> または <liferay-portlet:actionURL>から生成されたURLのみを保護します。
  • auth.token.check.enabled=true "を呼び出すと、MVCポートレットでも動作します。
  • アクションURLが <aui:form action="X">に使用される場合、AUIタグはp_authパラメータを抽出し、HTTPリクエストボディを通してサーバにPOSTされる隠しフィールドとして追加します。
  • com.liferay.portal.kernel.security.auth.AuthTokenUtil#checkCSRFTokenへの間接的な呼び出しは、com.liferay.portlet.SecurityPortletContainerWrapper#checkActionから行われます。 これはポートレット・コンテナの実装の基本です。

did-this-article-resolve-your-issue

legacy-knowledge-base