Jump to content

Active Directory/Connect: Difference between revisions

formatting
mNo edit summary
(formatting)
Line 116:
 
=={{header|Kotlin}}==
<lang scala>package directory
import org.apache.directory.api.ldap.model.exception.LdapException
 
import org.apache.directory.ldap.client.api.LdapNetworkConnection
import kotlin.properties.get
 
import java.io.IOException
import java.util.logging.Level
import java.util.logging.Logger
 
class LDAP(val map: Map<String, String>) {
import org.apache.directory.api.ldap.model.exception.LdapException
import org.apache.directory.ldap.client.api.LdapNetworkConnection
 
class LDAP(val map: Map<String, String>) {
fun run() {
var connection: LdapNetworkConnection? = null
try {
if (info) log.info("LDAP Connection to $hostname on port $port")
log.info("LDAP Connection to $hostname on port $port")
connection = LdapNetworkConnection(hostname, port.toInt())
 
try {
if (info) log.info("LDAP bind")
log.info("LDAP bind")
connection.bind()
} catch (e: LdapException) {
Line 144 ⟶ 138:
 
try {
if (info) log.info("LDAP unbind")
log.info("LDAP unbind")
connection.unBind()
} catch (e: LdapException) {
Line 152 ⟶ 145:
} finally {
try {
if (info) log.info("LDAP close connection")
log.info("LDAP close connection")
connection!!.close()
} catch (e: IOException) {
Line 167 ⟶ 159:
}
 
fun main(args: Array<String>) = LDAP(mapOf("hostname" to "localhost", "port" to "10389")).run()</lang>
</lang>
 
=={{header|NetRexx}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.