当前位置: 首页>>代码示例>>Java>>正文


Java ConnectorObject类代码示例

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


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

示例1: createRandkeyTest

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

	final String principal = "host/[email protected]" + realm;
	final String policy = "default_nohistory";
	final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
	ConnectorObject co;

	Set<Attribute> createAttributes = new HashSet<Attribute>();
	createAttributes.add(new Name(principal));
	createAttributes.add(AttributeBuilder.build("policy", policy));
	createAttributes.add(AttributeBuilder.build("requiresPreauth", true));
	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);
	Assert.assertTrue(AttributeUtil.getBooleanValue(co.getAttributeByName("requiresPreauth")));
	Assert.assertEquals((int)AttributeUtil.getIntegerValue(co.getAttributeByName("attributes")), 128);
	Assert.assertEquals(AttributeUtil.getStringValue(co.getAttributeByName("policy")), policy);
}
 
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:23,代码来源:KerberosConnectorTests.java

示例2: renameTest

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

	final String principal = "[email protected]" + realm;
	final String newPrincipal = "[email protected]" + realm;
	final Uid testUid = new Uid(principal);
	Uid uid;
	final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
	final OperationOptionsBuilder builder = new OperationOptionsBuilder();
	Set<Attribute> updateAttributes = new HashSet<Attribute>();
	updateAttributes.add(new Name(newPrincipal));

	uid = facade.update(ObjectClass.ACCOUNT, testUid, updateAttributes, builder.build());
	Assert.assertEquals(uid.getUidValue(), newPrincipal);

	ConnectorObject co = facade.getObject(ObjectClass.ACCOUNT, new Uid(newPrincipal), null);
	Assert.assertNotNull(co);
	Assert.assertEquals(co.getName().getNameValue(), newPrincipal);
}
 
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:21,代码来源:KerberosConnectorTests.java

示例3: updatePolicyTest

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

	final String principal = "[email protected]" + realm;
	final Uid testUid = new Uid(principal);
	Uid uid;
	final ConnectorFacade facade = getFacade(KerberosConnector.class, null);

	Set<Attribute> updateAttributes = new HashSet<Attribute>();
	updateAttributes.add(AttributeBuilder.build("policy", "mypolicy"));
	uid = facade.update(ObjectClass.ACCOUNT, testUid, updateAttributes, null);
	Assert.assertEquals(uid.getUidValue(), principal);
	ConnectorObject co = facade.getObject(ObjectClass.ACCOUNT, testUid, null);
	Assert.assertNotNull(co);
	Assert.assertEquals(co.getAttributeByName("policy").getValue().get(0), "mypolicy");

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

示例4: updateLife

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
@Test
public void updateLife() {
	logger.info("Running Update Ticket/Renew Life Test");

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

	updateAttributes = new HashSet<Attribute>();
	updateAttributes.add(AttributeBuilder.build("maxTicketLife", maxTicket));
	updateAttributes.add(AttributeBuilder.build("maxRenewableLife", maxRenew));
	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("maxTicketLife").getValue().get(0), maxTicket);
	Assert.assertEquals(co.getAttributeByName("maxRenewableLife").getValue().get(0), maxRenew);
}
 
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:24,代码来源:KerberosConnectorTests.java

示例5: changePasswordTest

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
@Test
public void changePasswordTest() {
	logger.info("Running Change Password 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> attrs;

	attrs = new HashSet<Attribute>();
	attrs.add(AttributeBuilder.buildPassword("new-password".toCharArray()));
	uid = facade.update(ObjectClass.ACCOUNT, testUid, attrs, null);
	Assert.assertEquals(uid.getUidValue(), principal);
	co = facade.getObject(ObjectClass.ACCOUNT, testUid, null);
	Assert.assertNotNull(co);

	// empty password not supported: ConnId expect always non-empty password
	//attrs.add(AttributeBuilder.build(OperationalAttributes.PASSWORD_NAME));
}
 
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:22,代码来源:KerberosConnectorTests.java

示例6: getObjectAttribute

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
/**
 * Read attribute for a given connector object.
 *
 * @param objectClass ConnId's object class
 * @param uid ConnId's Uid
 * @param options ConnId's OperationOptions
 * @param attributeName attribute to read
 * @return attribute (if present)
 */
public Attribute getObjectAttribute(
        final ObjectClass objectClass,
        final Uid uid,
        final OperationOptions options,
        final String attributeName) {

    Attribute attribute = null;

    try {
        final ConnectorObject object =
                connector.getObject(objectClass, uid, options);

        attribute = object.getAttributeByName(attributeName);
    } catch (NullPointerException e) {
        // ignore exception
        LOG.debug("Object for '{}' not found", uid.getUidValue());
    }

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

示例7: getObjectAttributes

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
/**
 *
 * @param objectClass ConnId's object class
 * @param uid ConnId's Uid
 * @param options ConnId's OperationOptions
 * @param attributeNames attributes to read
 * @return attributes (if present)
 */
public Set<Attribute> getObjectAttributes(
        final ObjectClass objectClass,
        final Uid uid,
        final OperationOptions options,
        final Collection<String> attributeNames) {

    final Set<Attribute> attributes = new HashSet<Attribute>();

    try {
        final ConnectorObject object =
                connector.getObject(objectClass, uid, options);

        for (String attribute : attributeNames) {
            attributes.add(object.getAttributeByName(attribute));
        }
    } catch (NullPointerException e) {
        // ignore exception
        LOG.debug("Object for '{}' not found", uid.getUidValue());
    }

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

示例8: getRemoteObject

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
/**
 * Get remote object.
 *
 * @param connector connector facade proxy.
 * @param task current propagation task.
 * @param latest 'FALSE' to retrieve object using old accountId if not null.
 * @return remote connector object.
 */
private ConnectorObject getRemoteObject(
        final ConnectorFacadeProxy connector,
        final PropagationTask task,
        final boolean latest) {
    try {
        return connector.getObject(
                task.getPropagationMode(),
                task.getPropagationOperation(),
                ObjectClass.ACCOUNT,
                new Uid(latest || task.getOldAccountId() == null
                ? task.getAccountId()
                : task.getOldAccountId()),
                null);
    } catch (RuntimeException ignore) {
        LOG.debug("Resolving username", ignore);
        return null;
    }
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:27,代码来源:PropagationManager.java

示例9: getConnObjectTO

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
/**
 * Get connector object TO from a connector object.
 *
 * @param connObject connector object.
 * @return connector object TO.
 */
public ConnObjectTO getConnObjectTO(final ConnectorObject connObject) {
    final ConnObjectTO connObjectTO = new ConnObjectTO();

    for (Attribute attr : connObject.getAttributes()) {
        AttributeTO attrTO = new AttributeTO();
        attrTO.setSchema(attr.getName());

        if (attr.getValue() != null) {
            for (Object value : attr.getValue()) {
                if (value != null) {
                    attrTO.addValue(value.toString());
                }
            }
        }

        connObjectTO.addAttribute(attrTO);
    }

    return connObjectTO;
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:27,代码来源:ConnInstanceDataBinder.java

示例10: convertUserToConnectorObject

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
private ConnectorObject convertUserToConnectorObject(GitlabUser gitlabUser) {
	ConnectorObjectBuilder builder = new ConnectorObjectBuilder();
	builder.setUid(gitlabUser.getId().toString());
	builder.setName(gitlabUser.getUsername());
	addAttr(builder,ATTR_EMAIL, gitlabUser.getEmail());
	addAttr(builder,ATTR_FULL_NAME, gitlabUser.getName());
	addAttr(builder,ATTR_SKYPE_ID, gitlabUser.getSkype());
	addAttr(builder,ATTR_LINKED_ID, gitlabUser.getLinkedin());
	addAttr(builder,ATTR_TWITTER, gitlabUser.getTwitter());
	addAttr(builder,ATTR_WEBSITE_URL, gitlabUser.getWebsiteUrl());
	addAttr(builder,ATTR_EXTERN_UID, gitlabUser.getExternUid());
	addAttr(builder,ATTR_EXTERN_PROVIDER_NAME, gitlabUser.getExternProviderName());
	addAttr(builder,ATTR_BIO, gitlabUser.getBio());
	addAttr(builder,ATTR_IS_ADMIN, gitlabUser.isAdmin());
	addAttr(builder,ATTR_CAN_CREATE_GROUP, gitlabUser.isCanCreateGroup());
	return builder.build();
}
 
开发者ID:Evolveum,项目名称:connector-gitlab,代码行数:18,代码来源:GitlabConnector.java

示例11: convertGroupToConnectorObject

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
private ConnectorObject convertGroupToConnectorObject(GitlabGroup gitlabGroup) {
	ConnectorObjectBuilder builder = new ConnectorObjectBuilder();
	builder.setObjectClass(ObjectClass.GROUP);
	builder.setUid(gitlabGroup.getId().toString());
	builder.setName(gitlabGroup.getName());
	addAttr(builder,ATTR_PATH, gitlabGroup.getPath());
	
	AttributeBuilder memberAttrBuilder = new AttributeBuilder();
	memberAttrBuilder.setName(ATTR_MEMBER);
	List<GitlabGroupMember> groupMembers;
	try {
		groupMembers = gitlabAPI.getGroupMembers(gitlabGroup);
	} catch (IOException e) {
		throw new ConnectorIOException(e.getMessage(), e);
	}
	if (groupMembers != null && !groupMembers.isEmpty()) {
		for (GitlabGroupMember gitlabMember: groupMembers) {
			Integer id = gitlabMember.getId();
			memberAttrBuilder.addValue(id);
		}
		builder.addAttribute(memberAttrBuilder.build());
	}
	
	return builder.build();
}
 
开发者ID:Evolveum,项目名称:connector-gitlab,代码行数:26,代码来源:GitlabConnector.java

示例12: getRemoteObject

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
protected ConnectorObject getRemoteObject(
        final ObjectClass objectClass,
        final String connObjectKey,
        final String connObjectKeyValue,
        final Iterator<? extends Item> iterator) {

    ConnectorObject obj = null;
    try {
        obj = profile.getConnector().getObject(
                objectClass,
                AttributeBuilder.build(connObjectKey, connObjectKeyValue),
                MappingUtils.buildOperationOptions(iterator));
    } catch (TimeoutException toe) {
        LOG.debug("Request timeout", toe);
        throw toe;
    } catch (RuntimeException ignore) {
        LOG.debug("While resolving {}", connObjectKeyValue, ignore);
    }

    return obj;
}
 
开发者ID:apache,项目名称:syncope,代码行数:22,代码来源:AbstractPushResultHandler.java

示例13: getMembAttrValues

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
/**
 * Read values of attribute returned by getGroupMembershipAttrName(); if not present in the given delta, perform an
 * additional read on the underlying connector.
 *
 * @param delta representing the pulling group
 * @param connector associated to the current resource
 * @return value of attribute returned by
 * {@link #getGroupMembershipAttrName}
 */
protected List<Object> getMembAttrValues(final SyncDelta delta, final Connector connector) {
    List<Object> result = Collections.<Object>emptyList();
    String groupMemberName = getGroupMembershipAttrName(connector);

    // first, try to read the configured attribute from delta, returned by the ongoing pull
    Attribute membAttr = delta.getObject().getAttributeByName(groupMemberName);
    // if not found, perform an additional read on the underlying connector for the same connector object
    if (membAttr == null) {
        OperationOptionsBuilder oob = new OperationOptionsBuilder();
        oob.setAttributesToGet(groupMemberName);
        ConnectorObject remoteObj = connector.getObject(ObjectClass.GROUP, delta.getUid(), oob.build());
        if (remoteObj == null) {
            LOG.debug("Object for '{}' not found", delta.getUid().getUidValue());
        } else {
            membAttr = remoteObj.getAttributeByName(groupMemberName);
        }
    }
    if (membAttr != null && membAttr.getValue() != null) {
        result = membAttr.getValue();
    }

    return result;
}
 
开发者ID:apache,项目名称:syncope,代码行数:33,代码来源:LDAPMembershipPullActions.java

示例14: onSuccessOrNonPriorityResourceFailures

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
@Override
public void onSuccessOrNonPriorityResourceFailures(
        final PropagationTaskTO taskTO,
        final PropagationTaskExecStatus executionStatus,
        final String failureReason,
        final ConnectorObject beforeObj,
        final ConnectorObject afterObj) {

    PropagationStatus status = new PropagationStatus();
    status.setResource(taskTO.getResource());
    status.setStatus(executionStatus);
    status.setFailureReason(failureReason);

    if (beforeObj != null) {
        status.setBeforeObj(ConnObjectUtils.getConnObjectTO(beforeObj));
    }

    if (afterObj != null) {
        status.setAfterObj(ConnObjectUtils.getConnObjectTO(afterObj));
    }

    add(status);
}
 
开发者ID:apache,项目名称:syncope,代码行数:24,代码来源:DefaultPropagationReporter.java

示例15: getRemoteObject

import org.identityconnectors.framework.common.objects.ConnectorObject; //导入依赖的package包/类
/**
 * Get remote object for given task.
 *
 * @param connector connector facade proxy.
 * @param task current propagation task.
 * @param orgUnit orgUnit
 * @param latest 'FALSE' to retrieve object using old connObjectKey if not null.
 * @return remote connector object.
 */
protected ConnectorObject getRemoteObject(
        final PropagationTask task,
        final Connector connector,
        final OrgUnit orgUnit,
        final boolean latest) {

    String connObjectKey = latest || task.getOldConnObjectKey() == null
            ? task.getConnObjectKey()
            : task.getOldConnObjectKey();

    ConnectorObject obj = null;
    try {
        obj = connector.getObject(new ObjectClass(task.getObjectClassName()),
                AttributeBuilder.build(orgUnit.getConnObjectKeyItem().get().getExtAttrName(), connObjectKey),
                MappingUtils.buildOperationOptions(
                        MappingUtils.getPropagationItems(orgUnit.getItems()).iterator()));
    } catch (TimeoutException toe) {
        LOG.debug("Request timeout", toe);
        throw toe;
    } catch (RuntimeException ignore) {
        LOG.debug("While resolving {}", connObjectKey, ignore);
    }

    return obj;
}
 
开发者ID:apache,项目名称:syncope,代码行数:35,代码来源:AbstractPropagationTaskExecutor.java


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