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 aDictionaryof the credentials of thisUserobject.booleanhasCredential(String key, Object value) Checks to see if thisUserobject has a credential with the specifiedkeyset to the specifiedvalue.Methods inherited from interface org.osgi.service.useradmin.Role
getName, getProperties, getType
-
Method Details
-
getCredentials
Dictionary<String,Object> getCredentials()Returns aDictionaryof the credentials of thisUserobject. Any changes to the returnedDictionaryobject will change the credentials of thisUserobject. This will cause aUserAdminEventobject of typeUserAdminEvent.ROLE_CHANGEDto be broadcast to anyUserAdminListenersobjects.Only objects of type
Stringmay be used as credential keys, and only objects of typeStringor of typebyte[]may be used as credential values. Any other types will cause an exception of typeIllegalArgumentExceptionto be raised.In order to retrieve a credential from the returned
Dictionaryobject, aUserAdminPermissionnamed after the credential name (or a prefix of it) with actiongetCredentialis required.In order to add or remove a credential from the returned
Dictionaryobject, aUserAdminPermissionnamed after the credential name (or a prefix of it) with actionchangeCredentialis required.- Returns:
Dictionaryobject containing the credentials of thisUserobject.
-
hasCredential
Checks to see if thisUserobject has a credential with the specifiedkeyset to the specifiedvalue.If the specified credential
valueis not of typeStringorbyte[], it is ignored, that is,falseis returned (as opposed to anIllegalArgumentExceptionbeing raised).- Parameters:
key- The credentialkey.value- The credentialvalue.- Returns:
trueif this user has the specified credential;falseotherwise.- Throws:
SecurityException- If a security manager exists and the caller does not have theUserAdminPermissionnamed after the credential key (or a prefix of it) with actiongetCredential.
-