SailPoint IIQ - Generic Java Native Methods

// Get Oauth-2 client id and secret key base 64 encoded value 
import sailpoint.service.oauth.OAuthClientDTO;
import sailpoint.service.oauth.OAuthClientService;
import java.util.Base64;
import java.util.List;

public String getTokenValue(SailPointContext context, String clientName) {
OAuthClientService oAuthClientService = new OAuthClientService(context);
List<OAuthClientDTO> OAuthClientDTOList = oAuthClientService.getClientDTOs();
log.info("OAuthClientDTOList - " + OAuthClientDTOList);
String base64TokenKey = "";
if(null != OAuthClientDTOList) {
for(OAuthClientDTO obj : OAuthClientDTOList) {
if(clientName.equalsIgnoreCase(obj.getName())) {
log.info("dto.getClientId() - " + obj.getClientId());
log.info("dto.getSecret() - " + obj.getSecret());
base64TokenKey = "Basic " + Base64.getEncoder().encodeToString((obj.getClientId() + ":" + obj.getSecret()).getBytes());
log.info("base64TokenKey - " + base64TokenKey);
}
}
}    
return base64TokenKey;
}


// Example to use ObjectUtil generic class to get identity and workgroup information - OOTB 
Utility class providing methods to load and analyze SailPointObject subclasses.

Identity idm = ObjectUtil.getIdentityOrWorkgroup(context, workGroupName);
myLogs.info("getIdentityOrWorkgroup(): " + idm);

List<String> listMembers = new ArrayList<>();
// Properties name (Columns/Attribute name) values
List<String> properties = Arrays.asList(Constants.NAME);
Iterator<Object[]> objIterator = ObjectUtil.getWorkgroupMembers(context, idm, properties);
LOGGER.info("objIterator getWorkgroupMembers() : " + objIterator);
// Iterate through the iterator and add each element to the list
while (objIterator.hasNext()) {
Object[] element = objIterator.next();
if(null!=element) {
listMembers.add((String) element[0]);
}
}
myLogs.info("my list of Members : " + listMembers);









Comments

Popular posts from this blog

SailPoint IIQ - Installation Steps

NIST (National Institute of Standards and Technology) Controls

SailPoint IIQ - Database Tables