特定の MBean に対して MBean セキュリティー・ポリシーを明示的に定義することができます。 この例を使用し、MBean セキュリティー・ポリシーを定義します。
以下のタスクを実行し、明示的なセキュリティー・ポリシーを定義します。
以下の例では、sampleSecurity.xml ファイルの MBean セキュリティー記述子 ファイル・フォーマットを説明します。
2 行目は、MBean セキュリティー記述子スキーマが、 WebSphere Application Server の文書タイプ定義 (DTD) である RolePermissionDescriptor.dtd ファイル によって定義されていることを明示します。
3 行目に示されるように、 各 MBean 記述子ファイルには単一役割許可エレメントが含まれます。 管理セキュリティー役割階層は、 9 行目から 37 行目のセキュリティー役割エレメントで定義されています。管理セキュリティー役割には 継承関係があります。
14 行目から 21 行目で定義されているように、 オペレーター・セキュリティー役割はモニター・セキュリティー役割を暗黙指定します。 つまり、オペレーター役割を持つユーザーは、モニター役割の許可をすべて持ちます。 30 行目から 38 行目に定義されているように、管理者セキュリティー役割は、コンフィギュレーターと オペレーター・セキュリティー役割の両方を暗黙指定します。すべての MBean セキュリティー記述子ファイルは通常、 同じ役割関係定義を持つため、このセクションを MBean セキュリティー記述子ファイルへカット・アンド・ペーストすることができます。
1 つ以上の メソッド・アクセス権エレメントが、セキュリティー役割エレメントの後で定義されます。 各メソッド・アクセス権エレメントは、1 つ以上のメソッドに対して必要な役割を定義します。 メソッド・パラメーターを指定して、複数のメソッドが同じ名前を持つ場合に メソッド名の衝突を回避します。
1. <?xml version="1.0" encoding="UTF-8"?> 2. <!DOCTYPE role-permission SYSTEM "RolePermissionDescriptor.dtd" > 3. <role-permission> 4. <resource> 5. <resource-name>sample</resource-name> 6. <class-name>com.ibm.ws.security.descriptor.sample</class-name> 7. <description>This is a sample for testing role permission descriptor.</description> 8. </resource> 9. <security-role> 10. <role> 11. <role-name>monitor</role-name> 12. </role> 13. </security-role> 14. <security-role> 15. <role> 16. <role-name>operator</role-name> 17. <imply> 18. <role-name>monitor</role-name> 19. </imply> 20. </role> 21. </security-role> 22. <security-role> 23. <role> 24. <role-name>configurator</role-name> 25. <imply> 26. <role-name>monitor</role-name> 27. </imply> 28. /role> 29. </security-role> 30. <security-role> 31. <role> 32. <role-name>administrator</role-name> 33. <imply> 34. <role-name>operator</role-name> 35. <role-name>configurator</role-name> 36. </imply> 37. </role> 38. </security-role> 39. <method-permission> 40. <description>Sample method permission table</description> 41. <role-name>operator</role-name> 42. <method> 43. <description>Sample operation</description> 44. <resource-name>sample</resource-name> 45. <method-name>stop</method-name> 46. </method> 47. </method-permission> 48. <method-permission> 49. <description>Sample method permission table</description> 50. <role-name>operator</role-name> 51. <method> 52. <description>Sample operation</description> 53. <resource-name>sample</resource-name> 54. <method-name>start</method-name> 55. <method-params> 56. <method-param>java.lang.String</method-param> 57. <method-param>java.lang.String</method-param> 58. </method-params> 59. </method> 60. </method-permission> 61. <method-permission> 62. <description>Sample method permission table</description> 63. <role-name>operator</role-name> 64. <method> 65. <description>Sample operation</description> 66. <resource-name>sample</resource-name> 67. <method-name>monitor</method-name> 68. <method-params> 69. </method-params> 70. </method> 71. </method-permission> 72. <method-permission> 73. <description>Sample method permission table</description> 74. <role-name>configurator</role-name> 75. <method> 76. <description>Sample operation</description> 77. <resource-name>sample</resource-name> 78. <method-name>setValue</method-name> 79. <method-params> 80. <method-param>java.lang.Boolean</method-param> 81. </method-params> 82. </method> 83. </method-permission> 84. <method-permission> 85. <description>Sample method permission table</description> 86. <role-name>monitor</role-name> 87. <method> 88. <description>Sample operation</description> 89. <resource-name>sample</resource-name> 90. <method-name>getValue</method-name> 91. </method> 92. </method-permission> 93. </role-permission>