@Override public void create() throws RealmUnavailableException { if (identityMapping.newIdentityParent == null || identityMapping.newIdentityAttributes == null) { throw log.ldapRealmNotConfiguredToSupportCreatingIdentities(); } DirContext context = obtainContext(); try { LdapName distinguishName = (LdapName) identityMapping.newIdentityParent.clone(); distinguishName.add(new Rdn(identityMapping.rdnIdentifier, name)); log.debugf("Creating identity [%s] with DN [%s] in LDAP", name, distinguishName.toString()); context.createSubcontext(distinguishName, identityMapping.newIdentityAttributes); } catch (NamingException e) { throw log.ldapRealmFailedCreateIdentityOnServer(e); } finally { closeContext(context); } }
private void storeAttributes(String alias, List<ModificationItem> items) throws KeyStoreException { DirContext context = obtainDirContext(); try { SearchResult result = searchAlias(context, alias, null, new String[]{}); LdapName distinguishName; if (result == null) { // alias not exists yet - create if (createPath == null || createAttributes == null || createRdn == null) throw log.creationNotConfigured(alias); distinguishName = (LdapName) createPath.clone(); distinguishName.add(new Rdn(createRdn, alias)); log.debugf("Creating keystore alias [%s] with DN [%s] in LDAP", alias, distinguishName.toString()); context.createSubcontext(distinguishName, createAttributes); items.add(new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(aliasAttribute, alias))); } else { distinguishName = new LdapName(result.getNameInNamespace()); } context.modifyAttributes(distinguishName, items.toArray(new ModificationItem[items.size()])); } catch (NamingException e) { throw log.ldapKeyStoreFailedToStore(alias, e); } finally { returnDirContext(context); } }
@Override public LdapName getBaseLdapName() { return (LdapName) base.clone(); }
@Override public LdapName getBaseLdapName() { return (LdapName) base.clone(); }
@Override public LdapName getBaseLdapName() { return (LdapName) base.clone(); }
@Override public LdapName getBaseLdapName() { return (LdapName) base.clone(); }
/** * {@inheritDoc} */ @Override public String getNameInNamespace() { if(base.size() == 0) { return dn.toString(); } try { LdapName result = (LdapName) dn.clone(); result.addAll(0, base); return result.toString(); } catch (InvalidNameException e) { throw new org.springframework.ldap.InvalidNameException(e); } }
/** * {@inheritDoc} */ @Override public String getNameInNamespace() { if(base.size() == 0) { return dn.toString(); } try { LdapName result = (LdapName) dn.clone(); result.addAll(0, base); return result.toString(); } catch (InvalidNameException e) { throw new org.springframework.ldap.InvalidNameException(e); } }
/** * {@inheritDoc} */ @Override public String getNameInNamespace() { if(base.size() == 0) { return dn.toString(); } try { LdapName result = (LdapName) dn.clone(); result.addAll(0, base); return result.toString(); } catch (InvalidNameException e) { throw new org.springframework.ldap.InvalidNameException(e); } }
/** * {@inheritDoc} */ @Override public String getNameInNamespace() { if(base.size() == 0) { return dn.toString(); } try { LdapName result = (LdapName) dn.clone(); result.addAll(0, base); return result.toString(); } catch (InvalidNameException e) { throw new org.springframework.ldap.InvalidNameException(e); } }
@Override public void create() throws RealmUnavailableException { if (identityMapping.newIdentityParent == null || identityMapping.newIdentityAttributes == null) { throw log.ldapRealmNotConfiguredToSupportCreatingIdentities(); } DirContext context = obtainContext(); try { LdapName distinguishName = (LdapName) identityMapping.newIdentityParent.clone(); distinguishName.add(new Rdn(identityMapping.rdnIdentifier, name)); log.debugf("Creating identity [%s] with DN [%s] in LDAP", name, distinguishName.toString()); context.createSubcontext(distinguishName, identityMapping.newIdentityAttributes); } catch (NamingException e) { throw log.ldapRealmFailedCreateIdentityOnServer(e); } finally { closeContext(context); } }
@Override public void create() throws RealmUnavailableException { if (identityMapping.newIdentityParent == null || identityMapping.newIdentityAttributes == null) { throw log.ldapRealmNotConfiguredToSupportCreatingIdentities(); } DirContext context = obtainContext(); try { LdapName distinguishName = (LdapName) identityMapping.newIdentityParent.clone(); distinguishName.add(new Rdn(identityMapping.rdnIdentifier, name)); log.debugf("Creating identity [%s] with DN [%s] in LDAP", name, distinguishName.toString()); context.createSubcontext(distinguishName, identityMapping.newIdentityAttributes); } catch (NamingException e) { throw log.ldapRealmFailedCreateIdentityOnServer(e); } finally { closeContext(context); } }
@Override public void create() throws RealmUnavailableException { if (identityMapping.newIdentityParent == null || identityMapping.newIdentityAttributes == null) { throw log.ldapRealmNotConfiguredToSupportCreatingIdentities(); } DirContext context = obtainContext(); try { LdapName distinguishName = (LdapName) identityMapping.newIdentityParent.clone(); distinguishName.add(new Rdn(identityMapping.rdnIdentifier, name)); log.debugf("Creating identity [%s] with DN [%s] in LDAP", name, distinguishName.toString()); context.createSubcontext(distinguishName, identityMapping.newIdentityAttributes); } catch (NamingException e) { throw log.ldapRealmFailedCreateIdentityOnServer(e); } finally { closeContext(context); } }
private void storeAttributes(String alias, List<ModificationItem> items) throws KeyStoreException { DirContext context = obtainDirContext(); try { SearchResult result = searchAlias(context, alias, null, new String[]{}); LdapName distinguishName; if (result == null) { // alias not exists yet - create if (createPath == null || createAttributes == null || createRdn == null) throw log.creationNotConfigured(alias); distinguishName = (LdapName) createPath.clone(); distinguishName.add(new Rdn(createRdn, alias)); log.debugf("Creating keystore alias [%s] with DN [%s] in LDAP", alias, distinguishName.toString()); context.createSubcontext(distinguishName, createAttributes); items.add(new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(aliasAttribute, alias))); } else { distinguishName = new LdapName(result.getNameInNamespace()); } context.modifyAttributes(distinguishName, items.toArray(new ModificationItem[items.size()])); } catch (NamingException e) { throw log.ldapKeyStoreFailedToStore(alias, e); } finally { returnDirContext(context); } }
private void storeAttributes(String alias, List<ModificationItem> items) throws KeyStoreException { DirContext context = obtainDirContext(); try { SearchResult result = searchAlias(context, alias, null, new String[]{}); LdapName distinguishName; if (result == null) { // alias not exists yet - create if (createPath == null || createAttributes == null || createRdn == null) throw log.creationNotConfigured(alias); distinguishName = (LdapName) createPath.clone(); distinguishName.add(new Rdn(createRdn, alias)); log.debugf("Creating keystore alias [%s] with DN [%s] in LDAP", alias, distinguishName.toString()); context.createSubcontext(distinguishName, createAttributes); items.add(new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(aliasAttribute, alias))); } else { distinguishName = new LdapName(result.getNameInNamespace()); } context.modifyAttributes(distinguishName, items.toArray(new ModificationItem[items.size()])); } catch (NamingException e) { throw log.ldapKeyStoreFailedToStore(alias, e); } finally { returnDirContext(context); } }
private void storeAttributes(String alias, List<ModificationItem> items) throws KeyStoreException { DirContext context = obtainDirContext(); try { SearchResult result = searchAlias(context, alias, null, new String[]{}); LdapName distinguishName; if (result == null) { // alias not exists yet - create if (createPath == null || createAttributes == null || createRdn == null) throw log.creationNotConfigured(alias); distinguishName = (LdapName) createPath.clone(); distinguishName.add(new Rdn(createRdn, alias)); log.debugf("Creating keystore alias [%s] with DN [%s] in LDAP", alias, distinguishName.toString()); context.createSubcontext(distinguishName, createAttributes); items.add(new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(aliasAttribute, alias))); } else { distinguishName = new LdapName(result.getNameInNamespace()); } context.modifyAttributes(distinguishName, items.toArray(new ModificationItem[items.size()])); } catch (NamingException e) { throw log.ldapKeyStoreFailedToStore(alias, e); } finally { returnDirContext(context); } }