Oracle® Fusion MiddlewareOracle Adaptive Access Manager開発者ガイド 11gリリース2 (11.1.2.3.0) E67356-01 |
|
前 |
次 |
OAAMでは、Struts/Tilesフレームワークを使用してアプリケーションに共通のルック・アンド・フィールを作成します。
この章は次の項で構成されています:
WEB-INF
ディレクトリにあるStruts構成ファイルstruts-config.xml
では、すべてのナビゲーション・ルールがアクション定義の形式で定義されています。WEB-INF
ディレクトリにあるTilesレイアウト・ファイルtiles-def.xml
には、様々なページの定義が含まれています。
OAAMユーザー・インタフェース・フローとJava Server Pages (JSP)のレイアウトをカスタマイズするには、OAAMサーバーJSPとStrutsアクション・ターゲットをOAAM拡張共有ライブラリ(oracle.oaam.extensions.war
)を使用してオーバーライドする必要があります。拡張共有ライブラリには、カスタマイズに使用する次の2つのファイルが含まれています。
WEB-INF/struts-config-extension.xml
WEB-INF/tiles-def-extension.xml
注意: カスタマイズは、OAAM拡張共有ライブラリのみで行ってください。struts-config.xml ファイルとtiles-def.xml ファイルは変更しないでください。Strutsテンプレートの変更はお薦めしません。変更する場合は、テンプレートとoaamLoginPage.jsp ファイルの両方を変更する必要があります。 |
この項では、ユーザー・フローの駆動に使用するStrutsアクション定義について説明します。OAAMアクション・タイプ・クラスの概要も示しています。
アクション定義には通常、パス、タイプおよびパラメータの属性が含まれています。パスでは、URLが定義されます。多くの定義には、次に表示するページを示すフォワード要素が1つ以上含まれています。ログイン・ページの例を示します。
<action path="/login" type="com.bharosa.uio.actions.LoginAction"> <forward name="success" path="/updateLoginStatus.do" redirect="true"/> <forward name="loginJump" path="/loginJumpPage.jsp" redirect="true"/> <forward name="password" path="password"/> <forward name="challenge" path="/challengeUser.do" redirect="true"/> </action>
ログイン・ページの例では、URLはhttp://server name
/oaam_server/login.do
です。login.do
は、/login
のパス定義から取得されます。タイプ・パラメータは、アクションを実行するクラスを定義します。サンプル・ユーザー・ページでは、次のクラスが指定されています。
表10-1 アクション・タイプ・クラス
クラス名 | 説明 |
---|---|
com.bharosa.uio.actions.LoginAction |
ログイン・ステータスを更新し、必要に応じてユーザーにチャレンジします。 |
com.bharosa.uio.actions.LoginFailAction |
OAAMサーバー・ページにエラー・メッセージを表示します。たとえば、ログイン・ブロック済メッセージが表示されることがあります。 |
com.bharosa.uio.actions.ActivityAction |
OAAMサーバー・ページに確認メッセージを表示します。 |
com.bharosa.uio.actions.PasswordAction |
パスワード・ステータスを更新します。 |
com.bharosa.uio.actions.UpdateAuthStatusAction |
ユーザー認証ステータスを更新し、必要に応じてパターン・データ処理をトリガーします。 |
com.bharosa.uio.actions.ValidateTrxAction |
トランザクションを検証します。 |
com.bharosa.uio.actions.FlashFingerprintAction |
デバイスをフィンガープリント処理します。 |
com.bharosa.uio.actions.LogoutAction |
ユーザー・セッションをログアウトして、ログイン・ページにリダイレクトします。 |
com.bharosa.uio.actions.SignOnAction |
ユーザーをサイン・インします。 |
com.bharosa.uio.actions.RegisterQuestionsAction |
質問セットが表示されます。ユーザーはこの中から質問を選択し、質問ごとの正しい回答を登録できます。 |
com.bharosa.uio.actions.ChangePasswordAction |
パスワード変更リンクを表示します。 |
com.bharosa.uio.actions.ForgotPasswordAction |
パスワードを忘れた場合のリンクを表示します。 |
com.bharosa.uio.actions.UserInputAction |
入力フィールドを表示します。 |
com.bharosa.uio.actions.UserPreferencesDoneAction |
ユーザーのプリファレンス登録終了メッセージを表示します。 |
com.bharosa.uio.actions.ChallengeUserAction |
ユーザーがすでに登録した質問の1つとあわせて質問パッドを表示することにより、ユーザーにチャレンジします。 |
com.bharosa.uio.actions.ChangeUserNameAction |
ユーザー名を変更します。 |
com.bharosa.uio.actions.MessageAction |
ユーザーにメッセージを表示します。 |
com.bharosa.uio.actions.ExitAction |
ユーザーをリソースから終了させます。 |
com.bharosa.uio.actions.ErrorAction |
エラーが発生します。 |
ユーザー・インタフェース・ページは、StrutsアプリケーションでTilesを使用して作成されます。外部構成ファイル(/WEB-INF/tiles-def.xml)には、様々なページの定義が含まれています。
ベース・レイアウトbharosa.uio.baseLayout
は、様々な項を含めるように定義されています。ヘッダー部分はcustomHeader.jsp
ページで、フッター部分はcustomFooter.jsp
ページで、ボディ部分はコンテンツでそれぞれ占められています。次のコードは、ベース・レイアウトを示しています。
<definition name="bharosa.uio.baseLayout" path="/bharosaUIOBaseLayout.jsp"> <put name="header" value="/customHeader.jsp"/> <put name="footer" value="/customFooter.jsp"/> <put name="body" value="${body}"/> </definition>
ユーザー・インタフェース・ページを作成するには、tiles-def-extension.xml
構成ファイル内でベース・レイアウトに使用するJSPページを定義します。次の例では、baseLayout
定義を拡張し、registerQuestionsHTML.jsp
というJSPを使用してコンテンツ・タイルをレンダリングしています。
<definition name="registerQuestionsHTML" extends="bharosa.uio.baseLayout"> <put name="body" value="/registerQuestionsHTML.jsp"/ </definition>
Tile定義は、別のTile定義を拡張できます。tiles-def.xml
ファイルでは、ユーザー・フローの中でボディ部分のみが変更していることが確認できます。
StrutsアプリケーションでTilesを使用するために、次の拡張定義をstruts-config.xml
ファイルに追加しました。
<!-- tiles plug-in --> <plug-in className="org.apache.struts.tiles.TilesPlugin"> <set-property property="definitions-config" value="/WEB-INF/tiles-def.xml,/WEB-INF/tiles-def-extension.xml"/> <set-property property="definitions-debug" value="0"/> <set-property property="definitions-parser-details" value="0"/> <set-property property="definitions-parser-validate" value="true"/> <set-property property="moduleAware" value="true"/> </plug-in>
アクション・フォワード・エントリがstruts-config.xml
ファイルにあります。アクションがTile定義baseLayout
に転送されると、Tile定義にベース・レイアウトJSPページが、対応するJSPページとともに表示されます。たとえば、次のようになります。
<action path="/updateForgotPasswordStatus" type="com.bharosa.uio.actions.UpdateAuthStatusAction" parameter="ForgotPassword"> <forward name="success" path="/resetPassword.do" redirect="true" /> <forward name="challenge" path="/challengeUserForgotPassword.do" redirect="true"/> <forward name="registerUser" path="/registerQuestions.do" redirect="true"/> <forward name="registerQuestions" path="/registerQuestions.do" redirect="true"/> <forward name="registerQuestionsHTML" path="/registerQuestions.do" redirect="true"/> <forward name="registerUserInfo" path="/registerUserInfo.do" redirect="true"/> <forward name="signon" path="signon" redirect="true"/> </action>
パス属性では、転送するTile定義の値を保持しています。パスの値が/registerQuestions.do
の場合、ベース・レイアウトJSPページでは、tiles-def.xml
で指定したようにregisterQuestionsHTML.jsp
がボディとして表示されます。
<definition name="registerQuestionsHTML" extends="bharosa.uio.baseLayout"> <put name="body" value="/registerQuestionsHTML.jsp"/ </definition>
ユーザー・フローとグラフィカル・ユーザー・インタフェースのルック・アンド・フィールのカスタマイズ方法の例を、後続の項に示します。
グラフィカル・ユーザー・インタフェース(GUI)のルック・アンド・フィールをカスタマイズするには、カスタムJSPファイルをOAAM拡張共有ライブラリに追加し、定義をtiles-def-extension.xml
ファイルに追加します。
次の例に、tiles-defs.xml
で定義したようにパスワード・ページの定義を示します。
<definition name="password" extends="bharosa.uio.baseLayout"> <put name="body" value="/password.jsp"/> </definition>
実行時のパスワード・ページには、ユーザーが必須資格証明を入力する際に必要となるすべてのGUI要素が動的に表示されます。
次の定義がtiles-def-extension
ファイルに追加されている場合は、OAAMサーバーがpassword
ページの表示を試みるすべての場所で、新規のcustomPassword.jsp
が使用されます。次の例では、tiles-def-extension.xml
に追加できるカスタム・パスワード・ページの定義を示しています。
<definition name="password" extends="bharosa.uio.baseLayout">
<put name="body" value="/customPassword.jsp"/>
</definition>
ユーザー・フローとアクションをカスタマイズするには、struts
アクション・クラスとstruts-config-extension.xml
ファイルでのマッピングをオーバーライドします。
次の例に、struts-config.xml
に定義したように、login
アクションの定義を示します。
<action path="/login" type="com.bharosa.uio.actions.LoginAction"> <forward name="success" path="/updateLoginStatus.do" redirect="true"/> <forward name="loginJump" path="/loginJumpPage.jsp" redirect="true"/> <forward name="password" path="password"/> <forward name="challenge" path="/challengeUser.do" redirect="true"/> </action>
次の例では、struts-config-extension.xml
を使用したログイン・アクションのオーバーライドに使用できる値を示しています。
<action path="/login" type="com.bharosa.uio.actions.CustomLoginAction"> <forward name="success" path="/updateLoginStatus.do" redirect="true"/> <forward name="loginJump" path="/customLoginJumpPage.jsp" redirect="true"/> <forward name="password" path="password"/> <forward name="challenge" path="/customChallengeUser.do" redirect="true"/> </action>
この項では、tiles-def.xmlファイル
を示しています。
<tiles-definitions> <!-- ========================================================== --> <!-- Master definition - Start --> <!-- ========================================================== --> <!-- Main page layout used as a root for other page definitions --> <definition name="bharosa.uio.baseLayout" path="/bharosaUIOBaseLayout.jsp"> <put name="header" value="/customHeader.jsp"/> <put name="footer" value="/customFooter.jsp"/> <put name="body" value="${body}"/> </definition> <definition name="bharosa.uio.messageLayout" path= "/bharosaUIOMessageLayout.jsp"> <put name="body" value="${body}"/> </definition> <!-- login success --> <definition name="loginSuccess" extends="bharosa.uio.baseLayout"> <put name="body" value="/loginSuccess.jsp"/> </definition> <!-- login fail --> <definition name="loginFail" extends="bharosa.uio.baseLayout"> <put name="body" value="/loginFail.jsp"/> </definition> <!-- password entry --> <definition name="password" extends="bharosa.uio.baseLayout"> <put name="body" value="/password.jsp"/> </definition> <!-- register questions --> <definition name="registerInfo" extends="bharosa.uio.baseLayout"> <put name="body" value="/registerInfo.jsp"/> </definition> <definition name="registerAuthenticator" extends="bharosa.uio.baseLayout"> <put name="body" value="/registerAuthenticator.jsp"/> </definition> <definition name="registerQuestions" extends="bharosa.uio.baseLayout"> <put name="body" value="/registerQuestions.jsp"/> </definition> <definition name="registerQuestionsHTML" extends="bharosa.uio.baseLayout"> <put name="body" value="/registerQuestionsHTML.jsp"/> </definition> <definition name="registerUserInfo" extends="bharosa.uio.baseLayout"> <put name="body" value="/registerUserInfo.jsp"/> </definition> <definition name="userPreferences" extends="bharosa.uio.baseLayout"> <put name="body" value="/userPreferences.jsp"/> </definition> <definition name="registrationRequired" extends="bharosa.uio.baseLayout"> <put name="body" value="/registrationRequired.jsp"/> </definition> <definition name="changePassword" extends="bharosa.uio.baseLayout"> <put name="body" value="/changePassword.jsp"/> </definition> <definition name="forgotPassword" extends="bharosa.uio.baseLayout"> <put name="body" value="/forgotPassword.jsp"/> </definition> <definition name="userInput" extends="bharosa.uio.baseLayout"> <put name="body" value="/userInput.jsp"/> </definition> <!-- challenge User --> <definition name="challengeUser" extends="bharosa.uio.baseLayout"> <put name="body" value="/challengeUser.jsp"/> </definition> <definition name="challengeUserForgotPassword" extends="bharosa.uio.baseLayout"> <put name="body" value="/challengeUser.jsp"/> </definition> <definition name="challengeWait" extends="bharosa.uio.baseLayout"> <put name="body" value="/challengeWait.jsp"/> </definition> <!-- qaExists --> <definition name="qaExists" extends="bharosa.uio.baseLayout"> <put name="body" value="/qaExists.jsp"/> </definition> <!-- register qa done --> <definition name="questRegistered" extends="bharosa.uio.baseLayout"> <put name="body" value="/registerQAdone.jsp"/> </definition> <!-- signon --> <definition name="signon" extends="bharosa.uio.baseLayout"> <put name="body" value="/securityProfile.jsp"/> </definition> <!-- messages --> <definition name="message" extends="bharosa.uio.messageLayout"> <put name="body" value="/message.jsp"/> </definition> </tiles-definitions>
この項では、struts-config.xml
ファイルを示しています。
<struts-config> <!-- ========== Global Forward Definitions ============================== --> <global-forwards> <forward name="session_expired" path="/error.do?action=session_expired" redirect="true"/> <forward name="emptyLoginId" path="/error.do?action=empty" redirect="true"/> <forward name="fail" path="/error.do?action=fail" redirect="true"/> <forward name="invalid_user" path="/error.do?action=invalid_user" redirect="true"/> <forward name="error" path="/error.do?action=error" redirect="true"/> <forward name="block" path="/error.do?action=block" redirect="true"/> <forward name="challenge_block" path="/error.do?action=block" redirect="true"/> <forward name="cookieDisabled" path="/error.do?action=cookieDisabled" redirect="true"/> <forward name="accessDenied" path="/error.do?action=accessDenied" redirect="true"/> <forward name="invalid_request" path="/error.do?action=accessDenied" redirect="true"/> <forward name="user_disabled" path="/error.do?action=disabled" redirect="true"/> <forward name="wrong_answer" path="/error.do?action=wrong_answer" redirect="true"/> <forward name="login" path="/error.do" redirect="true"/> </global-forwards> <!-- ========== Action Mapping Definitions ============================== --> <action-mappings> <!-- action mappings for login --> <action path="/login" type="com.bharosa.uio.actions.LoginAction"> <forward name="success" path="/updateLoginStatus.do" redirect="true"/> <forward name="loginJump" path="/loginJumpPage.jsp" redirect="true"/> <forward name="password" path="password"/> <forward name="passwordFT" path="password"/> <forward name="challenge" path="/challengeUser.do" redirect="true"/> </action> <action path="/loginFail" type="com.bharosa.uio.actions.LoginFailAction"> <forward name="success" path="loginFail"/> </action> <action path="/activity" type="com.bharosa.uio.actions.ActivityAction"> <forward name="success" path="loginSuccess" redirect="true"/> </action> <!-- validate password --> <action path="/password" type="com.bharosa.uio.actions.PasswordAction"> <forward name="success" path="/exit.do"/> <forward name="invalid_user" path="/updateLoginStatus.do" /> <forward name="noproxy" path="/updateLoginStatus.do"/> <forward name="resetPassword" path="/expiredPassword.do" redirect="true" /> </action> <action path="/updateLoginStatus" type="com.bharosa.uio.actions.UpdateAuthStatusAction"> <forward name="success" path="/exit.do"/> <forward name="challenge" path="/challengeUser.do" redirect="true"/> <forward name="registerUser" path="/registerQuestions.do" redirect="true"/> <forward name="registerAuthenticator" path="/registerImage.do" redirect="true"/> <forward name="registerQuestions" path="/registerQuestions.do" redirect="true"/> <forward name="registerQuestionsHTML" path="/registerQuestions.do" redirect="true"/> <forward name="registerUserInfo" path="/registerUserInfo.do" redirect="true"/> <forward name="signon" path="signon" redirect="true"/> </action> <action path="/updateForgotPasswordStatus" type="com.bharosa.uio.actions.UpdateAuthStatusAction" parameter="ForgotPassword"> <forward name="success" path="/resetPassword.do" redirect="true" /> <forward name="challenge" path="/challengeUserForgotPassword.do" redirect="true"/> <forward name="registerUser" path="/registerQuestions.do" redirect="true"/> <forward name="registerQuestions" path="/registerQuestions.do" redirect="true"/> <forward name="registerQuestionsHTML" path="/registerQuestions.do" redirect="true"/> <forward name="registerUserInfo" path="/registerUserInfo.do" redirect="true"/> <forward name="signon" path="signon" redirect="true"/> </action> <action path="/validateTrx" type="com.bharosa.uio.actions.ValidateTrxAction"> <forward name="success" path="/exit.do"/> <forward name="challenge" path="/challengeUserTrx.do" redirect="true"/> </action> <action path="/flashFingerprint" type="com.bharosa.uio.actions.FlashFingerprintAction"> <forward name="success" path="/flashFingerprint.jsp"/> </action> <!-- action mappings for logout --> <action path="/logout" type="com.bharosa.uio.actions.LogoutAction"> <forward name="success" path="/loginPage.jsp" /> </action> <!-- action mappings for signon --> <action path="/signon" type="com.bharosa.uio.actions.SignOnAction"> <forward name="securityProfile" path="/securityProfile.jsp" redirect="true"/> <forward name="securityDone" path="/activity.do" redirect="true"/> </action> <!-- action mappings for security QA --> <action path="/registerQuestions" type="com.bharosa.uio.actions.RegisterQuestionsAction"> <forward name="qaExists" path="qaExists" redirect="true"/> <forward name="registerAuthenticator" path="registerAuthenticator"/> <forward name="registerQuestions" path="registerQuestions"/> <forward name="registerQuestionsHTML" path="registerQuestionsHTML"/> <forward name="registerInfo" path="registerInfo"/> <forward name="registerUserInfo" path="registerUserInfo"/> <forward name="skip" path="/exit.do"/> <forward name="success" path="/exit.do"/> </action> <action path="/registerImage" type="com.bharosa.uio.actions.RegisterQuestionsAction" parameter="RegisterImage"> <forward name="registerAuthenticator" path="registerAuthenticator"/> <forward name="success" path="/exit.do"/> </action> <action path="/registerUserInfo" type="com.bharosa.uio.actions.RegisterQuestionsAction" parameter="RegisterUserInfo"> <forward name="registerUserInfo" path="registerUserInfo"/> <forward name="success" path="/exit.do"/> </action> <action path="/userPreferences" type="com.bharosa.uio.actions.RegisterQuestionsAction" parameter="UserPreferences"> <forward name="registerAuthenticator" path="userPreferences"/> <forward name="registerInfo" path="userPreferences"/> <forward name="registerQuestions" path="registerQuestions"/> <forward name="registerQuestionsHTML" path="registerQuestionsHTML"/> <forward name="registerUserInfo" path="registerUserInfo" /> <forward name="changePassword" path="/changePassword.do" /> <forward name="success" path="userPreferences"/> <forward name="registrationRequired" path="registrationRequired"/> <forward name="exit" path="/exit.do" /> </action> <action path="/changePassword" type="com.bharosa.uio.actions.ChangePasswordAction"> <forward name="changePassword" path="changePassword" /> <forward name="success" path="/userPreferences.do" redirect="true" /> <forward name="exit" path="/exit.do" /> </action> <action path="/resetPassword" type="com.bharosa.uio.actions.ChangePasswordAction" parameter="ResetPassword"> <forward name="changePassword" path="changePassword" /> <forward name="success" path="/exit.do" /> <forward name="updateStatus" path="/updateLoginStatus.do" redirect="true" /> </action> <action path="/expiredPassword" type="com.bharosa.uio.actions.ChangePasswordAction" parameter="ExpiredPassword"> <forward name="changePassword" path="changePassword" /> <forward name="success" path="/exit.do" /> <forward name="updateStatus" path="/updateLoginStatus.do" redirect="true" /> </action> <action path="/forgotPassword" type="com.bharosa.uio.actions.ForgotPasswordAction"> <forward name="forgotPassword" path="forgotPassword" /> <forward name="challenge" path="/challengeUserForgotPassword.do" /> <forward name="success" path="/exit.do" /> <forward name="noproxy" path="/updateForgotPasswordStatus.do" /> </action> <action path="/getUserInput" type="com.bharosa.uio.actions.UserInputAction"> <forward name="showAuthenticator" path="userInput" /> <forward name="success" path="/exit.do" /> </action> <action path="/userPreferencesDone" type="com.bharosa.uio.actions.UserPreferencesDoneAction"> <forward name="success" path="/exit.do"/> <forward name="exit" path="/exit.do" /> </action> <!-- action mappings for challenge user --> <action path="/challengeUser" type="com.bharosa.uio.actions.ChallengeUserAction"> <forward name="success" path="/exit.do" /> <forward name="challenge" path="challengeUser"/> <forward name="registerUser" path="/registerQuestions.do" redirect="true"/> <forward name="registerAuthenticator" path="/registerImage.do" redirect="true"/> <forward name="registerQuestions" path="/registerQuestions.do" redirect="true"/> <forward name="registerQuestionsHTML" path="/registerQuestions.do" redirect="true"/> <forward name="registerUserInfo" path="/registerUserInfo.do" redirect="true"/> <forward name="wait" path="challengeWait"/> </action> <action path="/challengeUserTrx" type="com.bharosa.uio.actions.ChallengeUserAction" parameter="transaction"> <forward name="success" path="/exit.do" /> <forward name="challenge" path="challengeUser"/> <forward name="registerUser" path="/registerQuestions.do" redirect="true"/> <forward name="registerAuthenticator" path="/registerImage.do" redirect="true"/> <forward name="registerQuestions" path="/registerQuestions.do" redirect="true"/> <forward name="registerQuestionsHTML" path="/registerQuestions.do" redirect="true"/> <forward name="registerUserInfo" path="/registerUserInfo.do" redirect="true"/> <forward name="wait" path="challengeWait"/> </action> <action path="/challengeUserForgotPassword" type="com.bharosa.uio.actions.ChallengeUserAction" parameter="ForgotPassword"> <forward name="success" path="/resetPassword.do" redirect="true"/> <forward name="forgotPassword" path="forgotPassword" /> <forward name="challenge" path="challengeUserForgotPassword"/> <forward name="wait" path="challengeWait"/> </action> <action path="/changeUserId" type="com.bharosa.uio.actions.ChangeUserNameAction"> <forward name="success" path="/exit.do" /> </action> <!-- action mappings for message --> <action path="/message" type="com.bharosa.uio.actions.MessageAction"> <forward name="success" path="message"/> </action> <action path="/exit" type="com.bharosa.uio.actions.ExitAction"> <forward name="success" path="/empty.jsp"/> </action> <action path="/error" type="com.bharosa.uio.actions.ErrorAction"> <forward name="login" path="/loginPage.jsp" redirect="true" /> </action> </action-mappings> <!--The Tiles Request Processor for processing all the Tile requests--> <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/> <!-- message resources --> <message-resources parameter="proxyweb" null="false"/> <!-- tiles plug-in --> <plug-in className="org.apache.struts.tiles.TilesPlugin"> <set-property property="definitions-config" value= "/WEB-INF/tiles-def.xml,/WEB-INF/tiles-def-extension.xml"/> <set-property property="definitions-debug" value="0"/> <set-property property="definitions-parser-details" value="0"/> <set-property property="definitions-parser-validate" value="true"/> <set-property property="moduleAware" value="true"/> </plug-in> </struts-config>