Security Framework Guide

Security Framework Guide

Security Client Interface APIs

Security Client Interface APIs

The security framework exposes a set of APIs for a client application through the Security Client Interface, which is the main client interface to build security around the client application's data model. Use the APIs to perform the authentication, authorization, and provisioning tasks.
MDM Registry Edition does not have a provisioning interface or an administration interface.

Authentication and Authorization APIs

The following table describes the authentication and authorization APIs that the Security Client Interface exposes:
API
Description
Return Type
login
login (String userId, String password) throws SecurityClientException
Performs a login attempt for a user.
byte[]
logout
logout (byte[] sessionId) throws SecurityClientException
Logs out a user and invalidates and removes the associated session.
void
isPermitted
isPermitted (byte[] sessionToken, String resourceId, String privilegeId) throws SecurityClientException
Returns true if the user is permitted to perform the action specified by the provided privilege against the provided resource.
boolean
isPermittedAll
isPermittedAll (byte[] sessionToken, String resourceId, String...privilegeId) throws SecurityClientException
Returns true if the user is permitted to perform the actions specified by the provided privileges against the provided resource.
boolean
isPermittedAll
isPermittedAll (byte[] sessionToken, String resourceId, Set< String > privilegeIds) throws SecurityClientException
Returns true if the user is permitted to perform the actions specified by the provided privileges against the provided resource.
boolean
hasRole
hasRole (byte[] sessionToken, String roleId) throws SecurityClientException
Returns true if the user has the provided role.
boolean

Provisioning APIs

The following table describes the provisioning APIs that the Security Client Interface exposes:
API
Description
Return Type
addOrUpdateResource
addOrUpdateResource (byte[] sessionToken, String resourceId, Properties resourceProperties) throws SecurityClientException
Add a new resource to the resource collection or update an existing resource.
void
remove Resource
remove Resource (byte[] sessionToken, String resourceId) throws SecurityClientException
Removes resources from the resource collection.
void
getAllResources
getAllResources (byte[] sessionToken) throws SecurityClientException
Get all the resources IDs accessible from this session.
Set< String >
getResourceProperties
getResourceProperties (byte[] sessionToken, String resourceId) throws SecurityClientException
Return the resource properties.
Properties
addOrUpdatePrivilege
addOrUpdatePrivilege (byte[] sessionToken, String privilegeId, Properties privilegeProperties) throws SecurityClientException
Add a new privilege or update an existing one.
void
removePrivilege
removePrivilege (byte[] sessionToken, String privilegeId) throws SecurityClientException
Remove the privilege from the privileges collection.
void
getAllPrivileges
getAllPrivileges (byte[] sessionToken) throws SecurityClientException
Return a collection of privileges granted to the user on the specified resource.
Set< String >
getPrivilegeProperties
getPrivilegeProperties (byte[] sessionToken, String privilegeId) throws SecurityClientException
Return the privilege properties.
Properties
addOrUpdateUser
addOrUpdateUser (byte[] sessionToken, String userId, Properties userProperties) throws SecurityClientException
Add a new user or update an existing one.
void
removeUser
removeUser (byte[] sessionToken, String userId) throws SecurityClientException
Remove the user from the users collection.
void
getAllUsers
getAllUsers (byte[] sessionToken) throws SecurityClientException
Get all the user IDs accessible from this session.
Set< String >
getUserProperties
getUserProperties (byte[] sessionToken, String userId) throws SecurityClientException
Return the user properties.
Properties
addOrUpdateRole
addOrUpdateRole (byte[] sessionToken, String roleId, Properties roleProperties) throws SecurityClientException
Add a new role or update an existing one.
void
removeRole
removeRole (byte[] sessionToken, String roleId) throws SecurityClientException
Remove the role from the roles collection.
void
getAllRoles
getAllRoles (byte[] sessionToken) throws SecurityClientException
Get all the role IDs accessible from this session.
Set< String >
getRoleProperties
getRoleProperties (byte[] sessionToken, String roleId) throws SecurityClientException
Return the role properties.
Properties
addOrUpdatePermission
addOrUpdatePermission (byte[] sessionToken, String permissionId, String resourceId, Set< String > privilegeId, Properties permissionProperties) throws SecurityClientException
Add a new permission or update an existing one.
void
removePermission
removePermission (byte[] sessionToken, String permissionId) throws SecurityClientException
Remove the permission from the permissions collection.
void
getAllPermission
getAllPermissions (byte[] sessionToken) throws SecurityClientException
Get all the permission IDs accessible from this session.
Set< String >
getPermissionProperties
getPermissionProperties (byte[] sessionToken, String permissionId) throws SecurityClientException
Return the permission properties.
Properties
getPermissionResourceId
getPermissionResourceId (byte[] sessionToken, String permissionId) throws SecurityClientException
Return the permission resource ID.
String
getPermissionPrivilegesIds
getPermissionPrivilegesIds (byte[] sessionToken, String permissionId) throws SecurityClientException
Return the permission privileges IDs.
Set< String >
getRolePermissionsIds
getRolePermissionsIds (byte[] sessionToken, String roleId) throws SecurityClientException
Return the role permissions IDs.
Set< String >
getPermissionRoleIds
getPermissionRoleIds (byte[] sessionToken, String permissionId) throws SecurityClientException
Return the role IDs of permission.
Set< String >
assignPermissionToRole
assignPermissionToRole (byte[] sessionToken, String permissionId, String roleId) throws SecurityClientException
Assign permission to role.
void
revokePermissionFromRole
revokePermissionFromRole (byte[] sessionToken, String permissionId, String roleId) throws SecurityClientException
Revoke permission from role.
void
assignRoleToUser
assignRoleToUser (byte[] sessionToken, String roleId, String userId) throws SecurityClientException
Assign a role to a user.
void
revokeRoleFromUser
revokeRoleFromUser (byte[] sessionToken, String roleId, String userId) throws SecurityClientException
Revoke a role from an user.
void
getAllUserRoles
getAllUserRoles (byte[] sessionToken, String userId) throws SecurityClientException
Return a collection of roles IDs assign to user.
Set< String >
getAllUsersWithRole
getAllUsersWithRole (byte[] sessionToken, String roleId) throws SecurityClientException
Return a collection of users IDs within role.
Set< String >
addOrUpdateUsersGroup
addOrUpdateUsersGroup (byte[] sessionToken, String usersGroupId, Properties usersGroupProperties) throws SecurityClientException
Add a new users group or update an existing one.
void
removeUsersGroup
removeUsersGroup (byte[] sessionToken, String usersGroupId) throws SecurityClientException
Remove the users group from the users group collection.
void
getAllUsersGroups
getAllUsersGroups (byte[] sessionToken) throws SecurityClientException
Get all the users group IDs accessible from this session.
Set< String >
getUsersGroupProperties
getUsersGroupProperties (byte[] sessionToken, String usersGroupId) throws SecurityClientException
Return the users group properties.
Properties
addUserToUserGroup
addUserToUserGroup (byte[] sessionToken, String usersGroupId, String userId) throws SecurityClientException
Add a user to a users group.
void
removeUserFromUserGroup
removeUserFromUserGroup (byte[] sessionToken, String usersGroupId, String userId) throws SecurityClientException
Remove a user from a users group.
void
getUsersFromUsersGroup
getUsersFromUsersGroup (byte[] sessionToken, String usersGroupId) throws SecurityClientException
Get users IDs associated with the users group.
Set< String >
getUserGroupsForUser
getUserGroupsForUser (byte[] sessionToken, String usersId) throws SecurityClientException
Get users groups IDs for the user.
Set< String >

0 COMMENTS

We’d like to hear from you!