您可以使用属性文件来创建、修改或删除 Java™ 认证和授权服务 (JASS) 配置条目属性。
开始之前
确定您要对 JAAS 配置条目对象或其属性进行的更改。
启动 wsadmin 脚本编制工具。要使用 Jython 语言来启动 wsadmin,请从服务器概要文件的 bin 目录运行 wsadmin -lang Jython 命令。
关于此任务
您可以使用属性文件来创建、修改或删除 JAAS 配置条目对象。
使用 wsadmin 以运行管理命令来创建或更改 JAAS 配置条目的属性文件,验证属性,并将其应用于您的配置。
表 1. JAAS 配置条目属性文件的操作. 您可以创建、修改和删除 JAAS 属性。操作 |
过程 |
create |
设置所需属性,然后运行 applyConfigProperties 命令。 |
modify |
编辑所需属性,然后运行 applyConfigProperties 命令。 |
delete |
运行 deleteConfigProperties 命令以删除属性。如果删除的属性具有缺省值,那么该属性将设置为缺省值。要删除整个 JAASConfigurationEntry 对象,请取消注释 #DELETE=true,然后运行 deleteConfigProperties 命令。 |
create Property |
不适用 |
delete Property |
不适用 |
您可以选择性地以交互方式使用该命令:
AdminTask.command_name('-interactive')
过程
- 创建 JAASConfigurationEntry 属性文件。
- 根据需要,设置 JAASConfigurationEntry 属性。
您可以在 systemLoginConfiguration 或 applicationLoginConfiguration 下添加新的 JAAS 配置条目。
打开编辑器并创建 JAASConfigurationEntry 对象的属性文件。
以下示例使用 systemLoginConfiguration 来添加新的 JAAS 配置条目:
#
# Header
#
ResourceType=JAASConfigurationEntry
ImplementingResourceType=Security
ResourceId=Cell=!{cellName}:Security=:JAASConfiguration=systemLoginConfig#:JAASConfigurationEntry=
alias#myJAAS
#DELETE=true
#
#
#Properties
#
alias=myJAAS #required
#
# Header JAASLoginModule
#
ResourceType=JAASLoginModule
ImplementingResourceType=Security
ResourceId=Cell=!{cellName}:Security=:JAASConfiguration=systemLoginConfig#:JAASConfigurationEntry=
alias#myJAAS:JAASLoginModule=moduleClassName#com.acme.myLoginModule
AttributeInfo=loginModules
#DELETE=true
#
#
#Properties
#
callbackHandlerClassName=null
moduleClassName=com.acme.myLoginModule #required
authenticationStrategy=REQUIRED #ENUM(OPTIONAL|REQUISITE|REQUIRED|SUFFICIENT),de
fault(REQUIRED)
#
# Header JAASLoginModule options
#
ResourceType=JAASLoginModule
ImplementingResourceType=Security
ResourceId=Cell=!{cellName}:Security=:JAASConfiguration=systemLoginConfig#:JAASConfigurationEntry=
alias#myJAAS:JAASLoginModule=moduleClassName#com.acme.myLoginModule
AttributeInfo=options(name,value)
#
#
#Properties
#
myProp=myValue
#
# Header JAASLoginModule Another module
#
ResourceType=JAASLoginModule
ImplementingResourceType=Security
ResourceId=Cell=!{cellName}:Security=:JAASConfiguration=systemLoginConfig#:JAASConfigurationEntry=
alias#myJAAS:JAASLoginModule=moduleClassName#com.acme.myAnotherLoginModule
AttributeInfo=loginModules
#DELETE=true
#
#
#Properties
#
callbackHandlerClassName=null
moduleClassName=com.acme.myAnotherLoginModule #required
authenticationStrategy=REQUIRED #ENUM(OPTIONAL|REQUISITE|REQUIRED|SUFFICIENT),de
fault(REQUIRED)
#
# Header JAASLoginModule options
#
ResourceType=JAASLoginModule
ImplementingResourceType=Security
ResourceId=Cell=!{cellName}:Security=:JAASConfiguration=systemLoginConfig#:JAASConfigurationEntry=
alias#myJAAS:JAASLoginModule=moduleClassName#com.acme.myAnotherLoginModule
AttributeInfo=options(name,value)
#
#
#Properties
#
myProp=myValue
EnvironmentVariablesSection
#Environment Variables
cellName=myCell
- 运行 applyConfigProperties 命令来创建或更改 JAAS 配置条目。
运行 applyConfigProperties 命令会将属性文件应用于配置。在此 Jython 示例中,可选的 -reportFileName 参数生成名为 report.txt 的报告:
AdminTask.applyConfigProperties(['-propertiesFileName myObjectType.props -reportFileName report.txt '])
- 修改现有的属性文件。
- 获取您要更改的 JAASConfigurationEntry 的属性文件。
您可以使用 extractConfigProperties 命令来抽取 JAASConfigurationEntry 对象的属性文件。
- 在编辑器中打开属性文件,然后根据需要更改属性。
确保属性文件中的环境变量匹配您的系统。
- 运行 applyConfigProperties 命令。
- 如果您不再需要 JAAS 配置条目对象或现有属性,那么可以删除整个 JAAS 对象或一个或多个属性。
结果
您可以使用属性文件来配置和管理 JAAS 配置条目对象及其属性。