この記事では、ユーザーのリダイレクトURLを設定する際によく使用される4つのポータルプロパティについて説明します。
以下の4つの説明には、それぞれの特性、その説明、およびその例が記載されています。
-
ポータルのデフォルトの ホームURL を設定する
-
ログイン後にユーザーをリダイレクトする
-
ログアウト後にユーザーをリダイレクトする
-
デフォルトのユーザーログインページ
解決
1. ポータルのデフォルトの ホームURL の設定
プロパティ:
company.default.home.url=/web/guest
説明:
このプロパティは、ゲストユーザーがホスト名をヒットしたときのポータルのデフォルトのホームURLを設定します。 ゲストユーザーはプライベートページを閲覧する権限を持っていませんので、公開ページのURLを使用してください。
また、 コントロールパネル > 設定 > インスタンス設定 > ホームURL からも設定できます。インスタンス設定 で定義された値が優先されます。
以下に、いくつかのシナリオの例を示します。
まず、testというページを作ります。
シナリオ1
設定 company.default.home.url=/web/guest/home
ホームURLの設定=<blank>
http://localhost:8080 に移動するとhomeページが表示されます。
シナリオ2
設定 company.default.home.url=/web/guest/home
ホームURLの設定=/web/guest/test
http://localhost:8080 に移動するとtestページが表示されます。
シナリオ3
設定 company.default.home.url=/web/guest/test
ホームURLの設定=<blank>
http://localhost:8080 に移動するとtestページが表示されます。
シナリオ4
設定 company.default.home.url=/web/guest/test
ホームURLの設定=/web/guest/home
http://localhost:8080 に移動するとhomeページが表示されます。
2. ログイン後にユーザーをリダイレクトする
プロパティ(portal.propertiesからの説明付き):
## ## Default Landing Page ## # # Set the default landing page path for logged in users relative to the # server path. This is the page users are automatically redirected to after # logging in. For example, if you want the default landing page to be # http://localhost:8080/web/guest/login, set this to /web/guest/login. To # activate this feature, set auth.forward.by.last.path to true. To customize # the behavior, see com.liferay.portal.events.DefaultLandingPageAction in # the "login.events.post" property above. # # The following variables can be used: ${liferay:screenName} and # ${liferay:userId}. # default.landing.page.path= #default.landing.page.path=/web/guest/login #default.landing.page.path=/user/${liferay:screenName}/home
説明:
この設定は、 コントロールパネル > 設定 > インスタンス設定 > ログインページからも設定できます。
3. ログアウト後にユーザーをリダイレクトする
プロパティ(portal.propertiesからの説明付き):
## ## Default Logout Page ## # # Set the default logout page path for users relative to the server path. # This is the page users are automatically redirected to after logging out. # For example, if you want the default logout page to be # http://localhost:8080/web/guest/logout, set this to /web/guest/logout. To # activate this feature, set auth.forward.by.last.path to true. To customize # the behavior, see com.liferay.portal.events.DefaultLogoutPageAction in # the "logout.events.post" property above. # default.logout.page.path= #default.logout.page.path=/web/guest/logout
説明:
この設定は、 コントロールパネル > 設定 > インスタンス設定 > ログアウトページ からも設定できます。
インスタンス設定 の ログインページ と ログアウトページ に設定した値が PortalPreferences テーブルに格納されることに注意してください。プロパティで定義されている値を永久に上書きします。
4. デフォルトのユーザーログインページ
プロパティ(portal.propertiesからの説明付き):
# # Enter a URL that will be used to login portal users whenever needed. By # default, the portal's login page is used. # #auth.login.url=/web/guest/home
説明:
このページはログインポートレットを含む公開ページであるべきで、ユーザーはポータルにログインするためにこのページにリダイレクトされます。