• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OperationalAttributes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.identityconnectors.framework.common.objects.OperationalAttributes的典型用法代码示例。如果您正苦于以下问题:Java OperationalAttributes类的具体用法?Java OperationalAttributes怎么用?Java OperationalAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OperationalAttributes类属于org.identityconnectors.framework.common.objects包,在下文中一共展示了OperationalAttributes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSchema

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
/**
 * Return resource schema names.
 *
 * @param showall return __NAME__ and __PASSWORD__ attribute if true.
 * @return a list of schema names.
 */
public Set<String> getSchema(final boolean showall) {
    final Set<String> resourceSchemaNames = new HashSet<String>();

    final Schema schema = connector.schema();

    try {
        for (ObjectClassInfo info : schema.getObjectClassInfo()) {
            for (AttributeInfo attrInfo : info.getAttributeInfo()) {
                if (showall || (!Name.NAME.equals(attrInfo.getName())
                        && !OperationalAttributes.PASSWORD_NAME.equals(
                        attrInfo.getName())
                        && !OperationalAttributes.ENABLE_NAME.equals(
                        attrInfo.getName()))) {

                    resourceSchemaNames.add(attrInfo.getName());
                }
            }
        }
    } catch (Throwable t) {
        // catch throwable in order to manage unpredictable behaviors
        LOG.debug("Unsupported operation {}", t);
    }

    return resourceSchemaNames;
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:32,代码来源:ConnectorFacadeProxy.java


示例2: addAttributeModification

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
protected void addAttributeModification(Dn dn, List<Modification> modifications,
		org.apache.directory.api.ldap.model.schema.ObjectClass ldapStructuralObjectClass,
		ObjectClass icfObjectClass, Attribute icfAttr, ModificationOperation modOp) {
	
	if (icfAttr.is(OperationalAttributes.LOCK_OUT_NAME) 
			&& LdapConfiguration.LOCKOUT_STRATEGY_OPENLDAP.equals(getConfiguration().getLockoutStrategy())) {
		List<Object> values = icfAttr.getValue();
		if (values.size() != 1) {
			throw new InvalidAttributeValueException("Unexpected number of values in attribute "+icfAttr);
		}
		Boolean value = (Boolean)values.get(0);
		if (value) {
			throw new UnsupportedOperationException("Locking object is not supported (only unlocking is)");
		}
		modifications.add(
				new DefaultModification(modOp, SchemaConstants.PWD_ACCOUNT_LOCKED_TIME_AT)); // no value
		
	} else {
		super.addAttributeModification(dn, modifications, ldapStructuralObjectClass, icfObjectClass, icfAttr, modOp);
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:23,代码来源:LdapConnector.java


示例3: extendObjectClassDefinition

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
protected void extendObjectClassDefinition(ObjectClassInfoBuilder ocib,
		org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass) {
	super.extendObjectClassDefinition(ocib, ldapObjectClass);
	if (getConfiguration().isTweakSchema()) {
		// Account and groups need samAccountName attribute. But it is not in the declared schema.
		if (isUserObjectClass(ldapObjectClass.getName()) || isGroupObjectClass(ldapObjectClass.getName())) {
			AttributeInfoBuilder samAccountNameAttr = new AttributeInfoBuilder(AdConstants.ATTRIBUTE_SAM_ACCOUNT_NAME_NAME);
			samAccountNameAttr.setType(String.class);
			ocib.addAttributeInfo(samAccountNameAttr.build());
		}
	}
	
	if (!getConfiguration().isRawUserAccountControlAttribute()) {
		AttributeInfoBuilder enableAb = new AttributeInfoBuilder(OperationalAttributes.ENABLE_NAME);
		enableAb.setType(boolean.class);
		ocib.addAttributeInfo(enableAb.build());
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:20,代码来源:AdSchemaTranslator.java


示例4: extendConnectorObject

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
protected void extendConnectorObject(ConnectorObjectBuilder cob, Entry entry, String objectClassName) {
	super.extendConnectorObject(cob, entry, objectClassName);
	if (!getConfiguration().isRawUserAccountControlAttribute()) {
		Integer userAccountControl = LdapUtil.getIntegerAttribute(entry, AdConstants.ATTRIBUTE_USER_ACCOUNT_CONTROL_NAME, null);
		if (userAccountControl == null) {
			if (isUserObjectClass(objectClassName)) {
				cob.addAttribute(OperationalAttributes.ENABLE_NAME, Boolean.FALSE);
			}
		} else {
			if ((userAccountControl & AdConstants.USER_ACCOUNT_CONTROL_DISABLED) == 0) {
				cob.addAttribute(OperationalAttributes.ENABLE_NAME, Boolean.TRUE);
			} else {
				cob.addAttribute(OperationalAttributes.ENABLE_NAME, Boolean.FALSE);
			}
		}
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:19,代码来源:AdSchemaTranslator.java


示例5: toLdapAttribute

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
public AttributeType toLdapAttribute(org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass,
		String icfAttributeName) {
	
	if (OperationalAttributes.LOCK_OUT_NAME.equals(icfAttributeName)) {
		if (getConfiguration().getLockoutStrategy() == null || LdapConfiguration.LOCKOUT_STRATEGY_NONE.equals(getConfiguration().getLockoutStrategy())) {
			return null;
		} else if (LdapConfiguration.LOCKOUT_STRATEGY_OPENLDAP.equals(getConfiguration().getLockoutStrategy())) {
			return super.toLdapAttribute(ldapObjectClass, SchemaConstants.PWD_ACCOUNT_LOCKED_TIME_AT); 
		} else {
			throw new IllegalStateException("Unknown lockout strategy "+ getConfiguration().getLockoutStrategy());
		}
	}
	
	return super.toLdapAttribute(ldapObjectClass, icfAttributeName);
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:17,代码来源:LdapSchemaTranslator.java


示例6: buildOperationOptions

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
/**
 * Build options for requesting all mapped connector attributes.
 *
 * @param iterator items
 * @return options for requesting all mapped connector attributes
 * @see OperationOptions
 */
public static OperationOptions buildOperationOptions(final Iterator<? extends Item> iterator) {
    OperationOptionsBuilder builder = new OperationOptionsBuilder();

    Set<String> attrsToGet = new HashSet<>();
    attrsToGet.add(Name.NAME);
    attrsToGet.add(Uid.NAME);
    attrsToGet.add(OperationalAttributes.ENABLE_NAME);

    while (iterator.hasNext()) {
        Item item = iterator.next();
        if (item.getPurpose() != MappingPurpose.NONE) {
            attrsToGet.add(item.getExtAttrName());
        }
    }

    builder.setAttributesToGet(attrsToGet);
    // -------------------------------------

    return builder.build();
}
 
开发者ID:apache,项目名称:syncope,代码行数:28,代码来源:MappingUtils.java


示例7: createTest

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Test
public void createTest() {
	logger.info("Running Create Test");

	final String principal = "[email protected]" + realm;
	final long modifyDate = System.currentTimeMillis();
	final long princExpire = modifyDate + 1000 * 7 * 24 * 3600;
	final long maxLife = 1000 * 4 * 3600;
	final long maxRenew = 1000 * 24 * 3600;
	final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
	ConnectorObject co;

	Set<Attribute> createAttributes = new HashSet<Attribute>();
	createAttributes.add(new Name(principal));
	createAttributes.add(AttributeBuilder.buildPassword("Password".toCharArray()));
	createAttributes.add(AttributeBuilder.buildEnabled(true));
	createAttributes.add(AttributeBuilder.buildDisableDate(princExpire));
	createAttributes.add(AttributeBuilder.build("requiresPreauth", true));
	createAttributes.add(AttributeBuilder.build("maxTicketLife", maxLife));
	createAttributes.add(AttributeBuilder.build("maxRenewableLife", maxRenew));
	Uid uid = facade.create(ObjectClass.ACCOUNT, createAttributes, null);
	Assert.assertEquals(uid.getUidValue(), principal);

	co = facade.getObject(ObjectClass.ACCOUNT, new Uid(principal), null);
	Assert.assertNotNull(co);
	long validTo = AttributeUtil.getLongValue(co.getAttributeByName(OperationalAttributes.DISABLE_DATE_NAME));
	long maxLife2 = AttributeUtil.getLongValue(co.getAttributeByName("maxTicketLife"));
	long maxRenew2 = AttributeUtil.getLongValue(co.getAttributeByName("maxRenewableLife"));
	Assert.assertEquals(precRound(validTo, 2 * 1000), precRound(princExpire, 2 * 1000));
	Assert.assertEquals(precRound(maxLife2, 2 * 1000), precRound(maxLife, 2 * 1000));
	Assert.assertEquals(precRound(maxRenew2, 2 * 1000), precRound(maxRenew, 2 * 1000));
	Assert.assertTrue(AttributeUtil.getBooleanValue(co.getAttributeByName("requiresPreauth")));
	Assert.assertEquals((int)AttributeUtil.getIntegerValue(co.getAttributeByName("attributes")), 128);
}
 
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:35,代码来源:KerberosConnectorTests.java


示例8: updateDatesTest

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Test
void updateDatesTest() {
	logger.info("Running Update Dates Test");

	final String principal = "[email protected]" + realm;
	final Uid testUid = new Uid(principal);
	final long modifyDate = System.currentTimeMillis();
	final long expPrincDate = modifyDate + 3600000;
	final long expPwDate = modifyDate + 1800000;
	Uid uid;
	final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
	Set<Attribute> updateAttributes;
	ConnectorObject co;

	updateAttributes = new HashSet<Attribute>();
	updateAttributes.add(AttributeBuilder.build(OperationalAttributes.DISABLE_DATE_NAME, expPrincDate));
	updateAttributes.add(AttributeBuilder.build(OperationalAttributes.PASSWORD_EXPIRATION_DATE_NAME, expPwDate));
	uid = facade.update(ObjectClass.ACCOUNT, testUid, updateAttributes, null);
	Assert.assertEquals(uid.getUidValue(), principal);

	co = facade.getObject(ObjectClass.ACCOUNT, testUid, null);
	Assert.assertNotNull(co);
	Long expPrincDate2 = (Long)co.getAttributeByName(OperationalAttributes.DISABLE_DATE_NAME).getValue().get(0);
	Long expPwDate2 = (Long)co.getAttributeByName(OperationalAttributes.PASSWORD_EXPIRATION_DATE_NAME).getValue().get(0);
	Long modifyDate2 = (Long)co.getAttributeByName("modifyDate").getValue().get(0);
	// permit less precision (1 second)
	Assert.assertEquals(precRound(expPrincDate, 1000 * 2), precRound(expPrincDate2, 1000 * 2));
	Assert.assertEquals(precRound(expPwDate, 1000 * 2), precRound (expPwDate2, 1000 * 2));
	// modifyDate is set independently - permit even less precision
	Assert.assertEquals(precRound(modifyDate, 1000 * 10), precRound(modifyDate2, 1000 * 10));
}
 
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:32,代码来源:KerberosConnectorTests.java


示例9: enableTest

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Test
public void enableTest() {
	logger.info("Running Enable Test");

	final String principal = "[email protected]" + realm;
	final Uid testUid = new Uid(principal);
	Uid uid;
	ConnectorObject co;
	final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
	Set<Attribute> updateAttributes;

	// disable
	updateAttributes = new HashSet<Attribute>();
	updateAttributes.add(AttributeBuilder.build(OperationalAttributes.ENABLE_NAME, false));
	uid = facade.update(ObjectClass.ACCOUNT, testUid, updateAttributes, null);
	Assert.assertEquals(uid.getUidValue(), principal);
	co = facade.getObject(ObjectClass.ACCOUNT, testUid, null);
	Assert.assertNotNull(co);
	Assert.assertEquals(co.getAttributeByName("attributes").getValue().get(0), 192);
	Assert.assertEquals(co.getAttributeByName("allowTix").getValue().get(0), false);

	// enable
	updateAttributes= new HashSet<Attribute>();
	updateAttributes.add(AttributeBuilder.build(OperationalAttributes.ENABLE_NAME, true));
	uid = facade.update(ObjectClass.ACCOUNT, testUid, updateAttributes, null);
	Assert.assertEquals(uid.getUidValue(), principal);
	co = facade.getObject(ObjectClass.ACCOUNT, testUid, null);
	Assert.assertNotNull(co);
	Assert.assertEquals(co.getAttributeByName("attributes").getValue().get(0), 128);
	Assert.assertEquals(co.getAttributeByName("allowTix").getValue().get(0), true);
}
 
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:32,代码来源:KerberosConnectorTests.java


示例10: convertFromPassword

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
private void convertFromPassword(Set<Attribute> attributes, PropertyDelta<ProtectedStringType> passwordDelta) throws SchemaException {
	if (passwordDelta == null) {
		throw new IllegalArgumentException("No password was provided");
	}

	QName elementName = passwordDelta.getElementName();
	if (StringUtils.isBlank(elementName.getNamespaceURI())) {
		if (!QNameUtil.match(elementName, PasswordType.F_VALUE)) {
			return;
		}
	} else if (!passwordDelta.getElementName().equals(PasswordType.F_VALUE)) {
		return;
	}
	PrismProperty<ProtectedStringType> newPassword = passwordDelta.getPropertyNewMatchingPath();
	if (newPassword == null || newPassword.isEmpty()) {
		// This is the case of setting no password. E.g. removing existing password
		LOGGER.debug("Setting null password.");
		attributes.add(AttributeBuilder.build(OperationalAttributes.PASSWORD_NAME, Collections.EMPTY_LIST));
	} else if (newPassword.getRealValue().canGetCleartext()) {
		// We have password and we can get a cleartext value of the passowrd. This is normal case
		GuardedString guardedPassword = ConnIdUtil.toGuardedString(newPassword.getRealValue(), "new password", protector);
		attributes.add(AttributeBuilder.build(OperationalAttributes.PASSWORD_NAME, guardedPassword));
	} else {
		// We have password, but we cannot get a cleartext value. Just to nothing.
		LOGGER.debug("We would like to set password, but we do not have cleartext value. Skipping the opearation.");
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:28,代码来源:ConnectorInstanceConnIdImpl.java


示例11: extendObjectClassDefinition

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
	protected void extendObjectClassDefinition(ObjectClassInfoBuilder ocib,
			org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass) {
		super.extendObjectClassDefinition(ocib, ldapObjectClass);
		if (isUserObjectClass(ldapObjectClass.getName())) {
			AttributeInfoBuilder lockoutAb = new AttributeInfoBuilder(OperationalAttributes.LOCK_OUT_NAME);
			lockoutAb.setType(boolean.class);
//			lockoutAb.setReturnedByDefault(false);
			ocib.addAttributeInfo(lockoutAb.build());
			
			AttributeInfoBuilder enableAb = new AttributeInfoBuilder(OperationalAttributes.ENABLE_NAME);
			enableAb.setType(boolean.class);
			ocib.addAttributeInfo(enableAb.build());
		}
	}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:16,代码来源:EDirectorySchemaTranslator.java


示例12: toLdapAttribute

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
public AttributeType toLdapAttribute(
		org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass, String icfAttributeName) {
	if (icfAttributeName.equals(OperationalAttributes.ENABLE_NAME)) {
		return super.toLdapAttribute(ldapObjectClass, EDirectoryConstants.ATTRIBUTE_LOGIN_DISABLED_NAME);
	} else if (icfAttributeName.equals(OperationalAttributes.LOCK_OUT_NAME)) {
		return super.toLdapAttribute(ldapObjectClass, EDirectoryConstants.ATTRIBUTE_LOCKOUT_LOCKED_NAME);
	} else {
		return super.toLdapAttribute(ldapObjectClass, icfAttributeName);
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:12,代码来源:EDirectorySchemaTranslator.java


示例13: extendConnectorObject

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
protected void extendConnectorObject(ConnectorObjectBuilder cob, Entry entry, String objectClassName) {
	super.extendConnectorObject(cob, entry, objectClassName);
	Boolean ldapDisabled = LdapUtil.getBooleanAttribute(entry, EDirectoryConstants.ATTRIBUTE_LOGIN_DISABLED_NAME, null);
	if (ldapDisabled == null) {
		if (isUserObjectClass(objectClassName)) {
			cob.addAttribute(OperationalAttributes.ENABLE_NAME, Boolean.TRUE);
		}
	} else {
		if (ldapDisabled) {
			cob.addAttribute(OperationalAttributes.ENABLE_NAME, Boolean.FALSE);
		} else {
			cob.addAttribute(OperationalAttributes.ENABLE_NAME, Boolean.TRUE);
		}
	}
	boolean ldapLocked = LdapUtil.getBooleanAttribute(entry, EDirectoryConstants.ATTRIBUTE_LOCKOUT_LOCKED_NAME, Boolean.FALSE);
	if (ldapLocked) {
		Long resetTime = LdapUtil.getTimestampAttribute(entry, EDirectoryConstants.ATTRIBUTE_LOCKOUT_RESET_TIME_NAME);
		long now = System.currentTimeMillis();
		LOG.ok("LOCK reset={0}, now={1}", resetTime, now);
		if (resetTime > now) {
			cob.addAttribute(OperationalAttributes.LOCK_OUT_NAME, Boolean.TRUE);
		} else {
			cob.addAttribute(OperationalAttributes.LOCK_OUT_NAME, Boolean.FALSE);
		}
	} else {
		cob.addAttribute(OperationalAttributes.LOCK_OUT_NAME, Boolean.FALSE);
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:30,代码来源:EDirectorySchemaTranslator.java


示例14: toLdapAttribute

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
public AttributeType toLdapAttribute(
		org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass, String icfAttributeName) {
	if (!getConfiguration().isRawUserAccountControlAttribute() && icfAttributeName.equals(OperationalAttributes.ENABLE_NAME)) {
		return super.toLdapAttribute(ldapObjectClass, AdConstants.ATTRIBUTE_USER_ACCOUNT_CONTROL_NAME);
	} else {
		return super.toLdapAttribute(ldapObjectClass, icfAttributeName);
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:10,代码来源:AdSchemaTranslator.java


示例15: extendObjectClassDefinition

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
	protected void extendObjectClassDefinition(ObjectClassInfoBuilder ocib,
			org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass) {
		super.extendObjectClassDefinition(ocib, ldapObjectClass);
		
		if (!LdapConfiguration.LOCKOUT_STRATEGY_NONE.equals(getConfiguration().getLockoutStrategy())) {
			AttributeInfoBuilder lockoutAb = new AttributeInfoBuilder(OperationalAttributes.LOCK_OUT_NAME);
			lockoutAb.setType(boolean.class);
//			lockoutAb.setReturnedByDefault(false);
			ocib.addAttributeInfo(lockoutAb.build());
		}
	}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:13,代码来源:LdapSchemaTranslator.java


示例16: extendConnectorObject

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Override
protected void extendConnectorObject(ConnectorObjectBuilder cob, Entry entry, String objectClassName) {
	super.extendConnectorObject(cob, entry, objectClassName);
	
	if (LdapConfiguration.LOCKOUT_STRATEGY_OPENLDAP.equals(getConfiguration().getLockoutStrategy())) {
		Long pwdAccountLockedTime = LdapUtil.getTimestampAttribute(entry, SchemaConstants.PWD_ACCOUNT_LOCKED_TIME_AT);
		if (pwdAccountLockedTime != null) {
			// WARNING: this is not exact. The lock might have already expired. But we do not have
			// any good way to check that without access to cn=config
			cob.addAttribute(OperationalAttributes.LOCK_OUT_NAME, Boolean.TRUE);
		} else {
			cob.addAttribute(OperationalAttributes.LOCK_OUT_NAME, Boolean.FALSE);
		}
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:16,代码来源:LdapSchemaTranslator.java


示例17: readEnabled

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
public Boolean readEnabled(final ConnectorObject connectorObject, final ProvisioningTask task) {
    Boolean enabled = null;
    if (task.isSyncStatus()) {
        Attribute status = AttributeUtil.find(OperationalAttributes.ENABLE_NAME, connectorObject.getAttributes());
        if (status != null && status.getValue() != null && !status.getValue().isEmpty()) {
            enabled = (Boolean) status.getValue().get(0);
        }
    }

    return enabled;
}
 
开发者ID:apache,项目名称:syncope,代码行数:12,代码来源:PullUtils.java


示例18: before

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Transactional(readOnly = true)
@Override
public void before(final PropagationTask task, final ConnectorObject beforeObj) {
    if (AnyTypeKind.USER == task.getAnyTypeKind()) {
        User user = userDAO.find(task.getEntityKey());

        if (user != null && user.getPassword() != null) {
            Attribute missing = AttributeUtil.find(
                    PropagationTaskExecutor.MANDATORY_MISSING_ATTR_NAME,
                    task.getAttributes());

            ConnInstance connInstance = task.getResource().getConnector();
            String cipherAlgorithm = getCipherAlgorithm(connInstance);
            if (missing != null && missing.getValue() != null && missing.getValue().size() == 1
                    && missing.getValue().get(0).equals(OperationalAttributes.PASSWORD_NAME)
                    && cipherAlgorithmMatches(getCipherAlgorithm(connInstance), user.getCipherAlgorithm())) {

                String password = user.getPassword().toLowerCase();
                byte[] decodedPassword = DatatypeConverter.parseHexBinary(password);
                String base64EncodedPassword = Base64.getEncoder().encodeToString(decodedPassword);

                String cipherPlusPassword = ("{" + cipherAlgorithm.toLowerCase() + "}" + base64EncodedPassword);

                Attribute passwordAttribute = AttributeBuilder.buildPassword(
                        new GuardedString(cipherPlusPassword.toCharArray()));

                Set<Attribute> attributes = new HashSet<>(task.getAttributes());
                attributes.add(passwordAttribute);
                attributes.remove(missing);

                task.setAttributes(attributes);
            }
        }
    }
}
 
开发者ID:apache,项目名称:syncope,代码行数:36,代码来源:LDAPPasswordPropagationActions.java


示例19: before

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
@Transactional(readOnly = true)
@Override
public void before(final PropagationTask task, final ConnectorObject beforeObj) {
    if (AnyTypeKind.USER == task.getAnyTypeKind()) {
        User user = userDAO.find(task.getEntityKey());

        if (user != null && user.getPassword() != null) {
            Attribute missing = AttributeUtil.find(
                    PropagationTaskExecutor.MANDATORY_MISSING_ATTR_NAME,
                    task.getAttributes());

            ConnInstance connInstance = task.getResource().getConnector();
            if (missing != null && missing.getValue() != null && missing.getValue().size() == 1
                    && missing.getValue().get(0).equals(OperationalAttributes.PASSWORD_NAME)
                    && cipherAlgorithmMatches(getCipherAlgorithm(connInstance), user.getCipherAlgorithm())) {

                Attribute passwordAttribute = AttributeBuilder.buildPassword(
                        new GuardedString(user.getPassword().toCharArray()));

                Set<Attribute> attributes = new HashSet<>(task.getAttributes());
                attributes.add(passwordAttribute);
                attributes.remove(missing);

                Attribute hashedPasswordAttribute = AttributeBuilder.build(
                        AttributeUtil.createSpecialName("HASHED_PASSWORD"), Boolean.TRUE);
                attributes.add(hashedPasswordAttribute);

                task.setAttributes(attributes);
            }
        }
    }
}
 
开发者ID:apache,项目名称:syncope,代码行数:33,代码来源:DBPasswordPropagationActions.java


示例20: createUser

import org.identityconnectors.framework.common.objects.OperationalAttributes; //导入依赖的package包/类
private SyncResult createUser(final SyncDelta delta, final boolean dryRun)
        throws JobExecutionException {

    final SyncResult result = new SyncResult();
    result.setOperation(Operation.CREATE);

    UserTO userTO = getUserTO(delta.getObject());

    actions.beforeCreate(delta, userTO);

    if (dryRun) {
        result.setUserId(0L);
        result.setUsername(userTO.getUsername());
        result.setStatus(Status.SUCCESS);
    } else {
        try {
            Boolean enabled = null;

            // --------------------------
            // Check for status synchronization ...
            // --------------------------
            if (((SyncTask) this.task).isSyncStatus()) {
                Attribute status = AttributeUtil.find(
                        OperationalAttributes.ENABLE_NAME,
                        delta.getObject().getAttributes());

                if (status != null) {
                    enabled = status != null
                            && status.getValue() != null
                            && !status.getValue().isEmpty()
                            ? (Boolean) status.getValue().get(0) : null;
                }
            }
            // --------------------------

            WorkflowResult<Map.Entry<Long, Boolean>> created =
                    wfAdapter.create(userTO, true, enabled);

            List<PropagationTask> tasks =
                    propagationManager.getCreateTaskIds(
                    created, userTO.getPassword(), null,
                    Collections.singleton(
                    ((SyncTask) this.task).getResource().getName()));
            propagationManager.execute(tasks);

            userTO = userDataBinder.getUserTO(created.getResult().getKey());

            result.setUserId(created.getResult().getKey());
            result.setUsername(userTO.getUsername());
            result.setStatus(Status.SUCCESS);
        } catch (PropagationException e) {
            LOG.error("Could not propagate user "
                    + delta.getUid().getUidValue(), e);
        } catch (Throwable t) {
            result.setStatus(Status.FAILURE);
            result.setMessage(t.getMessage());
            LOG.error("Could not create user "
                    + delta.getUid().getUidValue(), t);
        }
    }

    actions.after(delta, userTO, result);

    return result;
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:66,代码来源:SyncJob.java



注:本文中的org.identityconnectors.framework.common.objects.OperationalAttributes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FuelLevelCommand类代码示例发布时间:2022-05-22
下一篇:
Java ConceptReference类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap