InfoCenter Home > 5.2.2.2.2: The getRealm and initialize methodsThe CustomRegistry interface defines the getRealm method for determining the name of the security realm. The name of the realm identifies the security domain for which the registry authenticates users. Each WebSphere Application Server resides in a specific realm, and access to its applications is restricted by the security requirements of the realm. If this method returns a null value, a default name of customRealm is used. For the sample implementation, the string customRealm is simply coded into the getRealm method. The CustomRegistry interface also defines the initialize method for initializing the custom registry. This method is used for establishing contact with the registry and performing any initial work. For the example registry, the intialize method retrieves the names of the registry files containing the user and group information. WebSphere Application Server expects both the getRealm method and the initialize method to throw the CustomRegistryException exception in case of any problems. Figure 6 shows the methods as implemented in the FileRegistrySample class.
Figure 6. Code example: The getRealm and initialize methods in the FileRegistrySample class public String getRealm() throws CustomRegistryException { String name = "customRealm"; return name; } public void initialize(java.util.Properties props) throws CustomRegistryException { try { // Get the files containing the user and group information. // The properties "usersFile" and "groupsFile" are set in // the GUI when the registry is configured. if (props != null) { USERFILENAME = props.getProperty("usersFile"); GROUPFILENAME = props.getProperty("groupsFile"); } } catch (Exception ex) { throw new CustomRegistryException(ex.getMessage()); } if (USERFILENAME == null || GROUPFILENAME = null) { throw new CustomRegistryException( "users/groups information missing); } } |
| ||
|