Socket
Book a DemoInstallSign in
Socket

@3kles/3kles-ldap

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@3kles/3kles-ldap

3KLES LDAP

latest
npmnpm
Version
2.0.1
Version published
Maintainers
4
Created
Source

3KLES-LDAP

This package contains API and controller to manage LDAP and ActiveDirectory

API

LDAPApi implements IGenericAPI (3kles-corebe):

  • buildRequest: Method to build ldap request from paramater and data body
  • executeRequest: Methode to execute ldapts client method

Controller

LDAPController is a class based on GenericController (3kles-corebe)

  • addGenericParameters: Add parameter to controller
  • addList:Specific method to add parameter for ldap search
  • addAdd:Specific method to add parameter for ldap add
  • addDelete:Specific method to add parameter for ldap delete
  • addModify:Specific method to add parameter for ldap modify

ADController is a class inherit LDAPController to manage ActiveDirectory

  • parseResponse: Implement method from parent to parseResponse (specific ActiveDirectory)

How to use

Use .env file to fill ldap parameter (See example in root folder) The app.js is currently configurate only for ActiveDirectory to add, delete and list the entities User, Group and Computer

The routes for each entity is composed like follows:

  • list{entity name}:GET (example: listUser)
  • add{entity name}:POST(example: addUser)
  • del{entity name}:PUT(example: delUser)

To add an entity:

{
	"dn": "CN=TESTLDAP,CN=Users,OU=INTERNAL,O=3KC,DC=3KLES,DC=local",
	"entry":{
            "objectClass": [
                "top",
                "person",
                "organizationalPerson",
                "user"
            ],
            "givenName": "FirstName",
            "sn": "Name",
            "mail":"f.name@3kles-consulting.com",
            "sAMAccountName": "TESTLDAP",
            "userPrincipalName":"TESTLDAP@3KLES.local",
            "userAccountControl":"544", //Activate user
            "userPassword":"3Kles2018!"
        }
}

To del an entity:

{
	"dn": "CN=TESTLDAP,CN=Users,OU=INTERNAL,O=3KC,DC=3KLES,DC=local"
}

To update an entity: if ldap attribute exist you can use only replace even if attribute is empty One change:

{
	"dn": "CN=TESTLDAP,CN=Users,OU=INTERNAL,O=3KC,DC=3KLES,DC=local",
	"change":{
		"operation":"replace",
		"modification":{
			"type":"co",
			"values":["France"]
		}
	}
}

Mutli change change:

{
	"dn": "CN=TESTLDAP,CN=Users,OU=INTERNAL,O=3KC,DC=3KLES,DC=local",
	"change":[
        {
		"operation":"replace",
		"modification":{
			"type":"co",
			"values":["France"]
        }
        },
        {
		"operation":"replace",
		"modification":{
			"type":"co",
			"values":["France"]
        }
        }
    ]
}

Error response:

{
    "code": 32,
    "message":"0000208D: NameErr: DSID-03100238, problem 2001 (NO_OBJECT), data 0, best match of:'CN=Users,OU=INTERNAL,O=3KC,DC=3KLES,DC=local'"
}

Keywords

3KLES

FAQs

Package last updated on 28 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts