Overview

ldapr is a system for LDAP authentication in R. It acts as a wrapper around lidlap to provide a central authentication mechanism to R products. The primary goal is to provide an LDAP client to shiny applications that require authentication, without having to resort to options such as Shiny Server Pro.

All suggestions are appreciated, so please get in touch.

Installation

As this package relies on libldap this needs to be installed at the system level.

For now this package is only available from GitHub.

# install.packages("devtools")
devtools::install_github("liamgilbey/ldapr")

Usage

The central object in ldapr is the R6 class ldap. As with all R6 classes, a new ldap object is created with the new method. For testing purposes, we can attempt to authenticate against the free online LDAP server hosted by zflexldap.

library(ldapr)
l <- ldap$new(
  host = "zflexldap.com",
  base_dn = "ou=users,ou=guests,dc=zflexsoftware,dc=com"
)
l
#> <LDAP connection>
#>   URI: ldap://zflexldap.com:389
#>   Authenticated: FALSE

Authenticating against the LDAP server is then easy with envoking the bind method.

l$bind(
  user = "guest1",
  pw = "guest1password",
  "uid"
)
#> <LDAP connection>
#>   URI: ldap://zflexldap.com:389
#>   Authenticated: TRUE
#>   Authenticated user: guest1
#>   Authenticated until: 2020-04-19 16:19:52

Once bound and authenticated with the LDAP server, we can perform search operations to lookup entries in the DN.

l$search("(uid=guest2)")
#> [1] "uid=guest2,ou=users,ou=guests,dc=zflexsoftware,dc=com"