@Test(enabled = true, dependsOnMethods = { "testCreateGroup" }) public void testCreateUser() { Uid expResult = new Uid("AAA0001"); Set<Attribute> attributes = sampleUser(expResult.getUidValue()); OperationOptions oo = null; Uid result = facade.create(ObjectClass.ACCOUNT, attributes, oo); Assert.assertEquals(expResult, result); }
public Uid create(final ObjectClass objClass, final Set<Attribute> attributes, final OperationOptions options) { final String method = "create"; LOG.info("Entry {0}", method); Uid uid = null; Map<String, Attribute> attrMap = new HashMap<String, Attribute>(AttributeUtil.toMap(attributes)); Name name = AttributeUtil.getNameFromAttributes(attributes); LOG.info("create({0},{1})", objClass.getObjectClassValue(), name.getNameValue()); String description = null; if (null != attrMap.get(PredefinedAttributes.DESCRIPTION)) { description = AttributeUtil.getStringValue(attrMap.get(PredefinedAttributes.DESCRIPTION)); } boolean importFromRegistry = false; if (null != attrMap.get(ATTR_IMPORT_FROM_REGISTRY)) { importFromRegistry = AttributeUtil.getBooleanValue(attrMap.get(ATTR_IMPORT_FROM_REGISTRY)); } String registryName = null; if (null != attrMap.get(ATTR_REGISTRY_NAME)) { registryName = AttributeUtil.getStringValue(attrMap.get(ATTR_REGISTRY_NAME)); } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { String firstName = null; if (null != attrMap.get(ATTR_FIRST_NAME)) { firstName = AttributeUtil.getStringValue(attrMap.get(ATTR_FIRST_NAME)); } String lastName = null; if (null != attrMap.get(ATTR_LAST_NAME)) { lastName = AttributeUtil.getStringValue(attrMap.get(ATTR_LAST_NAME)); } GuardedString password = AttributeUtil.getPasswordValue(attributes); if (password == null) { throw new IllegalArgumentException("Missing Password value"); } GuardedStringAccessor accessor = new GuardedStringAccessor(); password.access(accessor); boolean ssoUser = false; if (null != attrMap.get(ATTR_SSO_USER)) { ssoUser = AttributeUtil.getBooleanValue(attrMap.get(ATTR_SSO_USER)); } boolean pwdPolicy = true; if (null != attrMap.get(ATTR_PASSWORD_POLICY)) { pwdPolicy = AttributeUtil.getBooleanValue(attrMap.get(ATTR_PASSWORD_POLICY)); } boolean isValid = true; Boolean expirePassword = null; if (null != attrMap.get(OperationalAttributes.ENABLE_NAME)) { expirePassword = AttributeUtil.getBooleanValue(attrMap .get(OperationalAttributes.ENABLE_NAME)); isValid = expirePassword; } ArrayList groupList = new ArrayList(); if (null != attrMap.get(PredefinedAttributes.GROUPS_NAME)) { groupList = new ArrayList(attrMap.get(PredefinedAttributes.GROUPS_NAME).getValue()); } Attribute webCredList = null; if (null != attrMap.get(ATTR_GSO_WEB_CREDENTIALS)) { webCredList = attrMap.get(ATTR_GSO_WEB_CREDENTIALS); } Attribute groupCredList = null; if (null != attrMap.get(ATTR_GSO_GROUP_CREDENTIALS)) { groupCredList = attrMap.get(ATTR_GSO_GROUP_CREDENTIALS); } try { PDRgyUserName pdRgyUserName = new PDRgyUserName(registryName, firstName, lastName); PDMessages msgs = new PDMessages(); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDUser.importUser(ctxt,{0},{1},null,{2},msgs)", name .getNameValue(), pdRgyUserName, ssoUser); } PDUser.importUser(ctxt, name.getNameValue(), pdRgyUserName, null, ssoUser, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (groupList != null) { updateTAMGroups(groupList, name.getNameValue(), msgs); } } else { if (LOG.isInfo()) { LOG.info("PDUser.createUser(ctxt,{0},{1},null,Passw0rd,{2},{3},{4},msgs)", name.getNameValue(), pdRgyUserName, groupList, ssoUser, pwdPolicy); } PDUser.createUser(ctxt, name.getNameValue(), pdRgyUserName, null, accessor .getArray(), groupList, ssoUser, pwdPolicy, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDUser.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } if (LOG.isInfo()) { LOG.info("Calling PDUser.setAccountValid(ctxt,{0},true,msgs)", name .getNameValue()); } PDUser.setAccountValid(ctxt, name.getNameValue(), true, msgs); processMessages(method, msgs); if (expirePassword != null) { if (LOG.isInfo()) { LOG.info("PDUser.setPasswordValid(ctxt,{0},{1},msgs)", name.getNameValue(), isValid); } PDUser.setPasswordValid(ctxt, name.getNameValue(), isValid, msgs); processMessages(method, msgs); } if (webCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCE, webCredList, msgs); } if (groupCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCEGROUP, groupCredList, msgs); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { PDMessages msgs = new PDMessages(); PDRgyGroupName pdRgyGroupName = new PDRgyGroupName(registryName); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDGroup.importGroup(ctxt,{0},{1},{2},msgs", name.getNameValue(), pdRgyGroupName, description); } PDGroup.importGroup(ctxt, name.getNameValue(), pdRgyGroupName, description, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); } else { if (LOG.isInfo()) { LOG.info("PDGroup.createGroup(ctxt,{0},{1},{2},null,msgs", name .getNameValue(), pdRgyGroupName, description); } PDGroup.createGroup(ctxt, name.getNameValue(), pdRgyGroupName, null, null, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDGroup.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else { LOG.error("Failed to create: Unsupported objectClass={0}, id={1}", objClass, uid); } LOG.info("Exit {0}", method); return uid; }
TAMConnector implements PoolableConnector, AuthenticateOp, CreateOp, SchemaOp, TestOp,
        DeleteOp, UpdateOp, SearchOp<String> { public Uid create(final ObjectClass objClass, final Set<Attribute> attributes, final OperationOptions options) { final String method = "create"; LOG.info("Entry {0}", method); Uid uid = null; Map<String, Attribute> attrMap = new HashMap<String, Attribute>(AttributeUtil.toMap(attributes)); Name name = AttributeUtil.getNameFromAttributes(attributes); LOG.info("create({0},{1})", objClass.getObjectClassValue(), name.getNameValue()); String description = null; if (null != attrMap.get(PredefinedAttributes.DESCRIPTION)) { description = AttributeUtil.getStringValue(attrMap.get(PredefinedAttributes.DESCRIPTION)); } boolean importFromRegistry = false; if (null != attrMap.get(ATTR_IMPORT_FROM_REGISTRY)) { importFromRegistry = AttributeUtil.getBooleanValue(attrMap.get(ATTR_IMPORT_FROM_REGISTRY)); } String registryName = null; if (null != attrMap.get(ATTR_REGISTRY_NAME)) { registryName = AttributeUtil.getStringValue(attrMap.get(ATTR_REGISTRY_NAME)); } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { String firstName = null; if (null != attrMap.get(ATTR_FIRST_NAME)) { firstName = AttributeUtil.getStringValue(attrMap.get(ATTR_FIRST_NAME)); } String lastName = null; if (null != attrMap.get(ATTR_LAST_NAME)) { lastName = AttributeUtil.getStringValue(attrMap.get(ATTR_LAST_NAME)); } GuardedString password = AttributeUtil.getPasswordValue(attributes); if (password == null) { throw new IllegalArgumentException("Missing Password value"); } GuardedStringAccessor accessor = new GuardedStringAccessor(); password.access(accessor); boolean ssoUser = false; if (null != attrMap.get(ATTR_SSO_USER)) { ssoUser = AttributeUtil.getBooleanValue(attrMap.get(ATTR_SSO_USER)); } boolean pwdPolicy = true; if (null != attrMap.get(ATTR_PASSWORD_POLICY)) { pwdPolicy = AttributeUtil.getBooleanValue(attrMap.get(ATTR_PASSWORD_POLICY)); } boolean isValid = true; Boolean expirePassword = null; if (null != attrMap.get(OperationalAttributes.ENABLE_NAME)) { expirePassword = AttributeUtil.getBooleanValue(attrMap .get(OperationalAttributes.ENABLE_NAME)); isValid = expirePassword; } ArrayList groupList = new ArrayList(); if (null != attrMap.get(PredefinedAttributes.GROUPS_NAME)) { groupList = new ArrayList(attrMap.get(PredefinedAttributes.GROUPS_NAME).getValue()); } Attribute webCredList = null; if (null != attrMap.get(ATTR_GSO_WEB_CREDENTIALS)) { webCredList = attrMap.get(ATTR_GSO_WEB_CREDENTIALS); } Attribute groupCredList = null; if (null != attrMap.get(ATTR_GSO_GROUP_CREDENTIALS)) { groupCredList = attrMap.get(ATTR_GSO_GROUP_CREDENTIALS); } try { PDRgyUserName pdRgyUserName = new PDRgyUserName(registryName, firstName, lastName); PDMessages msgs = new PDMessages(); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDUser.importUser(ctxt,{0},{1},null,{2},msgs)", name .getNameValue(), pdRgyUserName, ssoUser); } PDUser.importUser(ctxt, name.getNameValue(), pdRgyUserName, null, ssoUser, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (groupList != null) { updateTAMGroups(groupList, name.getNameValue(), msgs); } } else { if (LOG.isInfo()) { LOG.info("PDUser.createUser(ctxt,{0},{1},null,Passw0rd,{2},{3},{4},msgs)", name.getNameValue(), pdRgyUserName, groupList, ssoUser, pwdPolicy); } PDUser.createUser(ctxt, name.getNameValue(), pdRgyUserName, null, accessor .getArray(), groupList, ssoUser, pwdPolicy, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDUser.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } if (LOG.isInfo()) { LOG.info("Calling PDUser.setAccountValid(ctxt,{0},true,msgs)", name .getNameValue()); } PDUser.setAccountValid(ctxt, name.getNameValue(), true, msgs); processMessages(method, msgs); if (expirePassword != null) { if (LOG.isInfo()) { LOG.info("PDUser.setPasswordValid(ctxt,{0},{1},msgs)", name.getNameValue(), isValid); } PDUser.setPasswordValid(ctxt, name.getNameValue(), isValid, msgs); processMessages(method, msgs); } if (webCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCE, webCredList, msgs); } if (groupCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCEGROUP, groupCredList, msgs); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { PDMessages msgs = new PDMessages(); PDRgyGroupName pdRgyGroupName = new PDRgyGroupName(registryName); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDGroup.importGroup(ctxt,{0},{1},{2},msgs", name.getNameValue(), pdRgyGroupName, description); } PDGroup.importGroup(ctxt, name.getNameValue(), pdRgyGroupName, description, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); } else { if (LOG.isInfo()) { LOG.info("PDGroup.createGroup(ctxt,{0},{1},{2},null,msgs", name .getNameValue(), pdRgyGroupName, description); } PDGroup.createGroup(ctxt, name.getNameValue(), pdRgyGroupName, null, null, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDGroup.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else { LOG.error("Failed to create: Unsupported objectClass={0}, id={1}", objClass, uid); } LOG.info("Exit {0}", method); return uid; } }
TAMConnector implements PoolableConnector, AuthenticateOp, CreateOp, SchemaOp, TestOp,
        DeleteOp, UpdateOp, SearchOp<String> { public Uid create(final ObjectClass objClass, final Set<Attribute> attributes, final OperationOptions options) { final String method = "create"; LOG.info("Entry {0}", method); Uid uid = null; Map<String, Attribute> attrMap = new HashMap<String, Attribute>(AttributeUtil.toMap(attributes)); Name name = AttributeUtil.getNameFromAttributes(attributes); LOG.info("create({0},{1})", objClass.getObjectClassValue(), name.getNameValue()); String description = null; if (null != attrMap.get(PredefinedAttributes.DESCRIPTION)) { description = AttributeUtil.getStringValue(attrMap.get(PredefinedAttributes.DESCRIPTION)); } boolean importFromRegistry = false; if (null != attrMap.get(ATTR_IMPORT_FROM_REGISTRY)) { importFromRegistry = AttributeUtil.getBooleanValue(attrMap.get(ATTR_IMPORT_FROM_REGISTRY)); } String registryName = null; if (null != attrMap.get(ATTR_REGISTRY_NAME)) { registryName = AttributeUtil.getStringValue(attrMap.get(ATTR_REGISTRY_NAME)); } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { String firstName = null; if (null != attrMap.get(ATTR_FIRST_NAME)) { firstName = AttributeUtil.getStringValue(attrMap.get(ATTR_FIRST_NAME)); } String lastName = null; if (null != attrMap.get(ATTR_LAST_NAME)) { lastName = AttributeUtil.getStringValue(attrMap.get(ATTR_LAST_NAME)); } GuardedString password = AttributeUtil.getPasswordValue(attributes); if (password == null) { throw new IllegalArgumentException("Missing Password value"); } GuardedStringAccessor accessor = new GuardedStringAccessor(); password.access(accessor); boolean ssoUser = false; if (null != attrMap.get(ATTR_SSO_USER)) { ssoUser = AttributeUtil.getBooleanValue(attrMap.get(ATTR_SSO_USER)); } boolean pwdPolicy = true; if (null != attrMap.get(ATTR_PASSWORD_POLICY)) { pwdPolicy = AttributeUtil.getBooleanValue(attrMap.get(ATTR_PASSWORD_POLICY)); } boolean isValid = true; Boolean expirePassword = null; if (null != attrMap.get(OperationalAttributes.ENABLE_NAME)) { expirePassword = AttributeUtil.getBooleanValue(attrMap .get(OperationalAttributes.ENABLE_NAME)); isValid = expirePassword; } ArrayList groupList = new ArrayList(); if (null != attrMap.get(PredefinedAttributes.GROUPS_NAME)) { groupList = new ArrayList(attrMap.get(PredefinedAttributes.GROUPS_NAME).getValue()); } Attribute webCredList = null; if (null != attrMap.get(ATTR_GSO_WEB_CREDENTIALS)) { webCredList = attrMap.get(ATTR_GSO_WEB_CREDENTIALS); } Attribute groupCredList = null; if (null != attrMap.get(ATTR_GSO_GROUP_CREDENTIALS)) { groupCredList = attrMap.get(ATTR_GSO_GROUP_CREDENTIALS); } try { PDRgyUserName pdRgyUserName = new PDRgyUserName(registryName, firstName, lastName); PDMessages msgs = new PDMessages(); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDUser.importUser(ctxt,{0},{1},null,{2},msgs)", name .getNameValue(), pdRgyUserName, ssoUser); } PDUser.importUser(ctxt, name.getNameValue(), pdRgyUserName, null, ssoUser, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (groupList != null) { updateTAMGroups(groupList, name.getNameValue(), msgs); } } else { if (LOG.isInfo()) { LOG.info("PDUser.createUser(ctxt,{0},{1},null,Passw0rd,{2},{3},{4},msgs)", name.getNameValue(), pdRgyUserName, groupList, ssoUser, pwdPolicy); } PDUser.createUser(ctxt, name.getNameValue(), pdRgyUserName, null, accessor .getArray(), groupList, ssoUser, pwdPolicy, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDUser.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } if (LOG.isInfo()) { LOG.info("Calling PDUser.setAccountValid(ctxt,{0},true,msgs)", name .getNameValue()); } PDUser.setAccountValid(ctxt, name.getNameValue(), true, msgs); processMessages(method, msgs); if (expirePassword != null) { if (LOG.isInfo()) { LOG.info("PDUser.setPasswordValid(ctxt,{0},{1},msgs)", name.getNameValue(), isValid); } PDUser.setPasswordValid(ctxt, name.getNameValue(), isValid, msgs); processMessages(method, msgs); } if (webCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCE, webCredList, msgs); } if (groupCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCEGROUP, groupCredList, msgs); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { PDMessages msgs = new PDMessages(); PDRgyGroupName pdRgyGroupName = new PDRgyGroupName(registryName); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDGroup.importGroup(ctxt,{0},{1},{2},msgs", name.getNameValue(), pdRgyGroupName, description); } PDGroup.importGroup(ctxt, name.getNameValue(), pdRgyGroupName, description, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); } else { if (LOG.isInfo()) { LOG.info("PDGroup.createGroup(ctxt,{0},{1},{2},null,msgs", name .getNameValue(), pdRgyGroupName, description); } PDGroup.createGroup(ctxt, name.getNameValue(), pdRgyGroupName, null, null, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDGroup.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else { LOG.error("Failed to create: Unsupported objectClass={0}, id={1}", objClass, uid); } LOG.info("Exit {0}", method); return uid; }  }
TAMConnector implements PoolableConnector, AuthenticateOp, CreateOp, SchemaOp, TestOp,
        DeleteOp, UpdateOp, SearchOp<String> { public Uid create(final ObjectClass objClass, final Set<Attribute> attributes, final OperationOptions options) { final String method = "create"; LOG.info("Entry {0}", method); Uid uid = null; Map<String, Attribute> attrMap = new HashMap<String, Attribute>(AttributeUtil.toMap(attributes)); Name name = AttributeUtil.getNameFromAttributes(attributes); LOG.info("create({0},{1})", objClass.getObjectClassValue(), name.getNameValue()); String description = null; if (null != attrMap.get(PredefinedAttributes.DESCRIPTION)) { description = AttributeUtil.getStringValue(attrMap.get(PredefinedAttributes.DESCRIPTION)); } boolean importFromRegistry = false; if (null != attrMap.get(ATTR_IMPORT_FROM_REGISTRY)) { importFromRegistry = AttributeUtil.getBooleanValue(attrMap.get(ATTR_IMPORT_FROM_REGISTRY)); } String registryName = null; if (null != attrMap.get(ATTR_REGISTRY_NAME)) { registryName = AttributeUtil.getStringValue(attrMap.get(ATTR_REGISTRY_NAME)); } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { String firstName = null; if (null != attrMap.get(ATTR_FIRST_NAME)) { firstName = AttributeUtil.getStringValue(attrMap.get(ATTR_FIRST_NAME)); } String lastName = null; if (null != attrMap.get(ATTR_LAST_NAME)) { lastName = AttributeUtil.getStringValue(attrMap.get(ATTR_LAST_NAME)); } GuardedString password = AttributeUtil.getPasswordValue(attributes); if (password == null) { throw new IllegalArgumentException("Missing Password value"); } GuardedStringAccessor accessor = new GuardedStringAccessor(); password.access(accessor); boolean ssoUser = false; if (null != attrMap.get(ATTR_SSO_USER)) { ssoUser = AttributeUtil.getBooleanValue(attrMap.get(ATTR_SSO_USER)); } boolean pwdPolicy = true; if (null != attrMap.get(ATTR_PASSWORD_POLICY)) { pwdPolicy = AttributeUtil.getBooleanValue(attrMap.get(ATTR_PASSWORD_POLICY)); } boolean isValid = true; Boolean expirePassword = null; if (null != attrMap.get(OperationalAttributes.ENABLE_NAME)) { expirePassword = AttributeUtil.getBooleanValue(attrMap .get(OperationalAttributes.ENABLE_NAME)); isValid = expirePassword; } ArrayList groupList = new ArrayList(); if (null != attrMap.get(PredefinedAttributes.GROUPS_NAME)) { groupList = new ArrayList(attrMap.get(PredefinedAttributes.GROUPS_NAME).getValue()); } Attribute webCredList = null; if (null != attrMap.get(ATTR_GSO_WEB_CREDENTIALS)) { webCredList = attrMap.get(ATTR_GSO_WEB_CREDENTIALS); } Attribute groupCredList = null; if (null != attrMap.get(ATTR_GSO_GROUP_CREDENTIALS)) { groupCredList = attrMap.get(ATTR_GSO_GROUP_CREDENTIALS); } try { PDRgyUserName pdRgyUserName = new PDRgyUserName(registryName, firstName, lastName); PDMessages msgs = new PDMessages(); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDUser.importUser(ctxt,{0},{1},null,{2},msgs)", name .getNameValue(), pdRgyUserName, ssoUser); } PDUser.importUser(ctxt, name.getNameValue(), pdRgyUserName, null, ssoUser, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (groupList != null) { updateTAMGroups(groupList, name.getNameValue(), msgs); } } else { if (LOG.isInfo()) { LOG.info("PDUser.createUser(ctxt,{0},{1},null,Passw0rd,{2},{3},{4},msgs)", name.getNameValue(), pdRgyUserName, groupList, ssoUser, pwdPolicy); } PDUser.createUser(ctxt, name.getNameValue(), pdRgyUserName, null, accessor .getArray(), groupList, ssoUser, pwdPolicy, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDUser.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } if (LOG.isInfo()) { LOG.info("Calling PDUser.setAccountValid(ctxt,{0},true,msgs)", name .getNameValue()); } PDUser.setAccountValid(ctxt, name.getNameValue(), true, msgs); processMessages(method, msgs); if (expirePassword != null) { if (LOG.isInfo()) { LOG.info("PDUser.setPasswordValid(ctxt,{0},{1},msgs)", name.getNameValue(), isValid); } PDUser.setPasswordValid(ctxt, name.getNameValue(), isValid, msgs); processMessages(method, msgs); } if (webCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCE, webCredList, msgs); } if (groupCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCEGROUP, groupCredList, msgs); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { PDMessages msgs = new PDMessages(); PDRgyGroupName pdRgyGroupName = new PDRgyGroupName(registryName); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDGroup.importGroup(ctxt,{0},{1},{2},msgs", name.getNameValue(), pdRgyGroupName, description); } PDGroup.importGroup(ctxt, name.getNameValue(), pdRgyGroupName, description, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); } else { if (LOG.isInfo()) { LOG.info("PDGroup.createGroup(ctxt,{0},{1},{2},null,msgs", name .getNameValue(), pdRgyGroupName, description); } PDGroup.createGroup(ctxt, name.getNameValue(), pdRgyGroupName, null, null, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDGroup.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else { LOG.error("Failed to create: Unsupported objectClass={0}, id={1}", objClass, uid); } LOG.info("Exit {0}", method); return uid; }  Configuration getConfiguration(); void init(Configuration config); void dispose(); void checkAlive(); Uid create(final ObjectClass objClass, final Set<Attribute> attributes,
            final OperationOptions options); FilterTranslator<String> createFilterTranslator(ObjectClass objClass,
            OperationOptions options); void executeQuery(ObjectClass objClass, String query, ResultsHandler handler,
            OperationOptions options); void test(); Uid update(ObjectClass objClass, Uid uid, Set<Attribute> replaceAttributes,
            OperationOptions options); void delete(final ObjectClass objClass, final Uid uid, final OperationOptions options); Schema schema(); Uid authenticate(ObjectClass oc, String user, GuardedString gs, OperationOptions oo); }
TAMConnector implements PoolableConnector, AuthenticateOp, CreateOp, SchemaOp, TestOp,
        DeleteOp, UpdateOp, SearchOp<String> { public Uid create(final ObjectClass objClass, final Set<Attribute> attributes, final OperationOptions options) { final String method = "create"; LOG.info("Entry {0}", method); Uid uid = null; Map<String, Attribute> attrMap = new HashMap<String, Attribute>(AttributeUtil.toMap(attributes)); Name name = AttributeUtil.getNameFromAttributes(attributes); LOG.info("create({0},{1})", objClass.getObjectClassValue(), name.getNameValue()); String description = null; if (null != attrMap.get(PredefinedAttributes.DESCRIPTION)) { description = AttributeUtil.getStringValue(attrMap.get(PredefinedAttributes.DESCRIPTION)); } boolean importFromRegistry = false; if (null != attrMap.get(ATTR_IMPORT_FROM_REGISTRY)) { importFromRegistry = AttributeUtil.getBooleanValue(attrMap.get(ATTR_IMPORT_FROM_REGISTRY)); } String registryName = null; if (null != attrMap.get(ATTR_REGISTRY_NAME)) { registryName = AttributeUtil.getStringValue(attrMap.get(ATTR_REGISTRY_NAME)); } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { String firstName = null; if (null != attrMap.get(ATTR_FIRST_NAME)) { firstName = AttributeUtil.getStringValue(attrMap.get(ATTR_FIRST_NAME)); } String lastName = null; if (null != attrMap.get(ATTR_LAST_NAME)) { lastName = AttributeUtil.getStringValue(attrMap.get(ATTR_LAST_NAME)); } GuardedString password = AttributeUtil.getPasswordValue(attributes); if (password == null) { throw new IllegalArgumentException("Missing Password value"); } GuardedStringAccessor accessor = new GuardedStringAccessor(); password.access(accessor); boolean ssoUser = false; if (null != attrMap.get(ATTR_SSO_USER)) { ssoUser = AttributeUtil.getBooleanValue(attrMap.get(ATTR_SSO_USER)); } boolean pwdPolicy = true; if (null != attrMap.get(ATTR_PASSWORD_POLICY)) { pwdPolicy = AttributeUtil.getBooleanValue(attrMap.get(ATTR_PASSWORD_POLICY)); } boolean isValid = true; Boolean expirePassword = null; if (null != attrMap.get(OperationalAttributes.ENABLE_NAME)) { expirePassword = AttributeUtil.getBooleanValue(attrMap .get(OperationalAttributes.ENABLE_NAME)); isValid = expirePassword; } ArrayList groupList = new ArrayList(); if (null != attrMap.get(PredefinedAttributes.GROUPS_NAME)) { groupList = new ArrayList(attrMap.get(PredefinedAttributes.GROUPS_NAME).getValue()); } Attribute webCredList = null; if (null != attrMap.get(ATTR_GSO_WEB_CREDENTIALS)) { webCredList = attrMap.get(ATTR_GSO_WEB_CREDENTIALS); } Attribute groupCredList = null; if (null != attrMap.get(ATTR_GSO_GROUP_CREDENTIALS)) { groupCredList = attrMap.get(ATTR_GSO_GROUP_CREDENTIALS); } try { PDRgyUserName pdRgyUserName = new PDRgyUserName(registryName, firstName, lastName); PDMessages msgs = new PDMessages(); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDUser.importUser(ctxt,{0},{1},null,{2},msgs)", name .getNameValue(), pdRgyUserName, ssoUser); } PDUser.importUser(ctxt, name.getNameValue(), pdRgyUserName, null, ssoUser, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (groupList != null) { updateTAMGroups(groupList, name.getNameValue(), msgs); } } else { if (LOG.isInfo()) { LOG.info("PDUser.createUser(ctxt,{0},{1},null,Passw0rd,{2},{3},{4},msgs)", name.getNameValue(), pdRgyUserName, groupList, ssoUser, pwdPolicy); } PDUser.createUser(ctxt, name.getNameValue(), pdRgyUserName, null, accessor .getArray(), groupList, ssoUser, pwdPolicy, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDUser.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } if (LOG.isInfo()) { LOG.info("Calling PDUser.setAccountValid(ctxt,{0},true,msgs)", name .getNameValue()); } PDUser.setAccountValid(ctxt, name.getNameValue(), true, msgs); processMessages(method, msgs); if (expirePassword != null) { if (LOG.isInfo()) { LOG.info("PDUser.setPasswordValid(ctxt,{0},{1},msgs)", name.getNameValue(), isValid); } PDUser.setPasswordValid(ctxt, name.getNameValue(), isValid, msgs); processMessages(method, msgs); } if (webCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCE, webCredList, msgs); } if (groupCredList != null) { updateGSOCredentials(name.getNameValue(), PDSSOCred.PDSSOCRED_SSORESOURCEGROUP, groupCredList, msgs); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { PDMessages msgs = new PDMessages(); PDRgyGroupName pdRgyGroupName = new PDRgyGroupName(registryName); if (importFromRegistry) { if (LOG.isInfo()) { LOG.info("PDGroup.importGroup(ctxt,{0},{1},{2},msgs", name.getNameValue(), pdRgyGroupName, description); } PDGroup.importGroup(ctxt, name.getNameValue(), pdRgyGroupName, description, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); } else { if (LOG.isInfo()) { LOG.info("PDGroup.createGroup(ctxt,{0},{1},{2},null,msgs", name .getNameValue(), pdRgyGroupName, description); } PDGroup.createGroup(ctxt, name.getNameValue(), pdRgyGroupName, null, null, msgs); uid = new Uid(name.getNameValue()); processMessages(method, msgs); if (StringUtil.isNotBlank(description)) { PDGroup.setDescription(ctxt, name.getNameValue(), description, msgs); processMessages(method, msgs); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else { LOG.error("Failed to create: Unsupported objectClass={0}, id={1}", objClass, uid); } LOG.info("Exit {0}", method); return uid; }  Configuration getConfiguration(); void init(Configuration config); void dispose(); void checkAlive(); Uid create(final ObjectClass objClass, final Set<Attribute> attributes,
            final OperationOptions options); FilterTranslator<String> createFilterTranslator(ObjectClass objClass,
            OperationOptions options); void executeQuery(ObjectClass objClass, String query, ResultsHandler handler,
            OperationOptions options); void test(); Uid update(ObjectClass objClass, Uid uid, Set<Attribute> replaceAttributes,
            OperationOptions options); void delete(final ObjectClass objClass, final Uid uid, final OperationOptions options); Schema schema(); Uid authenticate(ObjectClass oc, String user, GuardedString gs, OperationOptions oo); static final String ATTR_REGISTRY_NAME; static final String ATTR_FIRST_NAME; static final String ATTR_LAST_NAME; static final String ATTR_SSO_USER; static final String ATTR_PASSWORD_POLICY; static final String ATTR_EXPIRE_PASSWORD; static final String ATTR_DELETE_FROM_REGISTRY; static final String ATTR_SYNC_GSO_CREDENTIALS; static final String ATTR_IMPORT_FROM_REGISTRY; static final String ATTR_GROUP_MEMBERS; static final String ATTR_GSO_WEB_CREDENTIALS; static final String ATTR_GSO_GROUP_CREDENTIALS; static final String TYPE_GSO_GROUP_RESOURCE; static final String TYPE_GSO_RESOURCE; static final String TOKEN_GSO_RESOURCE; }