此内容没有您所选择的语言版本。
15.2. JAAS Console Commands
Editing user data from the console 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Red Hat JBoss Fuse provides a set of
jaas:* console commands, which you can use to edit JAAS user data from the console.
Note
The
jaas:* console commands are not compatible with the LDAP JAAS module.
Standalone realm configuration 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
A standalone container (which uses the JAAS
PropertiesLoginModule and the PublickeyLoginModule) maintains its own database of secure user data, independently of any other containers. To configure the user data for a standalone container, you must log into the specific container (see Connecting and Disconnecting Remotely) whose data you want to modify. Each standalone container must be configured separately.
To start editing the standalone JAAS user data, you must first specify the JAAS realm that you want to modify. To see the available realms, enter the
jaas:realms command, as follows:
JBossFuse:karaf@root> jaas:realms
Index Realm Module Class
1 karaf org.apache.karaf.jaas.modules.properties.PropertiesLoginModule
2 karaf org.apache.karaf.jaas.modules.publickey.PublickeyLoginModule
Both of these login modules are active in the default
karaf JAAS realm. Enter the following console command to start editing the properties login module in the karaf realm:
JBossFuse:karaf@root> jaas:manage --index 1
Adding a new user to the JAAS realm 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
For example, consider how to add a new user,
jdoe, to the JAAS realm.
First of all, start to manage the relevant JAAS realm as follows:
- List the available realms and login modules by entering the following command:
JBossFuse:karaf@root> jaas:realms - Choose the login module to edit by specifying its index, Index, using a command of the following form:
JBossFuse:karaf@root> jaas:manage --index Index
Add the user,
jdoe, with password, secret, by entering the following console command:
JBossFuse:karaf@root> jaas:useradd jdoe secret
Add the
admin role to jdoe, by entering the following console command:
JBossFuse:karaf@root> jaas:roleadd jdoe admin
As a matter of fact, these changes are not applied right away. Initially, the changes are queued in a list of pending operations. To see this list, enter the
jaas:pending console command, as follows:
JBossFuse:karaf@root> jaas:pending
Jaas Realm:karaf Jaas Module:org.apache.karaf.jaas.modules.properties.PropertiesLoginModule
UserAddCommand{username='jdoe', password='secret'}
RoleAddCommand{username='jdoe', role='admin'}
Now you can apply the changes by invoking
jaas:update, as follows:
JBossFuse:karaf@root> jaas:update
The new user entry is then persisted (either by writing to the remote container's
etc/users.properties file, in the case of a standalone container, or by storing the user data in the Fabric Registry, in the case of a fabric).
Canceling pending changes 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
If you decide that you do not want to make the changes permanent after all, instead of invoking the
jaas:update command, you could abort the pending changes using the jaas:cancel command, as follows:
JBossFuse:karaf@root> jaas:cancel