public class User extends LDAPEntry implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
CREDTYPE_PASSWD
Using userpassword to authenticate
|
static int |
EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTOR
Extended Preference Type to be used with getExtendedProperties() -
Resource Access Descriptor
|
Constructor and Description |
---|
User(javax.naming.directory.DirContext ctx,
int inUserIdType,
java.lang.String inUserIdName,
int inSubIdType,
java.lang.String inSubIdName,
boolean validate) |
User(javax.naming.directory.DirContext ctx,
int inUserIdType,
java.lang.String inUserIdName,
int inSubIdType,
java.lang.String inSubIdName,
boolean validate,
java.util.logging.Logger lgr)
Constructs a User by specifying the user information and the subscriber
information if required.
|
User(javax.naming.directory.DirContext ctx,
int inUserIdType,
java.lang.String inUserIdName,
Subscriber inSubscriber,
boolean validate) |
User(javax.naming.directory.DirContext ctx,
int inUserIdType,
java.lang.String inUserIdName,
Subscriber inSubscriber,
boolean validate,
java.util.logging.Logger lgr)
Constructs a User by specifying the user information and the subscriber
information if required.
|
Modifier and Type | Method and Description |
---|---|
void |
authenticateUser(javax.naming.directory.DirContext ctx,
int authType,
java.lang.Object cred)
Authenticates User using the appropriate credentials.
|
void |
authenticateUser(javax.naming.directory.DirContext ctx,
java.lang.String attrName,
java.lang.String attrValue)
Authenticates the user using an attribute-value pair.
|
void |
createExtendedProperties(javax.naming.directory.DirContext ctx,
int propType,
ModPropertySet mps)
Creates new extended properties for the user.
|
java.lang.String |
getDn()
Deprecated.
use
getDN(DirContext ctx) |
java.lang.String |
getDN()
Deprecated.
use
getDN(DirContext ctx) |
java.lang.String |
getDn(javax.naming.directory.DirContext ctx)
Deprecated.
use
getDN(DirContext ctx) |
java.lang.String |
getDN(javax.naming.directory.DirContext ctx)
Returns the DN of this user.
|
PropertySetCollection |
getExtendedProperties(javax.naming.directory.DirContext ctx,
int propType,
java.lang.String[] attrList)
Returns a property set collection of all the extended properties of this
user based on the property type specified.
|
PropertySetCollection |
getExtendedProperties(javax.naming.directory.DirContext ctx,
int propType,
java.lang.String[] attrList,
java.lang.String filter)
Returns a property set collection of the extended properties of this
user based on the property type specified
|
Group[] |
getGroupMembership(javax.naming.directory.DirContext ctx,
java.lang.String[] attrList,
boolean nested)
Returns an array of
Group objects of which this user is a
member. |
java.lang.String |
getGUID()
Deprecated.
use
getGUID(DirContext ctx) |
java.lang.String |
getGUID(javax.naming.directory.DirContext ctx)
Returns the GUID of the entry (resolves the name if necessary).
|
PropertySetCollection |
getProperties(javax.naming.directory.DirContext ctx,
java.lang.String[] attrList)
Returns the attributes specified from this user.
|
PropertySetCollection |
getProperties(javax.naming.directory.DirContext ctx,
java.lang.String[] attrList,
boolean usecache)
Returns the attributes specified from this user.
|
boolean |
isProvisioned() |
java.lang.String |
locateSubscriber(javax.naming.directory.DirContext ctx)
Locates and returns the subscriber DN of the subscriber
this user belongs to
|
void |
resolve(javax.naming.directory.DirContext ctx)
Validates the user by identifying its DN
|
void |
setExtendedProperties(javax.naming.directory.DirContext ctx,
int propType,
java.lang.String filter,
ModPropertySet mps)
Sets extended properties of this user.
|
void |
setProperties(javax.naming.directory.DirContext ctx,
javax.naming.directory.ModificationItem[] mods)
Sets the properties of this user using JNDI
ModificationItem . |
void |
setProperties(javax.naming.directory.DirContext ctx,
ModPropertySet mps)
Sets the properties of this user.
|
public static int CREDTYPE_PASSWD
public static int EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTOR
public User(javax.naming.directory.DirContext ctx, int inUserIdType, java.lang.String inUserIdName, Subscriber inSubscriber, boolean validate, java.util.logging.Logger lgr) throws UtilException
ctx
- A valid DirContextinUserIdType
- The type of user id being used - use
one of Util.IDTYPE_DN, Util.IDTYPE_SIMPLE
or Util.IDTYPE_GUIDinUserIdName
- User IDinSubscriber
- A valid Subscriber objectvalidate
- Set to true to validate the user
by the constructorUtilException
Util
public User(javax.naming.directory.DirContext ctx, int inUserIdType, java.lang.String inUserIdName, Subscriber inSubscriber, boolean validate) throws UtilException
UtilException
public User(javax.naming.directory.DirContext ctx, int inUserIdType, java.lang.String inUserIdName, int inSubIdType, java.lang.String inSubIdName, boolean validate, java.util.logging.Logger lgr) throws UtilException
ctx
- A valid DirContextinUserIdType
- The type of user id being used - use
one of Util.IDTYPE_DN, Util.IDTYPE_SIMPLE
or Util.IDTYPE_GUIDinUserIdName
- User IDinSubIdType
- The type of subscriber id being used -
use one of Util.IDTYPE_DN, Util.IDTYPE_SIMPLE
Util.IDTYPE_GUID, Util.IDTYPE_DEFAULTinSubIdName
- Subscriber IDvalidate
- Set to true to validate the user
by the constructorUtilException
Util
public User(javax.naming.directory.DirContext ctx, int inUserIdType, java.lang.String inUserIdName, int inSubIdType, java.lang.String inSubIdName, boolean validate) throws UtilException
UtilException
public PropertySetCollection getExtendedProperties(javax.naming.directory.DirContext ctx, int propType, java.lang.String[] attrList, java.lang.String filter) throws UtilException
ctx
- a valid DirContextpropType
- currently only supporting
EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTORattrList
- a String array of attributes to be retrieved;
null indicates that all attributes should be
retrieved; an empty array indicates that
none should be retrievedfilter
- a search filter to identify an particular
applications whose properties is to be retrievedUtilException
EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTOR
public PropertySetCollection getExtendedProperties(javax.naming.directory.DirContext ctx, int propType, java.lang.String[] attrList) throws UtilException
ctx
- a valid DirContextpropType
- currently only supporting EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTORattrList
- a String array of attributes to be retrieved;
null indicates that all attributes should be
retrieved; an empty array indicates that
none should be retrievedUtilException
public void setExtendedProperties(javax.naming.directory.DirContext ctx, int propType, java.lang.String filter, ModPropertySet mps) throws UtilException
EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTOR
is supported.
Here is an example to modify the orclpasswordattribute of the resource whose orclresourcname is "db9i". // Define ModPropertySet ModPropertySet mps = new ModPropertySet(); // Setting new orclpasswordattribute value mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_REPLACE, "orclpasswordattribute", "newpw"); // execute the modification user.setExtendedProperties( ctx, User.EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTOR, "orclresourcename=db9i", mps );
ctx
- a valid DirContextpropType
- only EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTOR
is supportedfilter
- a filter used in locating the extended propertiesmps
- a ModPropertySet
containing the modificationsUtilException
public void createExtendedProperties(javax.naming.directory.DirContext ctx, int propType, ModPropertySet mps) throws UtilException
EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTOR
is supported.
Here is an example to creating a new resource access descriptor for an orclresourcename="db9i" whose orclresourcetypename is "OracleDB". Various other attributes are also set. // Define ModPropertySet ModPropertySet mps = new ModPropertySet(); // Setting property values mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_REPLACE, "orclpasswordattribute", "newpw"); mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "orclpasswordattribute", "testpw"); mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "orcluseridattribute", "uid"); mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "orclresourcename", "db9i"); mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "orclresourcetypename", "OracleDB"); mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "orclusermodifiable", "true"); mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "orclownerguid", "BDD1DBD7748F24BEE034080020AB67AA"); // Create user.createExtendedProperties( ctx, User.EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTOR, mps );
ctx
- a valid DirContextpropType
- only EXTPROPTYPE_RESOURCE_ACCESS_DESCRIPTOR
is supportedmps
- a ModPropertySet
containing the modificatio
nsUtilException
public void setProperties(javax.naming.directory.DirContext ctx, javax.naming.directory.ModificationItem[] mods) throws UtilException
ModificationItem
.ctx
- A valid DirContextmods
- A valid array of ModificationItem
UtilException
public void setProperties(javax.naming.directory.DirContext ctx, ModPropertySet mps) throws UtilException
See documentation on ModPropertySet
on how to
construct a ModPropertySet
object.
If the modification involves user password modification,
PasswordPolicyException
might be thrown. See
documentation on PasswordPolicyException
for
more details.
setProperties
in class LDAPEntry
ctx
- a valid DirContextmps
- a valid PropertySet containing the items to be modifiedUtilException
public PropertySetCollection getProperties(javax.naming.directory.DirContext ctx, java.lang.String[] attrList) throws UtilException
ctx
- a valid DirContextattrList
- an array of attributes to be returnedUtilException
public PropertySetCollection getProperties(javax.naming.directory.DirContext ctx, java.lang.String[] attrList, boolean usecache) throws UtilException
getProperties
in class LDAPEntry
ctx
- a valid DirContextattrList
- an array of attributes to be returnedusecache
- Set to true if previously cached values are to be usedUtilException
public void resolve(javax.naming.directory.DirContext ctx) throws UtilException
resolve
in class LDAPEntry
ctx
- A valid DirContextUtilException
public java.lang.String getDN(javax.naming.directory.DirContext ctx) throws UtilException
getDN
in class LDAPEntry
ctx
- a valid DirContextUtilException
public java.lang.String getDn(javax.naming.directory.DirContext ctx) throws UtilException
getDN(DirContext ctx)
ctx
- a valid DirContextUtilException
public java.lang.String getDn() throws UtilException
getDN(DirContext ctx)
UtilException
public java.lang.String getDN() throws UtilException
getDN(DirContext ctx)
UtilException
public java.lang.String locateSubscriber(javax.naming.directory.DirContext ctx) throws UtilException
UtilException
public java.lang.String getGUID() throws UtilException
getGUID(DirContext ctx)
UtilException
public java.lang.String getGUID(javax.naming.directory.DirContext ctx) throws UtilException
ctx
- a valid DirContextUtilException
public void authenticateUser(javax.naming.directory.DirContext ctx, int authType, java.lang.Object cred) throws UtilException
UtilException
is thrown.
The UtilException
could be a
PasswordPolicyException
. See documentation on
the various PasswordPolicyException
s for more
details.
Authentication succeeds if no exception is thrown.
ctx
- a valid DirContextauthType
- User.CREDTYPE_PASSWD is the only one
supported
at the momentcred
- the credentials based on the authTypeUtilException
public void authenticateUser(javax.naming.directory.DirContext ctx, java.lang.String attrName, java.lang.String attrValue) throws UtilException
ctx
- a valid DirContextattrName
- the name of the attributeattrValue
- the value of the attributeUtilException
public Group[] getGroupMembership(javax.naming.directory.DirContext ctx, java.lang.String[] attrList, boolean nested) throws UtilException
Group
objects of which this user is a
member.ctx
- a valid DirContextattrList
- an array of attributes to be returned from each groupnested
- set to true to return nested group membershipUtilException
public boolean isProvisioned()