Active Directory/Connect: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|smart BASIC}}: Remove vanity tags) |
(Added Go) |
||
Line 92: | Line 92: | ||
let connect = new System.DirectoryServices.Protocols.LdapConnection(ldapServer) |
let connect = new System.DirectoryServices.Protocols.LdapConnection(ldapServer) |
||
connect.Bind()</lang> |
connect.Bind()</lang> |
||
=={{header|Go}}== |
|||
{{libheader|go-ldap-client}} |
|||
<br> |
|||
There are a large number of third-party LDAP libraries for Go. This uses one of the simpler ones and the code below is largely taken from the example on its main page. |
|||
<lang go>package main |
|||
import ( |
|||
"log" |
|||
"github.com/jtblin/go-ldap-client" |
|||
) |
|||
func main() { |
|||
client := &ldap.LDAPClient{ |
|||
Base: "dc=example,dc=com", |
|||
Host: "ldap.example.com", |
|||
Port: 389, |
|||
UseSSL: false, |
|||
BindDN: "uid=readonlyuser,ou=People,dc=example,dc=com", |
|||
BindPassword: "readonlypassword", |
|||
UserFilter: "(uid=%s)", |
|||
GroupFilter: "(memberUid=%s)", |
|||
Attributes: []string{"givenName", "sn", "mail", "uid"}, |
|||
} |
|||
defer client.Close() |
|||
err := client.Connect() |
|||
if err != nil { |
|||
log.Fatalf("Failed to connect : %+v", err) |
|||
} |
|||
// Do something |
|||
}</lang> |
|||
=={{header|Haskell}}== |
=={{header|Haskell}}== |