Additional top-level class in compilation unit: UserAdminPermissionCollection.
Role objects managed by a User
Admin service.
This class represents access to the Role objects managed by a User
Admin service and their properties and credentials (in the case of
User objects).
The permission name is the name (or name prefix) of a property or credential. The naming convention follows the hierarchical property naming convention. Also, an asterisk may appear at the end of the name, following a ".", or by itself, to signify a wildcard match. For example: "org.osgi.security.protocol.*" or "*" is valid, but "*protocol" or "a*b" are not valid.
The UserAdminPermission with the reserved name "admin"
represents the permission required for creating and removing Role
objects in the User Admin service, as well as adding and removing members in
a Group object. This UserAdminPermission does not have any
actions associated with it.
The actions to be granted are passed to the constructor in a string
containing a list of one or more comma-separated keywords. The possible
keywords are: changeProperty,changeCredential, and
getCredential. Their meaning is defined as follows:
action
changeProperty Permission to change (i.e., add and remove)
Role object properties whose names start with
the name argument specified in the constructor.
changeCredential Permission to change (i.e., add and remove)
User object credentials whose names start
with the name argument specified in the constructor.
getCredential Permission to retrieve and check for the
existence of User object credentials whose names
start with the name argument specified in the
constructor.
The action string is converted to lowercase before processing.
Following is a PermissionInfo style policy entry which grants a user
administration bundle a number of UserAdminPermission object:
(org.osgi.service.useradmin.UserAdminPermission "admin")
(org.osgi.service.useradmin.UserAdminPermission "com.foo.*"
"changeProperty,getCredential,changeCredential")
(org.osgi.service.useradmin.UserAdminPermission "user.*"
"changeProperty,changeCredential")
The first permission statement grants the bundle the permission to perform
any User Admin service operations of type "admin", that is, create and remove
roles and configure Group objects.
The second permission statement grants the bundle the permission to change
any properties as well as get and change any credentials whose names start
with com.foo..
The third permission statement grants the bundle the permission to change any
properties and credentials whose names start with user.. This means
that the bundle is allowed to change, but not retrieve any credentials with
the given prefix.
The following policy entry empowers the Http Service bundle to perform user authentication:
grant codeBase "${jars}http.jar" {
permission org.osgi.service.useradmin.UserAdminPermission
"user.password", "getCredential";
};
The permission statement grants the Http Service bundle the permission to validate any password credentials (for authentication purposes), but the bundle is not allowed to change any properties or credentials.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | ACTION_ALL
All actions |
| private static final int | |
| private static final int | |
| private static final int | |
| private transient int | action_mask
The actions mask. |
| pack-priv static final int | ACTION_NONE
No actions. |
| private volatile String | actions
The actions in canonical form. |
| public static final String | ADMIN
The permission name "admin". |
| public static final String | CHANGE_CREDENTIAL
The action string "changeCredential". |
| public static final String | CHANGE_PROPERTY
The action string "changeProperty". |
| public static final String | GET_CREDENTIAL
The action string "getCredential". |
| pack-priv static final long |
| Access | Constructor and Description |
|---|---|
| public | UserAdminPermission(String
the name of this name, String UserAdminPermissionthe action string. actions)Creates a new |
| pack-priv | UserAdminPermission(String
class name name, int action mask mask)Package private constructor used by |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if obj is a UserAdminPermission
object, and has the same name and actions as this
UserAdminPermission object.the object to be compared for equality with this object. obj)Overrides java. Checks two |
| public String | Returns: the canonical string representation of the actions.Overrides java. Returns the canonical string representation of the actions, separated by comma. |
| pack-priv synchronized int | |
| public int | Returns: A hash code value for this object.Overrides java. Returns the hash code value for this object. |
| public boolean | Returns: true if the specified permission is implied by this
object; false otherwise.the permission to check against. p)Overrides java. Checks if this |
| private static boolean | |
| private static boolean | |
| private static boolean | |
| private static boolean | |
| public PermissionCollection | Returns: a newPermissionCollection object suitable for storing
UserAdminPermission objects.Overrides java. Returns a new |
| private static int | Returns: action mask.Action string. actions)Parse action string into action mask. |
| private synchronized void | readObject(ObjectInputStream
the s)ObjectInputStream from which data is readHides java.
|
| private synchronized void | |
| public String | Returns: ThePermissionInfo encoded string for this
UserAdminPermission object.Overrides java. Returns a string describing this |
| private synchronized void | writeObject(ObjectOutputStream s)
writeObject is called to save the state of this object to a stream. |
| ACTION_ALL | back to summary |
|---|---|
| private static final int ACTION_ALL All actions | |
| ACTION_CHANGE_CREDENTIAL | back to summary |
|---|---|
| private static final int ACTION_CHANGE_CREDENTIAL | |
| ACTION_CHANGE_PROPERTY | back to summary |
|---|---|
| private static final int ACTION_CHANGE_PROPERTY | |
| ACTION_GET_CREDENTIAL | back to summary |
|---|---|
| private static final int ACTION_GET_CREDENTIAL | |
| action_mask | back to summary |
|---|---|
| private transient int action_mask The actions mask. | |
| ACTION_NONE | back to summary |
|---|---|
| pack-priv static final int ACTION_NONE No actions. | |
| actions | back to summary |
|---|---|
| private volatile String actions The actions in canonical form. | |
| ADMIN | back to summary |
|---|---|
| public static final String ADMIN The permission name "admin". | |
| CHANGE_CREDENTIAL | back to summary |
|---|---|
| public static final String CHANGE_CREDENTIAL The action string "changeCredential". | |
| CHANGE_PROPERTY | back to summary |
|---|---|
| public static final String CHANGE_PROPERTY The action string "changeProperty". | |
| GET_CREDENTIAL | back to summary |
|---|---|
| public static final String GET_CREDENTIAL The action string "getCredential". | |
| serialVersionUID | back to summary |
|---|---|
| pack-priv static final long serialVersionUID | |
| UserAdminPermission | back to summary |
|---|---|
| public UserAdminPermission(String name, String actions) Creates a new
| |
| UserAdminPermission | back to summary |
|---|---|
| pack-priv UserAdminPermission(String name, int mask) Package private constructor used by
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Checks two | |
| getActions | back to summary |
|---|---|
| public String getActions() Overrides java. Returns the canonical string representation of the actions, separated by comma. | |
| getActionsMask | back to summary |
|---|---|
| pack-priv synchronized int getActionsMask() Returns the current action mask. Used by the UserAdminPermissionCollection class.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns the hash code value for this object.
| |
| implies | back to summary |
|---|---|
| public boolean implies(Permission p) Overrides java. Checks if this
More specifically, this method returns
| |
| match_change | back to summary |
|---|---|
| private static boolean match_change(char[] a, int i) | |
| match_credential | back to summary |
|---|---|
| private static boolean match_credential(char[] a, int i) | |
| match_get | back to summary |
|---|---|
| private static boolean match_get(char[] a, int i) | |
| match_property | back to summary |
|---|---|
| private static boolean match_property(char[] a, int i) | |
| newPermissionCollection | back to summary |
|---|---|
| public PermissionCollection newPermissionCollection() Overrides java. Returns a new
| |
| parseActions | back to summary |
|---|---|
| private static int parseActions(String actions) Parse action string into action mask.
| |
| readObject | back to summary |
|---|---|
| private synchronized void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException Hides java. Doc from java.
| |
| setTransients | back to summary |
|---|---|
| private synchronized void setTransients(int mask) Called by constructors and when deserialized.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string describing this | |
| writeObject | back to summary |
|---|---|
| private synchronized void writeObject(ObjectOutputStream s) throws IOException writeObject is called to save the state of this object to a stream. The actions are serialized, and the superclass takes care of the name. | |