Filenet users and groups rely on LDAP and use Windows2003 in actual situations. Attackers can obtain account and group information in the project and access LDAP by encoding, or use the filenet interface to access the information. You can directly use the filenet interface without special requirements.
The com. filenet. API. Security Package provides interfaces for authentication, authorization, and users and groups. Including realm, user, and group. Realm can be used to query user and group. The code for getting user information is as follows.
Realm realm = Factory.Realm.fetchCurrent(this.osp().getObjectStore().getConnection(), null);UserSet userSet = realm.findUsers(“shortName”, PrincipalSearchType.SUFFIX_MATCH, PrincipalSearchAttribute.SHORT_NAME, PrincipalSearchSortType.ASCENDING, 0, null); for(Iterator<?> iter = userSet.iterator();iter.hasNext();){ User user = (User)iter.next(); String dispName = user.get_DisplayName(); String email = user.get_Email();}
The core of the above Code is realm. findusers. The entity classes principalsearchtype, principalsearchattribute, and principalsearchsorttype are used to specify the matching modes, search condition fields, and sorting types respectively. These classes are all in the com. filenet. API. constants package of filenet. This facilitates management, prevents invalid parameters passing by users, and improves the code quality. In projects, we often define such classes to store required constants (including method parameter constants, information prompting constants, and configuration information constants ), A good application is the exception code in the unified management of project exceptions. However, pay attention to the difference between constants and information that may change (often using configuration files such as XML and property ).
The above code Query Process uses the suffix matching method and sorts the query results, which is quite slow. However, to query a user, we can perform exact search directly without sorting the results. The query speed can be increased by more than 10 times. The modification is as follows:
UserSet userSet = realm.findUsers (“shortName”, PrincipalSearchType.EXACT,PrincipalSearchAttribute.SHORT_NAME,PrincipalSearchSortType.NONE,0, null);
The vwsession in the filenet PE interface has fetchuserinfo (Java. lang. string thename) method can get vwuserinfo under the specified shortname, through this class can get information obtained using the realm method, however, using this method to query user information may result in permissions and other problems, resulting in the inability to fully obtain the information you need.
The security package of filenet also has many important functions, such as authorization and authentication, which are essential basic modules of all systems. In addition, the organization information of filenet involves the use of LDAP protocol as one of the Lightweight Directory Services. At the same time, this article briefly describes the use of constant classes and configuration files, but it is worth noting in the project.