com.ibm.websphere.security
Interface CustomRegistry


public interface CustomRegistry

The CustomRegistry interface provides an API that supports the following registry entry types:

Implementation of this interface must provide implementations for:


Method Summary
 java.lang.String checkPassword(java.lang.String userId, java.lang.String password)
          Checks the password of the user.
 java.lang.String getGroupDisplayName(java.lang.String groupName)
          Returns the display name for a group.
 java.util.List getGroups()
          Returns names of all the groups in the registry.
 java.util.List getGroups(java.lang.String pattern)
          Returns names of the groups in the registry that match a pattern.
 java.lang.String getGroupSecurityName(java.lang.String uniqueGroupId)
          Returns the name for a group given its uniqueId.
 java.util.List getGroupsForUser(java.lang.String userName)
          Returns the names of the groups to which userName belongs.
 java.lang.String getRealm()
          Returns the realm of the registry.
 java.lang.String getUniqueGroupId(java.lang.String groupName)
          Returns the Unique id for a group.
 java.util.List getUniqueGroupIds(java.lang.String uniqueUserId)
          Returns the Unique ids for all the groups that contain the UniqueId of a user.
 java.lang.String getUniqueUserId(java.lang.String userName)
          Returns the UniqueId for a userName.
 java.util.List getUniqueUserIds(java.lang.String uniqueGroupId)
          Returns the UniqueIds for all the users that belong to a group.
 java.lang.String getUserDisplayName(java.lang.String userName)
          Returns the display name for the user specified by userName.
 java.util.List getUsers()
          Returns names of all the users in the registry.
 java.util.List getUsers(java.lang.String pattern)
          Returns names of the users in the registry that match a pattern.
 java.lang.String getUserSecurityName(java.lang.String uniqueUserId)
          Returns the name for a user given its uniqueId.
 java.util.List getUsersForGroup(java.lang.String groupName)
          Returns the names of the all the users in a group.
 void initialize(java.util.Properties props)
          Initializes the registry.
 boolean isValidGroup(java.lang.String groupName)
          Determines if a group exists.
 boolean isValidUser(java.lang.String userName)
          Determines if a user exists.
 java.lang.String mapCertificate(java.security.cert.X509Certificate cert)
          Maps a Certificate (of X509 format) to a valid userId in the Registry.
 

Method Detail

initialize

public void initialize(java.util.Properties props)
                throws CustomRegistryException
Initializes the registry.
Parameters:
props - the registry-specific properties with which to initialize the registry object.
Throws:
CustomRegistryException - if the registry is "bad".

checkPassword

public java.lang.String checkPassword(java.lang.String userId,
                                      java.lang.String password)
                               throws PasswordCheckFailedException,
                                      CustomRegistryException
Checks the password of the user.
Parameters:
userId - the username whose password needs to be checked.
password - the password of the userId.
Returns:
a valid username (this can be the same userId whose password was checked or it could be some other userId in the registry if the implementation was to do so).
Throws:
CheckPasswordFailedException - if userId/password combination does not exist in the registry.
CustomRegistryException - if the registry is "bad".

mapCertificate

public java.lang.String mapCertificate(java.security.cert.X509Certificate cert)
                                throws CertificateMapNotSupportedException,
                                       CertificateMapFailedException,
                                       CustomRegistryException
Maps a Certificate (of X509 format) to a valid userId in the Registry.
Parameters:
cert - the certificate that needs to be mapped.
Returns:
the mapped name of the user (userId).
Throws:
CertificateMapNotSupportedException - if the particular certificate is not supported.
CertificateMapFailedException - if the mapping of the certificate fails.
CustomRegistryException - if the registry is "bad".

getRealm

public java.lang.String getRealm()
                          throws CustomRegistryException
Returns the realm of the registry.
Returns:
the realm. The realm is a registry-specific string indicating the realm or domain for which this registry applies. E.g. for OS400 or AIX this would be the host name of the system whose user registry * this object represents. If null is returned by this method realm defaults to the value of "customRealm".
Throws:
CustomRegistryException - if the registry is "bad".

getUsers

public java.util.List getUsers()
                        throws CustomRegistryException
Returns names of all the users in the registry.
Returns:
a List of the names of all the users.
Throws:
CustomRegistryException - if the registry is "bad".

getUsers

public java.util.List getUsers(java.lang.String pattern)
                        throws CustomRegistryException
Returns names of the users in the registry that match a pattern.
Parameters:
pattern - the pattern to match. (For e.g., a* will match all userNames starting with a)
Returns:
a List of the names of all the users that match the pattern.
Throws:
CustomRegistryException - if the registry is "bad".

getUsersForGroup

public java.util.List getUsersForGroup(java.lang.String groupName)
                                throws EntryNotFoundException,
                                       CustomRegistryException
Returns the names of the all the users in a group.
Parameters:
groupName - the name of the group.
Returns:
a List of all the names of the users in the group.
Throws:
EntryNotFoundException - if groupName does not exist.
CustomRegistryException - if the registry is "bad".

getUserDisplayName

public java.lang.String getUserDisplayName(java.lang.String userName)
                                    throws EntryNotFoundException,
                                           CustomRegistryException
Returns the display name for the user specified by userName.
Parameters:
userName - the name of the user.
Returns:
the display name for the user. The display name is a registry-specific string that represents a descriptive, not necessarily unique, name for a user. If a display name does not exist return null.
Throws:
EntryNotFoundException - if userName does not exist.
CustomRegistryException - if the registry is "bad".

getUniqueUserId

public java.lang.String getUniqueUserId(java.lang.String userName)
                                 throws EntryNotFoundException,
                                        CustomRegistryException
Returns the UniqueId for a userName.
Parameters:
userName - the name of the user.
Returns:
the UniqueId of the user. The UniqueId for an user is the stringified form of some unique, registry-specific, data that serves to represent the user. E.g. for the UNIX user registry, the UniqueId for a user can be the UID.
Throws:
EntryNotFoundException - if userName does not exist.
CustomRegistryException - if the registry is "bad".

getUniqueUserIds

public java.util.List getUniqueUserIds(java.lang.String uniqueGroupId)
                                throws EntryNotFoundException,
                                       CustomRegistryException
Returns the UniqueIds for all the users that belong to a group.
Parameters:
uniqueGroupId - the uniqueId of the group.
Returns:
a List of all the user Unique ids that are contained in the group whose Unique id matches the uniqueGroupId. The Unique id for an entry is the stringified form of some unique, registry-specific, data that serves to represent the entry. E.g. for the Unix user registry, the Unique id for a group could be the GID and the Unique Id for the user could be the UID.
Throws:
EntryNotFoundException - if uniqueGroupId does not exist.
CustomRegistryException - if the registry is "bad".

getUserSecurityName

public java.lang.String getUserSecurityName(java.lang.String uniqueUserId)
                                     throws EntryNotFoundException,
                                            CustomRegistryException
Returns the name for a user given its uniqueId.
Parameters:
uniqueUserId - the UniqueId of the user.
Returns:
the name of the user.
Throws:
EntryNotFoundException - if the uniqueUserId does not exist.
CustomRegistryException - if the registry is "bad".

isValidUser

public boolean isValidUser(java.lang.String userName)
                    throws CustomRegistryException
Determines if a user exists.
Parameters:
userName - the name of the user.
Returns:
true if the user exists; false otherwise.
Throws:
CustomRegistryException - if the registry is "bad".

getGroups

public java.util.List getGroups()
                         throws CustomRegistryException
Returns names of all the groups in the registry.
Returns:
a List of the names of all the groups.
Throws:
CustomRegistryException - if the registry is "bad".

getGroups

public java.util.List getGroups(java.lang.String pattern)
                         throws CustomRegistryException
Returns names of the groups in the registry that match a pattern.
Parameters:
pattern - the pattern to match.
Returns:
a List of the names of the groups.
Throws:
CustomRegistryException - if the registry is "bad".

getGroupsForUser

public java.util.List getGroupsForUser(java.lang.String userName)
                                throws EntryNotFoundException,
                                       CustomRegistryException
Returns the names of the groups to which userName belongs.
Parameters:
userName - the username of the user.
Returns:
a List of the names of all the groups that the user belongs to.
Throws:
EntryNotFoundException - if userName does not exist.
CustomRegistryException - if the registry is "bad".

getGroupDisplayName

public java.lang.String getGroupDisplayName(java.lang.String groupName)
                                     throws EntryNotFoundException,
                                            CustomRegistryException
Returns the display name for a group.
Parameters:
groupName - the name of the group.
Returns:
the display name for the group. The display name is a registry-specific string that represents a descriptive, not necessarily unique, name for a group.
Throws:
EntryNotFoundException - if the groupName does not exist.
CustomRegistryException - if the registry is "bad".

getUniqueGroupId

public java.lang.String getUniqueGroupId(java.lang.String groupName)
                                  throws EntryNotFoundException,
                                         CustomRegistryException
Returns the Unique id for a group.
Parameters:
groupName - the name of the group.
Returns:
the Unique id of the group. The Unique id for a group is the stringified form of some unique, registry-specific, data that serves to represent the entry. E.g. for the Unix user registry, the Unique id could be the GID for the entry.
Throws:
EntryNotFoundException - if groupName does not exist.
CustomRegistryException - if the registry is "bad".

getUniqueGroupIds

public java.util.List getUniqueGroupIds(java.lang.String uniqueUserId)
                                 throws EntryNotFoundException,
                                        CustomRegistryException
Returns the Unique ids for all the groups that contain the UniqueId of a user.
Parameters:
uniqueUserId - the uniqueId of the user.
Returns:
a List of all the group Unique ids that uniqueUserId belongs to. The Unique id for an entry is the stringified form of some unique, registry-specific, data that serves to represent the entry. E.g. for the Unix user registry, the Unique id for a group could be the GID and the Unique Id for the user could be the UID.
Throws:
EntryNotFoundException - if uniqueUserId does not exist.
CustomRegistryException - if the registry is "bad".

getGroupSecurityName

public java.lang.String getGroupSecurityName(java.lang.String uniqueGroupId)
                                      throws EntryNotFoundException,
                                             CustomRegistryException
Returns the name for a group given its uniqueId.
Parameters:
uniqueGroupId - the UniqueId of the group.
Returns:
the name of the group.
Throws:
EntryNotFoundException - if the uniqueGroupId does not exist.
CustomRegistryException - if the registry is "bad".

isValidGroup

public boolean isValidGroup(java.lang.String groupName)
                     throws CustomRegistryException
Determines if a group exists.
Parameters:
groupName - the name of the group.
Returns:
true if the group exists; false otherwise.
Throws:
CustomRegistryException - if the registry is "bad".