Assigning users and groups to roles
We can assign users and groups to roles if you are using WebSphere Application Server authorization for Java EE roles.
(zos) Avoid trouble: If we are using System Authorization Facility (SAF) authorization for Java2 EE (J2EE) roles, refer to System Authorization Facility for role-based authorization for more information.gotcha
Before you perform this task:
- Secure the web applications and EJB applications where new roles are created and assigned to web and enterprise bean resources.
- Create all the roles in the application.
- Verify that we have properly configured the user registry containing the users to assign. It is preferable to have security turned on with the user registry of the choice before beginning this process.
- Make sure that if you change anything in the security configuration you save the configuration and restart the server before the changes become effective. For example, enable security or change the user registry.
These steps are common for both installing an application and modifying an existing application. If the application contains roles, you see the Security role to user/group mapping link during application installation and also during application management, as a link in the Additional properties section.
- Access the console.
(dist)(zos) Type http://localhost:port_number/ibm/console in a web browser.
(iseries) Type http://server_name:port_number/ibm/console in a web browser.
- Click Applications > Application Types > WebSphere enterprise applications > application_name .
- Under Detail properties, click Security role to user/group mapping. A list of all the roles that belong to this application is displayed. If the roles already have users, or if one of the special subjects, AllAuthenticatedUsers, AllAuthenticatedInTrustedRealms, or Everyone is assigned, they display here.
- To assign the special subjects, select either the Everyone or the All Authenticated in Application's Realm option for the appropriate roles.
- To assign users or groups, select the role. We can select multiple roles at the same time, if the same users or groups are assigned to all the roles.
- Click Look up users or Look up groups.
- We can search for appropriate users and groups from the user registry or we can add a user/group role mapping and not perform the search. You activate either of these options by clicking Search.
See the next steps for the appropriate option you require.
- Get the appropriate users and groups from the user registry Complete the Limit and the Search string fields by clicking Search. The Limit field limits the number of users that are obtained and displayed from the user registry. The pattern is a searchable pattern matching one or more users and groups. For example, user* lists users like user1, user2. A pattern of asterisk (*) indicates all users or groups.
Use the limit and the search strings cautiously so as not to overwhelm the user registry. When you use large user registries such as LDAP where information on thousands of users and groups resides, a search for a large number of users or groups can make the system slow and can make it fail. When more entries exist than requests for entries, a message is displayed. We can refine the search until we have the required list.
If the search string you are using has no matches, a NULL error message is displayed. This message is informational and does not necessarily indicate an error, as it is valid to have no entries matching your selected criteria.
- Add a user/group role mapping
Add a user/group role mapping by clicking Search. Add IdP realms to the list of inbound trusted realms. For each Identity provider used with the WAS service provider, you must grant inbound trust to all the realms used by the identity provider.
- Click Trusted authentication realms - inbound.
- Click Add External Realm.
- Fill in the external realm name.
- Click OK and Save changes to the master configuration. Skip remaining steps.
- Select the users and groups to include as members of these roles from the Available field and click >> to add them to the roles.
- To remove existing users and groups, select them from the Selected field and click <<. When removing existing users and groups from roles, use caution if those same roles are used as RunAs roles.
For example, if the user1 user is assigned to the role1 RunAs role and you try to remove the user1 user from the role1 role, the console validation does not delete the user. A user can only be part of a RunAs role if the user is already in a role either directly or indirectly through a group. In this case, the user1 user is in the role1 role. For more information on the validation checks that are performed between RunAs role mapping and user and group mapping to roles, see Assigning users to RunAs roles.
- Click OK. If any validation problems exist between the role assignments and the RunAs role assignments, the changes are not committed and an error message that indicates the problem is displayed. If a problem exists, verify the user in the RunAs role is also a member of the regular role. If the regular role contains a group containing the user in the RunAs role, verify the group is assigned to the role using the console. Follow steps 4 and 5. Avoid using any process where the complete name of the group, host name, group name, or distinguished name (DN) is not used.
Results
The user and group information is added to the binding file in the application. This information is used later for authorization purposes.If we change the realm you must repeat this process with the new realm name.
What to do next
This task is required to assign users and groups to roles, which enables the correct users and groups to access a secured application. If we are installing an application, complete the installation. After the application is installed and running we can access your resources according to the user and group mapping that you did in this task. If we manage applications and modify the users and groups to role mapping, make sure you save, stop, and restart the application so that the changes become effective. Try accessing the Java EE resources in the application to verify that the changes are effective.Depending upon how the active user registry is configured, the search results of security user or group role mappings are displayed in different formats. With federated repository, LDAP, file-based and custom registries can be used. WAS can uniquely identify users from various registries by the user names listed in the table.
Attention: In a distributed environment, when you install WebSphere Application Server with samples, enable security using federated repositories, and start the server1 server with sample applications, the server might create exceptions. However, the server starts successfully. The deployment manager did not create user and group samples when it created the dmgr profile. To resolve exceptions caused by the samples failing to load, create our own sample users and groups. In the console, do the following:
For more assistance, refer to the "Managing users" help topic by clicking More information about this page on the Manage Users panel.
- Click Users and Groups > Manage Users.
- Create the samples user and the sampadmn group. The samples user is a member of the sampadmn group.
Subtopics
- Add users and groups to roles using an assembly tool
After creating new roles and assigning them to enterprise bean and web resources, use this task to add users and groups to roles with an assembly tool.
- Security role to user or group mapping
Use this page to specify the users and groups mapped to the security roles used with the enterprise application.
- Look up users
Use this page to select and to map users, groups and special subjects for security roles.
- Assigning users to RunAs roles
We can learn how to assign users to the RunAs roles for the application.
Related tasks
Secure applications during assembly and deployment Enable security