Search in sources :

Example 21 with BasicAttribute

use of javax.naming.directory.BasicAttribute in project jmeter by apache.

the class LDAPSampler method getModificationItem.

/**
     * This will create the Basic Attributes for the Inbuilt TestCase for Modify
     * test.
     *
     * @return the BasicAttributes
     */
private ModificationItem[] getModificationItem() {
    ModificationItem[] mods = new ModificationItem[2];
    // replace (update) attribute
    //$NON-NLS-1$ //$NON-NLS-2$
    Attribute mod0 = new BasicAttribute("userpassword", "secret");
    // add mobile phone number attribute
    //$NON-NLS-1$ //$NON-NLS-2$
    Attribute mod1 = new BasicAttribute("mobile", "123-456-1234");
    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0);
    mods[1] = new ModificationItem(DirContext.ADD_ATTRIBUTE, mod1);
    return mods;
}
Also used : BasicAttribute(javax.naming.directory.BasicAttribute) ModificationItem(javax.naming.directory.ModificationItem) BasicAttribute(javax.naming.directory.BasicAttribute) Attribute(javax.naming.directory.Attribute)

Example 22 with BasicAttribute

use of javax.naming.directory.BasicAttribute in project jmeter by apache.

the class LDAPSampler method getBasicAttributes.

/**
     * This will create the Basic Attributes for the In build TestCase for Add
     * Test.
     *
     * @return the BasicAttributes
     */
private BasicAttributes getBasicAttributes() {
    BasicAttributes basicattributes = new BasicAttributes();
    //$NON-NLS-1$
    BasicAttribute basicattribute = new BasicAttribute("objectclass");
    //$NON-NLS-1$
    basicattribute.add("top");
    //$NON-NLS-1$
    basicattribute.add("person");
    //$NON-NLS-1$
    basicattribute.add("organizationalPerson");
    //$NON-NLS-1$
    basicattribute.add("inetOrgPerson");
    basicattributes.put(basicattribute);
    //$NON-NLS-1$
    String s1 = "User";
    //$NON-NLS-1$
    String s3 = "Test";
    //$NON-NLS-1$
    String s5 = "user";
    //$NON-NLS-1$
    String s6 = "test";
    COUNTER.incrementAndGet();
    //$NON-NLS-1$
    basicattributes.put(new BasicAttribute("givenname", s1));
    //$NON-NLS-1$
    basicattributes.put(new BasicAttribute("sn", s3));
    //$NON-NLS-1$ //$NON-NLS-2$
    basicattributes.put(new BasicAttribute("cn", "TestUser" + COUNTER.get()));
    //$NON-NLS-1$
    basicattributes.put(new BasicAttribute("uid", s5));
    //$NON-NLS-1$
    basicattributes.put(new BasicAttribute("userpassword", s6));
    //$NON-NLS-1$
    setProperty(new StringProperty(ADD, "cn=TestUser" + COUNTER.get()));
    return basicattributes;
}
Also used : BasicAttribute(javax.naming.directory.BasicAttribute) BasicAttributes(javax.naming.directory.BasicAttributes) StringProperty(org.apache.jmeter.testelement.property.StringProperty)

Example 23 with BasicAttribute

use of javax.naming.directory.BasicAttribute in project jmeter by apache.

the class LDAPExtSampler method getUserModAttributes.

/***************************************************************************
     * Collect all the value from the table (Arguments), using this create the
     * basicAttributes This will create the Basic Attributes for the User
     * defined TestCase for Modify test
     *
     * @return The BasicAttributes
     **************************************************************************/
private ModificationItem[] getUserModAttributes() {
    ModificationItem[] mods = new ModificationItem[getLDAPArguments().getArguments().size()];
    BasicAttribute attr;
    PropertyIterator iter = getLDAPArguments().iterator();
    int count = 0;
    while (iter.hasNext()) {
        LDAPArgument item = (LDAPArgument) iter.next().getObjectValue();
        if ((item.getValue()).length() == 0) {
            attr = new BasicAttribute(item.getName());
        } else {
            attr = getBasicAttribute(item.getName(), item.getValue());
        }
        final String opcode = item.getOpcode();
        if ("add".equals(opcode)) {
            // $NON-NLS-1$
            mods[count++] = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr);
        } else if (// $NON-NLS-1$
        "delete".equals(opcode) || "remove".equals(opcode)) {
            // $NON-NLS-1$
            mods[count++] = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, attr);
        } else if ("replace".equals(opcode)) {
            // $NON-NLS-1$
            mods[count++] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr);
        } else {
            log.warn("Invalid opCode: " + opcode);
        }
    }
    return mods;
}
Also used : BasicAttribute(javax.naming.directory.BasicAttribute) ModificationItem(javax.naming.directory.ModificationItem) PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator) LDAPArgument(org.apache.jmeter.protocol.ldap.config.gui.LDAPArgument)

Example 24 with BasicAttribute

use of javax.naming.directory.BasicAttribute in project fess by codelibs.

the class FessProp method getLdapAdminRoleObjectClassAttribute.

public default default Attribute getLdapAdminRoleObjectClassAttribute() {
    final Attribute oc = new BasicAttribute("objectClass");
    split(getLdapAdminRoleObjectClasses(), ",").of(stream -> stream.filter(StringUtil::isNotBlank).forEach(s -> oc.add(s.trim())));
    return oc;
}
Also used : BasicAttribute(javax.naming.directory.BasicAttribute) ClassNotFoundRuntimeException(org.codelibs.core.exception.ClassNotFoundRuntimeException) Constants(org.codelibs.fess.Constants) SortBuilders(org.elasticsearch.search.sort.SortBuilders) Enumeration(java.util.Enumeration) Date(java.util.Date) JobConcurrentExec(org.lastaflute.job.subsidiary.JobConcurrentExec) OptionalThing(org.dbflute.optional.OptionalThing) Pair(org.codelibs.core.misc.Pair) PermissionHelper(org.codelibs.fess.helper.PermissionHelper) IntegerTypeValidator(org.lastaflute.web.validation.theme.typed.IntegerTypeValidator) LaRequestUtil(org.lastaflute.web.util.LaRequestUtil) LongTypeValidator(org.lastaflute.web.validation.theme.typed.LongTypeValidator) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) BasicAttribute(javax.naming.directory.BasicAttribute) FessUserBean(org.codelibs.fess.mylasta.action.FessUserBean) Attribute(javax.naming.directory.Attribute) StreamUtil.split(org.codelibs.core.stream.StreamUtil.split) Locale(java.util.Locale) Map(java.util.Map) PrunedTag(org.codelibs.fess.util.PrunedTag) HtmlNext(org.lastaflute.web.response.next.HtmlNext) SortBuilder(org.elasticsearch.search.sort.SortBuilder) HttpSession(javax.servlet.http.HttpSession) LaJob(org.lastaflute.job.LaJob) StreamUtil.stream(org.codelibs.core.stream.StreamUtil.stream) FloatTypeValidator(org.lastaflute.web.validation.theme.typed.FloatTypeValidator) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) StringUtil(org.codelibs.core.lang.StringUtil) Set(java.util.Set) RequiredValidator(org.lastaflute.web.validation.RequiredValidator) Tuple3(org.codelibs.core.misc.Tuple3) Collectors(java.util.stream.Collectors) List(java.util.List) ComponentUtil(org.codelibs.fess.util.ComponentUtil) SearchRequestBuilder(org.elasticsearch.action.search.SearchRequestBuilder) SortOrder(org.elasticsearch.search.sort.SortOrder) Pattern(java.util.regex.Pattern) Collections(java.util.Collections) DoubleTypeValidator(org.lastaflute.web.validation.theme.typed.DoubleTypeValidator) FessFunctions(org.codelibs.fess.taglib.FessFunctions) BasicAttribute(javax.naming.directory.BasicAttribute) Attribute(javax.naming.directory.Attribute) StringUtil(org.codelibs.core.lang.StringUtil)

Example 25 with BasicAttribute

use of javax.naming.directory.BasicAttribute in project cxf by apache.

the class LdapCertificateRepo method addConstantAttributes.

private void addConstantAttributes(String names, String values, Attributes attribs) {
    String[] arrNames = names.split(",");
    String[] arrValues = values.split(",");
    if (arrNames.length != arrValues.length) {
        throw new IllegalArgumentException(String.format("Inconsintent constant attributes: %s; %s", names, values));
    }
    for (int i = 0; i < arrNames.length; i++) {
        attribs.put(new BasicAttribute(arrNames[i], arrValues[i]));
    }
}
Also used : BasicAttribute(javax.naming.directory.BasicAttribute)

Aggregations

BasicAttribute (javax.naming.directory.BasicAttribute)50 Attribute (javax.naming.directory.Attribute)30 BasicAttributes (javax.naming.directory.BasicAttributes)28 Attributes (javax.naming.directory.Attributes)19 ModificationItem (javax.naming.directory.ModificationItem)18 HashSet (java.util.HashSet)14 File (java.io.File)7 Set (java.util.Set)7 MutablePartitionConfiguration (org.apache.directory.server.core.configuration.MutablePartitionConfiguration)7 AbstractBootstrapSchema (org.apache.directory.server.core.schema.bootstrap.AbstractBootstrapSchema)7 DirContext (javax.naming.directory.DirContext)6 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)5 IOException (java.io.IOException)5 InputStream (java.io.InputStream)5 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 PrivkeySchema (org.nhindirect.ldap.PrivkeySchema)5 Collections (java.util.Collections)4 Date (java.util.Date)4 NamingException (javax.naming.NamingException)4