Interface User
-
- All Superinterfaces:
Role
- All Known Subinterfaces:
Group
public interface User extends Role
AUser
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 theRole
class) associated with it. SpecificUserAdminPermission
objects are required to read or change aUser
object's credentials.Credentials are
Dictionary
objects and have semantics that are similar to the properties in theRole
class.
-
-
Field Summary
-
Fields inherited from interface org.osgi.service.useradmin.Role
GROUP, ROLE, USER, USER_ANYONE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Dictionary<java.lang.String,java.lang.Object>
getCredentials()
Returns aDictionary
of the credentials of thisUser
object.boolean
hasCredential(java.lang.String key, java.lang.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 Detail
-
getCredentials
java.util.Dictionary<java.lang.String,java.lang.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
boolean hasCredential(java.lang.String key, java.lang.Object value)
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:
java.lang.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
.
-
-