-
Grant privileges to your DRM enabler class by adding a new entry in the following properties file:
<server_install_dir>/<os>/reffiles/SMAExeConfig/SMAExePrivileged.properties Add a line that includes the fully qualified class name of your custom DRM enabler class, as follows: Fully_qualified_enabler_class_name=OS For example: com.mycompany.drm.enabler.MyDRMEnabler=OS -
Get the
DRMCommandRunner object from IDRMDataWrapper :
DRMCommandRunner commandRunner = drmDatawrapper.getCommandRunner(); -
Use the API shown below to access operating system user credentials in your DRM enabler class.
Use the method getDRMResourceCredentialForOS to access the credentials. /**
* Retrieve the Resource Credential Service associated with the specified job and resource name from OS.
* This method provides secure access to credentials service for only those classes that are authorized
* <p>
* <p>
* The credential service returned will remain encrypted with the servers public key.
* <p>
* This method will return null if the specified resource credential service is not available.
*
* @param jobId identifies the job with which the requested credentials should be associated.
* @param resourceName identifies the name of protected resource for which to retrieve credentials.
* @param object identifies the enabler class instance
* @return the map contains these keys 'user','password' or null in case of exception
For example:
byte[] user = credMap.get("user");
String decryptedUser = new String(user);
byte[] password = credMap.get("password");
String decryptedPassword = new String(password);
*/
getDRMResourceCredentialForOS(String jobId, String resourceName, Object instance)
//To access OS (run-as) user credentials
try {
Map<String, byte[]> credMap = drmDataWrapper.getCommandRunner().getDRMResourceCredentialForOS(drmDataWrapper.getJobID(),this.getClass().getCanonicalName(),this);
// get individual credentials from the map
byte[] user = credMap.get("user");
String decryptedUser = new String(user);
byte[] password = credMap.get("password");
String decryptedPasswrod = new String(password);
} catch (Exception e) {e.printStackTrace();}
|