Class FilesRepo
- java.lang.Object
-
- com.sun.identity.idm.IdRepo
-
- com.sun.identity.idm.plugins.files.FilesRepo
-
public class FilesRepo extends IdRepo
This class stores identity information in flat files usingjava.io.File
classes. The directory structure is organized as follows: The root directory is specified by the instance configuration parameter"sunFilesIdRepoDirectory"
. If not specified, it defaults to"/var/opt/SUNWam/idm/flatfiles"
. Under the root directory are sub-directories for each identity type (i.e., users, roles, agents, etc). In these sub-directories an identity is stored as a properties file.
-
-
Field Summary
Fields Modifier and Type Field Description static Debug
debug
static String
DIRECTORY
static String
ENCRYPT
static String
HASH
static String
NAME
static String
OBJECTCLASS
static String
OC
static String
PASSWORD
static String
STATUS
static String
UPDATE_CACHE
static String
UPDATE_CACHE_TIME
-
Constructor Summary
Constructors Constructor Description FilesRepo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
addListener(SSOToken token, IdRepoListener listener)
Adds a listener for changes in the repositoryvoid
assignService(SSOToken token, IdType type, String name, String serviceName, SchemaType stype, Map attrMap)
This method is used to assign a service to the given identity.boolean
authenticate(Callback[] credentials)
Returnstrue
if the data store successfully authenticates the identity with the provided credentials.static void
clearCache()
String
create(SSOToken token, IdType type, String name, Map attrMap)
Creates an identity.void
delete(SSOToken token, IdType type, String name)
Deletes an identity.Set
getAssignedServices(SSOToken token, IdType type, String name, Map mapOfServicesAndOCs)
Returns the set of services assigned to this identity.Map
getAttributes(SSOToken token, IdType type, String name)
Returns all attributes and values of name objectMap
getAttributes(SSOToken token, IdType type, String name, Set attrNames)
Returns requested attributes and values of name object.Map
getBinaryAttributes(SSOToken token, IdType type, String name, Set attrNames)
Returns requested binary attributes as an array of bytes.Map
getBinaryServiceAttributes(SSOToken token, IdType type, String name, String serviceName, Set attrNames)
Returns the requested binary attribute values of the service attributes as an array of bytes.String
getFullyQualifiedName(SSOToken token, IdType type, String name)
Returns the fully qualified name for the identity.Set
getMembers(SSOToken token, IdType type, String name, IdType membersType)
Returns the memberships of an identity.Set
getMemberships(SSOToken token, IdType type, String name, IdType membershipType)
Returns the memberships of an identity.Map
getServiceAttributes(SSOToken token, IdType type, String name, String serviceName, Set attrNames)
Returns the attribute values of the service attributes.Set
getSupportedOperations(IdType type)
Return supported operations for a given IdTypeSet
getSupportedTypes()
void
initialize(Map configParams)
Initialization paramters as configred for a given plugin.boolean
isActive(SSOToken token, IdType type, String name)
Returns true if thename
object is active.boolean
isExists(SSOToken token, IdType type, String name)
Returns true if thename
object exists in the data store.void
modifyMemberShip(SSOToken token, IdType type, String name, Set members, IdType membersType, int operation)
Modify membership of the identity.void
modifyService(SSOToken token, IdType type, String name, String serviceName, SchemaType sType, Map attrMap)
Modifies the attribute values of the service attributes.void
removeAttributes(SSOToken token, IdType type, String name, Set attrNames)
Removes the attributes from the identity.void
removeListener()
Removes the listener added usingaddListener
method.RepoSearchResults
search(SSOToken token, IdType type, String pattern, int maxTime, int maxResults, Set returnAttrs, boolean returnAllAttrs, int filterOp, Map avPairs, boolean recursive)
RepoSearchResults
search(SSOToken token, IdType type, String pattern, Map avPairs, boolean recursive, int maxResults, int maxTime, Set returnAttrs)
RepoSearchResults
search(SSOToken token, IdType type, CrestQuery crestQuery, int maxTime, int maxResults, Set returnAttrs, boolean returnAllAttrs, int filterOp, Map avPairs, boolean recursive)
Search for specific type of identities using a CrestQuery object instead of a string.void
setActiveStatus(SSOToken token, IdType type, String name, boolean active)
Sets the object's status toactive
.void
setAttributes(SSOToken token, IdType type, String name, Map attributes, boolean isAdd)
Set the values of attributes of the identity.void
setBinaryAttributes(SSOToken token, IdType type, String name, Map attributes, boolean isAdd)
Set the values of binary attributes the identity.boolean
supportsAuthentication()
Returnstrue
if the data store supports authentication of identities.void
unassignService(SSOToken token, IdType type, String name, String serviceName, Map attrMap)
If the service is already assigned to the identity then this method unassigns the service and removes the related attributes from the entry.-
Methods inherited from class com.sun.identity.idm.IdRepo
changePassword, getConfiguration, shutdown
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
debug
public static final Debug debug
-
DIRECTORY
public static final String DIRECTORY
- See Also:
- Constant Field Values
-
OBJECTCLASS
public static final String OBJECTCLASS
- See Also:
- Constant Field Values
-
PASSWORD
public static final String PASSWORD
- See Also:
- Constant Field Values
-
STATUS
public static final String STATUS
- See Also:
- Constant Field Values
-
HASH
public static final String HASH
- See Also:
- Constant Field Values
-
ENCRYPT
public static final String ENCRYPT
- See Also:
- Constant Field Values
-
UPDATE_CACHE
public static final String UPDATE_CACHE
- See Also:
- Constant Field Values
-
UPDATE_CACHE_TIME
public static final String UPDATE_CACHE_TIME
- See Also:
- Constant Field Values
-
OC
public static final String OC
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(Map configParams) throws IdRepoException
Description copied from class:IdRepo
Initialization paramters as configred for a given plugin.- Overrides:
initialize
in classIdRepo
- Throws:
IdRepoException
-
addListener
public int addListener(SSOToken token, IdRepoListener listener) throws IdRepoException, SSOException
Description copied from class:IdRepo
Adds a listener for changes in the repository- Specified by:
addListener
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.- Returns:
- status code
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
assignService
public void assignService(SSOToken token, IdType type, String name, String serviceName, SchemaType stype, Map attrMap) throws IdRepoException, SSOException
Description copied from class:IdRepo
This method is used to assign a service to the given identity. The behavior of this method will be different, depending on how each plugin will implement the services model. The map of attribute-values has already been validated and default values have already been inherited by the framework. The plugin has to verify if the service is assigned (in which case it should throw an exception), and assign the service and the attributes to the identity (if supported).- Specified by:
assignService
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.serviceName
- service to assignattrMap
- Map of attribute-values.- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
create
public String create(SSOToken token, IdType type, String name, Map attrMap) throws IdRepoException, SSOException
Description copied from class:IdRepo
Creates an identity.- Specified by:
create
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.attrMap
- Map of attribute-values assoicated with this object.- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
delete
public void delete(SSOToken token, IdType type, String name) throws IdRepoException, SSOException
Description copied from class:IdRepo
Deletes an identity.- Specified by:
delete
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getAssignedServices
public Set getAssignedServices(SSOToken token, IdType type, String name, Map mapOfServicesAndOCs) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns the set of services assigned to this identity. The framework has to check if the values are objectclasses, then map it to service names. Or if they are servicenames, then there is no mapping needed.- Specified by:
getAssignedServices
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.- Returns:
- Set of name of services assigned to
name
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getAttributes
public Map getAttributes(SSOToken token, IdType type, String name, Set attrNames) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns requested attributes and values of name object.- Specified by:
getAttributes
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.attrNames
- Set of attribute names to be read- Returns:
- Map of attribute-values
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getAttributes
public Map getAttributes(SSOToken token, IdType type, String name) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns all attributes and values of name object- Specified by:
getAttributes
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.- Returns:
- Map of attribute-values
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getBinaryAttributes
public Map getBinaryAttributes(SSOToken token, IdType type, String name, Set attrNames) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns requested binary attributes as an array of bytes.- Specified by:
getBinaryAttributes
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.attrNames
- Set of attribute names to be read- Returns:
- Map of attribute-values
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
setBinaryAttributes
public void setBinaryAttributes(SSOToken token, IdType type, String name, Map attributes, boolean isAdd) throws IdRepoException, SSOException
Description copied from class:IdRepo
Set the values of binary attributes the identity.- Specified by:
setBinaryAttributes
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.attributes
- Map of binary attribute-values to set or add.isAdd
- iftrue
add the attribute-values; otherwise replaces the attribute-values.- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getMembers
public Set getMembers(SSOToken token, IdType type, String name, IdType membersType) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns the memberships of an identity. For example, returns the groups or roles that a user belongs to. The list retrieved here for a user MUST be consistent with member queries against the corresponding groups.- Specified by:
getMembers
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.membersType
- IdType of members of name object.- Returns:
- Set of of members belongs to
name
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getMemberships
public Set getMemberships(SSOToken token, IdType type, String name, IdType membershipType) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns the memberships of an identity. For example, returns the groups or roles that a user belongs to.- Specified by:
getMemberships
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.membershipType
- IdType of memberships to return.- Returns:
- Set of objects that
name
is a member of. - Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getServiceAttributes
public Map getServiceAttributes(SSOToken token, IdType type, String name, String serviceName, Set attrNames) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns the attribute values of the service attributes.- Specified by:
getServiceAttributes
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.serviceName
- Name of service.attrNames
- Set of attribute names.- Returns:
- Map of attribute-values.
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getBinaryServiceAttributes
public Map getBinaryServiceAttributes(SSOToken token, IdType type, String name, String serviceName, Set attrNames) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns the requested binary attribute values of the service attributes as an array of bytes.- Specified by:
getBinaryServiceAttributes
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.serviceName
- Name of service.attrNames
- Set of attribute names.- Returns:
- Map of attribute-values.
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
isExists
public boolean isExists(SSOToken token, IdType type, String name) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns true if thename
object exists in the data store.- Specified by:
isExists
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.- Returns:
true
if name object is in data store elsefalse
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
modifyMemberShip
public void modifyMemberShip(SSOToken token, IdType type, String name, Set members, IdType membersType, int operation) throws IdRepoException, SSOException
Description copied from class:IdRepo
Modify membership of the identity. Set of members is a set of unique identifiers of other identities.- Specified by:
modifyMemberShip
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.members
- Set of names to be added as members of namemembersType
- IdType of members.operation
- operations to perform on members ADDMEMBER or REMOVEMEMBER.- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
modifyService
public void modifyService(SSOToken token, IdType type, String name, String serviceName, SchemaType sType, Map attrMap) throws IdRepoException, SSOException
Description copied from class:IdRepo
Modifies the attribute values of the service attributes.- Specified by:
modifyService
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.serviceName
- Name of service.attrMap
- map of attribute-values.- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
removeAttributes
public void removeAttributes(SSOToken token, IdType type, String name, Set attrNames) throws IdRepoException, SSOException
Description copied from class:IdRepo
Removes the attributes from the identity.- Specified by:
removeAttributes
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.attrNames
- Set of attribute names to remove.- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
removeListener
public void removeListener()
Description copied from class:IdRepo
Removes the listener added usingaddListener
method. This is called by the IdRepo framework when the plugin is being shutdown due to configuration change, so that a new instance can be created with the new configuration map.- Specified by:
removeListener
in classIdRepo
-
search
public RepoSearchResults search(SSOToken token, IdType type, CrestQuery crestQuery, int maxTime, int maxResults, Set returnAttrs, boolean returnAllAttrs, int filterOp, Map avPairs, boolean recursive) throws IdRepoException, SSOException
Description copied from class:IdRepo
Search for specific type of identities using a CrestQuery object instead of a string. This function actually supersedes the one above, since the "pattern" parameter can be wrapped in the CrestQuery parameter of this function.- Specified by:
search
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.crestQuery
- pattern to search for, of typeCrestQuery
.maxTime
- maximum wait time for search.maxResults
- maximum records to return.returnAttrs
- Set of attribute names to return.returnAllAttrs
- return all attributesfilterOp
- filter condition.avPairs
- additional search conditions.- Returns:
- RepoSearchResults
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
search
public RepoSearchResults search(SSOToken token, IdType type, String pattern, int maxTime, int maxResults, Set returnAttrs, boolean returnAllAttrs, int filterOp, Map avPairs, boolean recursive) throws IdRepoException, SSOException
- Throws:
IdRepoException
SSOException
-
search
public RepoSearchResults search(SSOToken token, IdType type, String pattern, Map avPairs, boolean recursive, int maxResults, int maxTime, Set returnAttrs) throws IdRepoException, SSOException
- Throws:
IdRepoException
SSOException
-
setAttributes
public void setAttributes(SSOToken token, IdType type, String name, Map attributes, boolean isAdd) throws IdRepoException, SSOException
Description copied from class:IdRepo
Set the values of attributes of the identity.- Specified by:
setAttributes
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.attributes
- Map of attribute-values to set or add.isAdd
- iftrue
add the attribute-values; otherwise replaces the attribute-values.- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
unassignService
public void unassignService(SSOToken token, IdType type, String name, String serviceName, Map attrMap) throws IdRepoException, SSOException
Description copied from class:IdRepo
If the service is already assigned to the identity then this method unassigns the service and removes the related attributes from the entry.- Specified by:
unassignService
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.serviceName
- Service name to remove.attrMap
- Map of attribute-values to remove- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getSupportedOperations
public Set getSupportedOperations(IdType type)
Description copied from class:IdRepo
Return supported operations for a given IdType- Overrides:
getSupportedOperations
in classIdRepo
- Parameters:
type
- Identity type- Returns:
- set of IdOperation supported for this IdType.
-
getSupportedTypes
public Set getSupportedTypes()
- Overrides:
getSupportedTypes
in classIdRepo
- Returns:
- Returns a Set of IdTypes supported by this plugin. Returns the supported types of identities for this plugin. If a plugin does not override this method, it returns an empty set.
-
isActive
public boolean isActive(SSOToken token, IdType type, String name) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns true if thename
object is active.- Overrides:
isActive
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.- Returns:
true
if name object is in active elsefalse
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
setActiveStatus
public void setActiveStatus(SSOToken token, IdType type, String name, boolean active) throws IdRepoException, SSOException
Description copied from class:IdRepo
Sets the object's status toactive
.- Specified by:
setActiveStatus
in classIdRepo
- Parameters:
token
- Single sign on token of identity performing the task.type
- Identity type of this object.name
- Name of the object of interest.active
- true if setting to active; false otherwise.- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
getFullyQualifiedName
public String getFullyQualifiedName(SSOToken token, IdType type, String name) throws IdRepoException, SSOException
Description copied from class:IdRepo
Returns the fully qualified name for the identity. It is expected that the fully qualified name would be unique, hence it is recommended to prefix the name with the data store name or protocol. Used by IdRepo framework to check for equality of two identities- Overrides:
getFullyQualifiedName
in classIdRepo
- Parameters:
token
- administrator SSOToken that can be used by the datastore to determine the fully qualified nametype
- type of the identityname
- name of the identity- Returns:
- fully qualified name for the identity within the data store
- Throws:
IdRepoException
- If there are repository related error conditions.SSOException
- If identity's single sign on token is invalid.
-
supportsAuthentication
public boolean supportsAuthentication()
Description copied from class:IdRepo
Returnstrue
if the data store supports authentication of identities. Used by IdRepo framework to authenticate identities.- Overrides:
supportsAuthentication
in classIdRepo
- Returns:
true
if data store supports authentication of of identities; elsefalse
-
authenticate
public boolean authenticate(Callback[] credentials) throws IdRepoException, AuthLoginException
Description copied from class:IdRepo
Returnstrue
if the data store successfully authenticates the identity with the provided credentials. In case the data store requires additional credentials, the list would be returned via theIdRepoException
exception.- Overrides:
authenticate
in classIdRepo
- Parameters:
credentials
- Array of callback objects containing information such as username and password.- Returns:
true
if data store authenticates the identity; elsefalse
- Throws:
IdRepoException
AuthLoginException
-
clearCache
public static void clearCache()
-
-