org.idoox.security.pstore
Interface UserStore

All Known Implementing Classes:
AbstractUserStore

public interface UserStore

This interface represents the store of the security identities associated information. It allows to associate properties to the identities. Stored identities are identified using the java.lang.String instance.

Since:
3.0
Component:
Security-Core

Field Summary
static int DELETE_USER_ACTION
          Delete user action (notification event type)
static java.lang.String FILTER_STRING
          This string can be put into the map for filtering of results.
static java.lang.String IMAGE_PROPERTY
          Image property.
static java.lang.String PASSWORD_PROPERTY
          Password property key.
static java.lang.String X509CERTIFICATE_PROPERTY
          X.509 Certificate property key.
static java.lang.String X509CERTIFICATECHAIN_PROPERTY
          X.509 Certificate chain property key.
 
Method Summary
 void addNotificationListener(NotificationListener listener)
          Register a listener for the NotificationEvent events.
 void deleteUser(java.lang.String userId)
          Deletes user with given name from user store.
 PropertySerializer getPropertySerializer(java.lang.String propertyKey)
          Returns the PropertySerializer associated with the given key.
 java.util.Iterator getSupportedAttributes()
          Gets supported attributes for users.
 java.lang.String[] getUserIds()
          Returns string array containing all user identifiers, typically user names.
 java.util.Map getUserProperties(java.lang.String userId)
          Returns map of properties associated with given user.
 java.lang.Object getUserProperty(java.lang.String userId, java.lang.String key)
          Returns value of particular user property.
 UserIterator getUsers()
          Returns iterator over all user entries.
 UserIterator getUsers(java.util.Map filter)
          Returns iterator over users entries that match given filter.
 boolean hasUser(java.lang.String userId, java.util.Map filter)
          Determines whether user with given name and properties is present in the user store or not.
 void removeNotificationListener(NotificationListener listener)
          Remove a listener for the NotificationEvent events.
 void removeUserProperty(java.lang.String userId, java.lang.String key)
          Removes user's property.
 void setPropertySerializer(java.lang.String propertyKey, PropertySerializer serializer)
          Registers the propertySerializer associated with the propertyKey.
 void setUserProperties(java.lang.String userId, java.util.Map properties)
          Sets properties to given user.
 void setUserProperty(java.lang.String userId, java.lang.String key, java.lang.Object value)
          Sets particular property to given user.
 void setUserStoreSource(UserStoreSource source)
          Set the UserStoreSource associated with this object.
 

Field Detail

PASSWORD_PROPERTY

public static final java.lang.String PASSWORD_PROPERTY
Password property key.

Since:
4.0
See Also:
Constant Field Values

X509CERTIFICATE_PROPERTY

public static final java.lang.String X509CERTIFICATE_PROPERTY
X.509 Certificate property key. When used, the value MUST be an instance of java.security.cert.X509Certificate.

See Also:
Constant Field Values

X509CERTIFICATECHAIN_PROPERTY

public static final java.lang.String X509CERTIFICATECHAIN_PROPERTY
X.509 Certificate chain property key. When used, the value MUST be an instance of java.security.cert.X509Certificate[].

See Also:
Constant Field Values

FILTER_STRING

public static final java.lang.String FILTER_STRING
This string can be put into the map for filtering of results. The value must be string and can contain '*' wildcards at the beginning and at the end of the string. This '*' wildcard means any character.

Since:
4.5
See Also:
you can put the property into the first parameter, Constant Field Values

IMAGE_PROPERTY

public static final java.lang.String IMAGE_PROPERTY
Image property.

Since:
4.0
See Also:
Constant Field Values

DELETE_USER_ACTION

public static final int DELETE_USER_ACTION
Delete user action (notification event type)

See Also:
Constant Field Values
Method Detail

deleteUser

public void deleteUser(java.lang.String userId)
                throws UserStoreException
Deletes user with given name from user store. Implementation of UserStore is responsible for notification of user removal to all registered listeners. *

Parameters:
userId - name of the user
Throws:
UserStoreException - when the user entry is not found or it cannot be removed

hasUser

public boolean hasUser(java.lang.String userId,
                       java.util.Map filter)
Determines whether user with given name and properties is present in the user store or not.

The property can be either requested to be present, in which case the map should contain only the property key and the associated value must be set to null or it can be requested that particular property must have certain value, in which case both key and value in the properties map must be set to non-null values.

Parameters:
userId - name of the user
filter - set of properties the user must possess
Returns:
true is a entry entry exist with matched properties, false otherwise
Since:
4.0
See Also:
PASSWORD_PROPERTY, X509CERTIFICATE_PROPERTY, X509CERTIFICATECHAIN_PROPERTY

getUserProperties

public java.util.Map getUserProperties(java.lang.String userId)
                                throws UserStoreException
Returns map of properties associated with given user.

Parameters:
userId - name of the user
Returns:
user properties
Throws:
UserStoreException - when user cannot be found
Since:
4.0
See Also:
PASSWORD_PROPERTY, X509CERTIFICATE_PROPERTY, X509CERTIFICATECHAIN_PROPERTY

getUserProperty

public java.lang.Object getUserProperty(java.lang.String userId,
                                        java.lang.String key)
                                 throws UserStoreException
Returns value of particular user property.

Parameters:
userId - name of the user
key - key of the property to be returned
Returns:
value of the requested property or null when this property has not been set for given user
Throws:
UserStoreException - when user cannot be found
Since:
4.0
See Also:
PASSWORD_PROPERTY, X509CERTIFICATE_PROPERTY, X509CERTIFICATECHAIN_PROPERTY

removeUserProperty

public void removeUserProperty(java.lang.String userId,
                               java.lang.String key)
                        throws UserStoreException
Removes user's property.

Parameters:
userId - name of the user
key - key of the property to be removed
Throws:
UserStoreException - user cannot be found
Since:
4.0
See Also:
PASSWORD_PROPERTY, X509CERTIFICATE_PROPERTY, X509CERTIFICATECHAIN_PROPERTY

setUserProperties

public void setUserProperties(java.lang.String userId,
                              java.util.Map properties)
                       throws UserStoreException
Sets properties to given user. If the user entry does not exist, new user entry is created and properties are set.

Parameters:
userId - name of the user
properties - map of properties to be associated with user
Throws:
UserStoreException - properties cannot be set
Since:
4.0
See Also:
PASSWORD_PROPERTY, X509CERTIFICATE_PROPERTY, X509CERTIFICATECHAIN_PROPERTY

setUserProperty

public void setUserProperty(java.lang.String userId,
                            java.lang.String key,
                            java.lang.Object value)
                     throws UserStoreException
Sets particular property to given user. If the user entry does not yes, new user entry is created and property is set.

Parameters:
userId - name of the user
key - key of the property which value is to be set
value - value of the property to be set
Throws:
UserStoreException - property cannot be set
Since:
4.0
See Also:
PASSWORD_PROPERTY, X509CERTIFICATE_PROPERTY, X509CERTIFICATECHAIN_PROPERTY

getUsers

public UserIterator getUsers()
Returns iterator over all user entries.

Returns:
iterator over all user entries
Since:
4.0

getUsers

public UserIterator getUsers(java.util.Map filter)
Returns iterator over users entries that match given filter.

Given filter contains properties. The property can be either requested to be present, in which case the map should contain only the property key and the associated value must be set to null, or it can be requested that particular property must have certain value, in which case both key and value in the properties map must be set to non-null values. The FILTER_STRING property can be set to filter results according to user identifiers.

Parameters:
filter - the filter for user entries to be returned
Returns:
iterator over matched user entries
Since:
4.0
See Also:
PASSWORD_PROPERTY, X509CERTIFICATE_PROPERTY, X509CERTIFICATECHAIN_PROPERTY

getUserIds

public java.lang.String[] getUserIds()
Returns string array containing all user identifiers, typically user names.

Returns:
user ids

setUserStoreSource

public void setUserStoreSource(UserStoreSource source)
Set the UserStoreSource associated with this object. Every modification is saved by the UserStoreSource.

Parameters:
source - the UserStoreSource associated with this object.

setPropertySerializer

public void setPropertySerializer(java.lang.String propertyKey,
                                  PropertySerializer serializer)
                           throws UserStoreException
Registers the propertySerializer associated with the propertyKey.

Parameters:
propertyKey - a key associated with the serializer
serializer - a serializer associated with the key
Throws:
UserStoreException - serializer is already registered
Since:
4.0

getPropertySerializer

public PropertySerializer getPropertySerializer(java.lang.String propertyKey)
                                         throws UserStoreException
Returns the PropertySerializer associated with the given key.

Parameters:
propertyKey - propertySerializer key
Returns:
the associated PropertySerializer
Throws:
UserStoreException - thrown when propertySerializer doesn't exist.
Since:
4.0

getSupportedAttributes

public java.util.Iterator getSupportedAttributes()
Gets supported attributes for users.

Returns:
string values
Since:
4.0

addNotificationListener

public void addNotificationListener(NotificationListener listener)
Register a listener for the NotificationEvent events.

Parameters:
listener - notification listener to register
See Also:
NotificationEvent

removeNotificationListener

public void removeNotificationListener(NotificationListener listener)
Remove a listener for the NotificationEvent events.

Parameters:
listener - notification listener to deregister
See Also:
NotificationEvent