Interface User
- All Superinterfaces:
Role
- All Known Subinterfaces:
Group
User
role managed by a User Admin service.
In this context, the term "user" is not limited to just human beings. Instead, it refers to any entity that may have any number of credentials associated with it that it may use to authenticate itself.
In general, User
objects are associated with a specific User Admin
service (namely the one that created them), and cannot be used with other
User Admin services.
A User
object may have credentials (and properties, inherited from
the Role
class) associated with it. Specific
UserAdminPermission
objects are required to read or change a
User
object's credentials.
Credentials are Dictionary
objects and have semantics that are
similar to the properties in the Role
class.
- "Consumers of this API must not implement this interface"
-
Field Summary
Fields inherited from interface org.osgi.service.useradmin.Role
GROUP, ROLE, USER, USER_ANYONE
-
Method Summary
Modifier and TypeMethodDescriptionReturns aDictionary
of the credentials of thisUser
object.boolean
hasCredential
(String key, Object value) Checks to see if thisUser
object has a credential with the specifiedkey
set to the specifiedvalue
.Methods inherited from interface org.osgi.service.useradmin.Role
getName, getProperties, getType
-
Method Details
-
getCredentials
Dictionary<String,Object> getCredentials()Returns aDictionary
of the credentials of thisUser
object. Any changes to the returnedDictionary
object will change the credentials of thisUser
object. This will cause aUserAdminEvent
object of typeUserAdminEvent.ROLE_CHANGED
to be broadcast to anyUserAdminListeners
objects.Only objects of type
String
may be used as credential keys, and only objects of typeString
or of typebyte[]
may be used as credential values. Any other types will cause an exception of typeIllegalArgumentException
to be raised.In order to retrieve a credential from the returned
Dictionary
object, aUserAdminPermission
named after the credential name (or a prefix of it) with actiongetCredential
is required.In order to add or remove a credential from the returned
Dictionary
object, aUserAdminPermission
named after the credential name (or a prefix of it) with actionchangeCredential
is required.- Returns:
Dictionary
object containing the credentials of thisUser
object.
-
hasCredential
Checks to see if thisUser
object has a credential with the specifiedkey
set to the specifiedvalue
.If the specified credential
value
is not of typeString
orbyte[]
, it is ignored, that is,false
is returned (as opposed to anIllegalArgumentException
being raised).- Parameters:
key
- The credentialkey
.value
- The credentialvalue
.- Returns:
true
if this user has the specified credential;false
otherwise.- Throws:
SecurityException
- If a security manager exists and the caller does not have theUserAdminPermission
named after the credential key (or a prefix of it) with actiongetCredential
.
-