public class PCDirectoryHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PCDirectoryHelper.ATTR_NAMES
Constants for user attribute name
|
static class |
PCDirectoryHelper.DIR_ALIAS
Static constants to identify common aliases in MWS
|
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_GROUP
Parameter constant to specify group principals
|
static int |
TYPE_ROLE
Parameter constant to specify role principals
|
static int |
TYPE_USER
Parameter constant to specify user principals
|
Constructor and Description |
---|
PCDirectoryHelper() |
Modifier and Type | Method and Description |
---|---|
static View |
authenticateUser(String userID,
String password)
Authenticate a user with the given userID and password
|
static Map<String,Object> |
getAllAttributes(URI principalURI)
Get a map of all attributes associated with a given principal
|
static Object |
getAttribute(URI principalAttrProviderURI,
URI principalURI,
String attrName)
Get a specific attribute from a specific principal attribute provider for a principal
|
static Map<String,Object> |
getAttributes(URI principalAttrProviderURI,
URI principalURI)
Get a map of attributes for a principal from a specific attribute provider
|
static ThingIDList |
getDirectorySvcs()
Get a ThingIDList of all available directory services
|
static String |
getDirectoryURI(View view)
Get a directory URI from a View of a principal
|
static ListView |
getMembers(URI principalURI)
Get a list of members of a group or role
|
static ListView |
getMembership(URI principalURI,
int type)
Get a list of groups or roles that a principal has membership in
|
static View |
getPrincipalAttributeProvider(String alias)
Get a View of a principal attribute provider given the provider's alias
|
static View |
getSystemDirSvc()
Get a View of the MWS system directory service
|
static TypedAttribute |
getTypedAttribute(URI principalAttrProviderURI,
URI principalURI,
String attrName)
Get a specified attribute for a principal from a specific attribute provider.
|
static Map |
getTypedAttributes(URI principalAttrProviderURI,
URI principalURI)
Get a map of attributes for a principal from a specific attribute provider.
|
static View |
getView(URI uri)
Get a View that exposes the properties of a specified MWS thing
|
static ThingIDList |
listRoles()
Retrieve a list of all role defined in the system
|
static View |
lookupPrincipalByDN(String dn,
int type)
Lookup a user/group/role based on the principal's dynamic name
|
static View |
lookupPrincipalByID(String id,
int type)
Lookup a user/group/role based on id
|
static ListView |
searchDirectory(URI directoryServiceURI,
String search,
int type)
Pperforms a search query for principals of a certain type in a specific directory service
|
public static final int TYPE_USER
public static final int TYPE_GROUP
public static final int TYPE_ROLE
public static View getView(URI uri) throws Exception
uri
- the MWS thing URI to retrieve a View forException
public static View lookupPrincipalByID(String id, int type) throws Exception
id
- the principal IDtype
- the principal type, either TYPE_GROUP
, TYPE_ROLE
or TYPE_USER
Exception
public static View lookupPrincipalByDN(String dn, int type) throws Exception
dn
- the principal DNtype
- the principal type, either TYPE_GROUP
, TYPE_ROLE
or TYPE_USER
Exception
public static ListView searchDirectory(URI directoryServiceURI, String search, int type) throws Exception
directoryServiceURI
- the URI of the directory service to searchsearch
- The search string. Wildcarding is implied, e.g. 'bob' will match user 'bobby' and 'kabob'type
- the principal type to search for, either TYPE_GROUP
, TYPE_ROLE
or TYPE_USER
Exception
public static Map<String,Object> getAllAttributes(URI principalURI) throws Exception
principalURI
- the URI identifying the principal to retrieve attributes forException
public static Map<String,Object> getAttributes(URI principalAttrProviderURI, URI principalURI) throws Exception
principalAttrProviderURI
- the URI of the attribute provider to retrieve attributes from, null returns the principal's core attributesprincipalURI
- the URI identifying the principal to retrieve attributes forException
public static Object getAttribute(URI principalAttrProviderURI, URI principalURI, String attrName) throws Exception
principalAttrProviderURI
- the URI of the attribute provider to retrieve attributes from, null returns the principal's core attributesprincipalURI
- the URI identifying the principal to retrieve attributes forattrName
- the attribute name to retrieveException
public static Map getTypedAttributes(URI principalAttrProviderURI, URI principalURI) throws Exception
PCDirectoryHelper.DIR_ALIAS.PAP_DYN_ATTR_MAP
attribute provider, which contain information
about attribute data typesprincipalAttrProviderURI
- the URI of the attribute provider to retrieve attributes from, null returns the principal's core attributesprincipalURI
- the URI identifying the principal to retrieve attributes forTypedAttribute
pairsException
public static TypedAttribute getTypedAttribute(URI principalAttrProviderURI, URI principalURI, String attrName) throws Exception
PCDirectoryHelper.DIR_ALIAS.PAP_DYN_ATTR_MAP
attribute provider, which contain information
about attribute data typesprincipalAttrProviderURI
- the URI of the attribute provider to retrieve attributes from, null returns the principal's core attributesprincipalURI
- the URI identifying the principal to retrieve attributes forattrName
- the name of the attribute to retrieveTypedAttribute
, the object may be nullException
public static ListView getMembers(URI principalURI) throws Exception
principalURI
- the URI identifying the principal to retrieve membership forException
public static ListView getMembership(URI principalURI, int type) throws Exception
principalURI
- he URI identifying the principal to retrieve membership intype
- type the principal membership to retrieve, either TYPE_GROUP
, TYPE_ROLE
Exception
public static ThingIDList listRoles() throws Exception
Exception
public static View authenticateUser(String userID, String password) throws Exception
public static View getSystemDirSvc() throws Exception
Exception
public static ThingIDList getDirectorySvcs() throws Exception
Exception
public static View getPrincipalAttributeProvider(String alias) throws Exception
alias
- the provider to retrieve, see PCDirectoryHelper.DIR_ALIAS
for a list of well known principal attribute provider aliasesException