org.apache.felix.useradmin.impl
Class UserImpl

java.lang.Object
  extended by org.apache.felix.useradmin.impl.RoleImpl
      extended by org.apache.felix.useradmin.impl.UserImpl
All Implemented Interfaces:
Serializable, Version, Role, User
Direct Known Subclasses:
GroupImpl

public class UserImpl
extends RoleImpl
implements User

This UserImplclass represents User role. A User can be configured with credentials, password,properties etc.

Version:
$Rev$ $Date$
See Also:
Role, User, Serialized Form

Field Summary
 
Fields inherited from class org.apache.felix.useradmin.impl.RoleImpl
name, userAdmin
 
Fields inherited from interface org.osgi.service.useradmin.Role
GROUP, ROLE, USER, USER_ANYONE
 
Constructor Summary
UserImpl()
          Constructs new User.
 
Method Summary
 Dictionary getCredentials()
          Returns a Dictionary of the credentials of this User object.
 int getType()
          Returns the type of this role.
 boolean hasCredential(String key, Object value)
          Checks to see if this User object has a credential with the specified key set to the specified value.
protected  boolean impliedBy(AuthorizationImpl authorization)
          Checks if this role is implied by provided Authorization object.
 
Methods inherited from class org.apache.felix.useradmin.impl.RoleImpl
getName, getProperties, getVersion, increaseVersion, setName, setUserAdmin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.osgi.service.useradmin.Role
getName, getProperties
 

Constructor Detail

UserImpl

public UserImpl()
Constructs new User.

Method Detail

getCredentials

public Dictionary getCredentials()
Description copied from interface: User
Returns a Dictionary of the credentials of this User object. Any changes to the returned Dictionary object will change the credentials of this User object. This will cause a UserAdminEvent object of type UserAdminEvent.ROLE_CHANGED to be broadcast to any UserAdminListeners objects.

Only objects of type String may be used as credential keys, and only objects of type String or of type byte[] may be used as credential values. Any other types will cause an exception of type IllegalArgumentException to be raised.

In order to retrieve a credential from the returned Dictionary object, a UserAdminPermission named after the credential name (or a prefix of it) with action getCredential is required.

In order to add or remove a credential from the returned Dictionary object, a UserAdminPermission named after the credential name (or a prefix of it) with action changeCredential is required.

Specified by:
getCredentials in interface User
Returns:
Dictionary object containing the credentials of this User object.
See Also:
User.getCredentials()

hasCredential

public boolean hasCredential(String key,
                             Object value)
Description copied from interface: User
Checks to see if this User object has a credential with the specified key set to the specified value.

If the specified credential value is not of type String or byte[], it is ignored, that is, false is returned (as opposed to an IllegalArgumentException being raised).

Specified by:
hasCredential in interface User
Parameters:
key - The credential key.
value - The credential value.
Returns:
true if this user has the specified credential; false otherwise.
See Also:
User.hasCredential(String, Object)

getType

public int getType()
Description copied from interface: Role
Returns the type of this role.

Specified by:
getType in interface Role
Overrides:
getType in class RoleImpl
Returns:
The role's type.
See Also:
Role.getType()

impliedBy

protected boolean impliedBy(AuthorizationImpl authorization)
Checks if this role is implied by provided Authorization object.

Overrides:
impliedBy in class RoleImpl
Parameters:
authorization - Authorization instance.
Returns:
true if is implied false if not.
See Also:
org.osgi.service.useradmin.Autorization


Copyright © 2011 Apache Software Foundation. All Rights Reserved.