Categorygithub.com/ppreeper/addictgo
modulepackage
0.0.0-20241015204456-c193db042a9e
Repository: https://github.com/ppreeper/addictgo.git
Documentation: pkg.go.dev

# README

//The Nitty Gritty //Passing Secrets

//You can pass the AD details at runtime:

//addict --url ldaps://[address] --user [user]@[domain] --pass [pass]

//As environmental variables:

//export ADDICT_URL=ldaps://[address] //export ADDICT_USER=[user]@[domain] //export ADDICT_PASS=[pass]

//Or in ./config.json:

//git clone https://github.com/dthree/addict.git //cd addict //vim ./config.json

//{ //... //"user": "[user]@[domain]", //"pass": "[pass]", //"url": "ldaps://[address]" //}

//Authentication

//This service defaults to no authentication. I can't and won't try to guess your flavor.

//Addict uses express. The file ./middleware.js at the root of the directory exposes the app so you can add middleware hooks for auth logic. //LDAP vs LDAPS

//If you connect to Active Directory over plain LDAP, it will refuse certain write operations including adding a user and changing a password. To make things even better, Windows Server doesn't support LDAPS out of the box. You're going to have to set up the Domain Controller as a cert authority by installing the Active Directory Certificate Services Role.

//Here's a good tutorial on that.

# Packages

Package docs Code generated by swaggo/swag.
No description provided by the author
No description provided by the author

# Functions

@Summary Get all objects @Description Pulls all Active Directory objects @Tags other @Accept plain @Param _fields query []string false "Comma-delimited field names to return" @Param _q query []string false "Searches all fields for given string" @Param _start query int false "Result Index to start from" @Param _end query int false "Result Index to end to" @Produce json @Success 200 "OK" @Router /all [get].
@Summary Search Active Directory @Description Does a raw Active Directory search @Tags other @Accept plain @Param filter path string true "Search filter" @Produce json @Success 200 "OK" @Router /find/{filter} [get].
No description provided by the author
@Summary Get all groups @Description Pulls all groups in Active Directory, with filters.
@Summary Remove a group @Description Removes a group from Active Directory @Tags group @Accept plain @Param group path string true "The group name" @Produce json @Success 200 "OK" @Router /group/{group} [delete].
@Summary Group exists @Description Returns whether a group exists or not @Tags group @Accept plain @Param group path string true "The group name" @Produce json @Success 200 "OK" @Router /group/{group}/exists [get].
@Summary Get a single group @Description Pulls a single group @Tags group @Accept plain @Param group path string true "The group name" @Param _fields query []string false "Comma-delimited field names to return" @Param _q query []string false "Searches all fields for given string" @Param _start query int false "Result Index to start from" @Param _end query int false "Result Index to end to" @Produce json @Success 200 "OK" @Router /group/{group} [get].
@Summary Remove user from group @Description Removes a user from a group @Tags group @Accept plain @Param group path string true "The group name" @Param user path string true "The user logon name" @Produce json @Success 200 "OK" @Router /group/{group}/user/{user} [delete].
@Summary Add user to group @Description Adds a user to a group @Tags group @Accept plain @Param group path string true "The group name" @Param user path string true "The user logon name" @Produce json @Success 200 "OK" @Router /group/{group}/user/{user} [post].
@Summary Add a group @Description Adds a new group to Active Directory @Tags group @Accept plain @Param name body string true "Name of the group as displayed" @Param description body string false "Descripton of the group" @Param location body string false "Relative AD Position separated by /" @Produce json @Success 201 "Created" @Router /group [post].
LookupEnvOrInt provides 12 Factor for int vars.
LookupEnvOrString provides 12 Factor for string vars.
No description provided by the author
@Summary Get all other objects @Description Pulls all non-user/group Active Directory objects @Tags other @Produce json @Success 200 "OK" @Router /other [get].
No description provided by the author
@Summary Get all OUs @Description Pulls all Organization Units in Active Directory, with filters @Tags ou @Accept plain @Param _fields query []string false "Comma-delimited field names to return" @Param _q query []string false "Searches all fields for given string" @Param _start query int false "Result Index to start from" @Param _end query int false "Result Index to end to" @Produce json @Success 200 "OK" @Router /ou [get].
@Summary Remove an OU @Description Removes the OU from Active Directory @Tags ou @Accept plain @Param ou path string true "The OU name" @Produce json @Success 200 "OK" @Router /ou/{ou} [delete].
@Summary OU exists @Description Returns whether a OU exists or not @Tags ou @Accept plain @Param ou path string true "The OU name" @Produce json @Success 200 "OK" @Router /ou/{ou}/exists [get].
@Summary Get a single OU @Description Pulls a single OU @Tags ou @Accept plain @Param ou path string true "The OU name" @Param _fields query []string false "Comma-delimited field names to return" @Param _q query []string false "Searches all fields for given string" @Param _start query int false "Result Index to start from" @Param _end query int false "Result Index to end to" @Produce json @Success 200 "OK" @Router /ou/{ou} [get].
@Summary Add an OU @Description Adds a new OU to Active Directory @Tags ou @Accept plain @Param name body string true "Name of the OU as displayed" @Param description body string false "Descripton of the OU" @Param location body string false "Relative AD Position separated by /" @Produce json @Success 201 "Created" @Router /ou [post].
@Summary Get API status @Description Gives the uptime and status of the API.
No description provided by the author
@Summary Add a user @Description Adds a new user to Active Directory @Tags users @Accept plain @Param userName body string true "User name" @Param pass body string false "Password to log in" @Param commonName body string false "Equivalent to the user's full name" @Param firstName body string false "First name" @Param lastName body string false "Last name" @Param email body string false "Email address" @Param title body string false "Job title" @Param location body string false "Relative AD folder position" @Produce json @Success 201 "Created" @Router /user [post].
@Summary Get all users @Description Pulls all users in Active Directory, with filters @Tags users @Accept plain @Param _fields query []string false "Comma-delimited field names to return" @Param _q query []string false "Searches all fields for given string" @Param _start query int false "Result Index to start from" @Param _end query int false "Result Index to end to" @Produce json @Success 200 "OK" @Router /user [get].
@Summary Authenticate a user @Description Runs a username and password against AD @Tags users @Accept plain @Param user path string true "The user logon name" @Param password body string true "The users password" @Produce json @Success 200 "OK" @Router /user/{user}/authenticate [post].
@Summary Remove a user @Description Removes a user from Active Directory @Tags users @Accept plain @Param user path string true "The user logon name" @Produce json @Success 200 "OK" @Router /user/{user} [delete].
@Summary Disable a user @Description Disables the users account @Tags users @Accept plain @Param user path string true "The user logon name" @Produce json @Success 200 "OK" @Router /user/{user}/disable [put].
@Summary Enable a user @Description Enables the users account @Tags users @Accept plain @Param user path string true "The user logon name" @Produce json @Success 200 "OK" @Router /user/{user}/enable [put].
@Summary User exists @Description Returns whether a user exists or not @Tags users @Accept plain @Param user path string true "The user logon name" @Produce json @Success 200 "OK" @Router /user/{user}/exists [get].
@Summary Get a user @Description Pulls a single user @Tags users @Accept plain @Param user path string true "The user logon name" @Param _fields query []string false "Comma-delimited field names to return" @Param _q query []string false "Searches all fields for given string" @Param _start query int false "Result Index to start from" @Param _end query int false "Result Index to end to" @Produce json @Success 200 "OK" @Router /user/{user} [get].
@Summary User is a member of group @Description Returns whether a user is a member of a group or not @Tags users @Accept plain @Param user path string true "The user logon name" @Param group path string true "The group name" @Produce json @Success 200 "OK" @Router /user/{user}/member-of/{group} [get].
@Summary Move a user @Description Moves a user to a new location relative to the directory root @Tags users @Accept plain @Param user path string true "The user logon name" @Param location body string true "The new position, separated by /" @Produce json @Success 200 "OK" @Router /user/{user}/move [put].
@Summary Set password expires @Description Set the password to eventually expire @Tags users @Accept plain @Param user path string true "The user logon name" @Produce json @Success 200 "OK" @Router /user/{user}/password-expires [put].
@Summary Set password never expires @Description Sets the password to never expire @Tags users @Accept plain @Param user path string true "The user logon name" @Produce json @Success 200 "OK" @Router /user/{user}/password-never-expires [put].
@Summary Change a password @Description Changes the users password @Tags users @Accept plain @Param user path string true "The user logon name" @Param password body string true "The users password" @Produce json @Success 200 "OK" @Router /user/{user}/password [put].
@Summary Update a user @Description Updates properties of a user @Tags users @Accept plain @Param user path string true "The user logon name" @Param password body string false "Password of user" @Param firstName body string false "First name of user" @Param lastName body string false "Last name of user" @Param commonName body string false "Full name of user" @Param email body string false "Email address of user" @Param title body string false "Job title of user" @Param enabled body string false "Whether the account is enabled" @Param passwordExpires body string false "Whether the password should expire" @Produce json @Success 200 "OK" @Router /user/{user} [put].
@Summary Unlock a user @Description Unlocks a user @Tags users @Accept plain @Param user path string true "The user logon name" @Produce json @Success 200 "OK" @Router /user/{user}/unlock [put].