Refine documentation and code doc
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -12,3 +12,5 @@
|
|||||||
|
|
||||||
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
|
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
|
||||||
.glide/
|
.glide/
|
||||||
|
vendor/
|
||||||
|
*.lock
|
||||||
|
26
Gopkg.toml
Normal file
26
Gopkg.toml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
# Gopkg.toml example
|
||||||
|
#
|
||||||
|
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
||||||
|
# for detailed Gopkg.toml documentation.
|
||||||
|
#
|
||||||
|
# required = ["github.com/user/thing/cmd/thing"]
|
||||||
|
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||||
|
#
|
||||||
|
# [[constraint]]
|
||||||
|
# name = "github.com/user/project"
|
||||||
|
# version = "1.0.0"
|
||||||
|
#
|
||||||
|
# [[constraint]]
|
||||||
|
# name = "github.com/user/project2"
|
||||||
|
# branch = "dev"
|
||||||
|
# source = "github.com/myfork/project2"
|
||||||
|
#
|
||||||
|
# [[override]]
|
||||||
|
# name = "github.com/x/y"
|
||||||
|
# version = "2.4.0"
|
||||||
|
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
name = "gopkg.in/ldap.v2"
|
||||||
|
version = "2.5.1"
|
5
Makefile
5
Makefile
@ -3,8 +3,11 @@ VER=1.0
|
|||||||
|
|
||||||
.PHONY: all build push
|
.PHONY: all build push
|
||||||
|
|
||||||
all: build docker push clean
|
all: init build docker push clean
|
||||||
|
|
||||||
|
init:
|
||||||
|
dep ensure
|
||||||
|
|
||||||
build:
|
build:
|
||||||
GOOS=linux go build -o ldap-pass-webui main.go
|
GOOS=linux go build -o ldap-pass-webui main.go
|
||||||
|
|
||||||
|
29
README.md
29
README.md
@ -4,7 +4,29 @@ WebUI Client capable of connecting to backend LDAP server and changing the users
|
|||||||
|
|
||||||
![Screenshot](screenshots/index.png)
|
![Screenshot](screenshots/index.png)
|
||||||
|
|
||||||
## Running in docker container
|
The configuration is made with environment variables:
|
||||||
|
|
||||||
|
|Env variable|Default value|Description|
|
||||||
|
|------------|-------------|-----------|
|
||||||
|
|LPW_TITLE|Change your global password for example.org|Title that will appear on the page|
|
||||||
|
|LPW_HOST||LDAP Host to connect to|
|
||||||
|
|LPW_PORT|636|LDAP Port (389|636 are default LDAP/LDAPS)|
|
||||||
|
|LPW_ENCRYPTED|true|Use enrypted communication|
|
||||||
|
|LPW_START_TLS|false|Start TLS communication|
|
||||||
|
|LPW_SSL_SKIP_VERIFY|true|Skip TLS CA verification|
|
||||||
|
|LPW_USER_DN|uid=%s,ou=people,dc=example,dc=org|Filter expression to search the user for Binding|
|
||||||
|
|LPW_USER_BASE|ou=people,dc=example,dc=org|Base to use when doing the binding|
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
```sh
|
||||||
|
dep ensure
|
||||||
|
LPW_HOST=ldap_host_ip go run main.go
|
||||||
|
```
|
||||||
|
|
||||||
|
Browse [http://localhost:8080/](http://localhost:8080/)
|
||||||
|
|
||||||
|
### Running in docker container
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run -d -p 8080:8080 --name ldap-passwd-webui \
|
docker run -d -p 8080:8080 --name ldap-passwd-webui \
|
||||||
@ -21,6 +43,11 @@ docker run -d -p 8080:8080 --name ldap-passwd-webui \
|
|||||||
|
|
||||||
## Building and tagging
|
## Building and tagging
|
||||||
|
|
||||||
|
Get [Godep](https://github.com/golang/dep)
|
||||||
|
```sh
|
||||||
|
go get -u github.com/golang/dep/cmd/dep
|
||||||
|
```
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
@ -19,14 +19,17 @@ type route struct {
|
|||||||
handler http.Handler
|
handler http.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RegexpHandler is used for http handler to bind using regular expressions
|
||||||
type RegexpHandler struct {
|
type RegexpHandler struct {
|
||||||
routes []*route
|
routes []*route
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handler binds http handler on RegexpHandler
|
||||||
func (h *RegexpHandler) Handler(pattern *regexp.Regexp, verb string, handler http.Handler) {
|
func (h *RegexpHandler) Handler(pattern *regexp.Regexp, verb string, handler http.Handler) {
|
||||||
h.routes = append(h.routes, &route{pattern, verb, handler})
|
h.routes = append(h.routes, &route{pattern, verb, handler})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HandleFunc binds http handler function on RegexpHandler
|
||||||
func (h *RegexpHandler) HandleFunc(r string, v string, handler func(http.ResponseWriter, *http.Request)) {
|
func (h *RegexpHandler) HandleFunc(r string, v string, handler func(http.ResponseWriter, *http.Request)) {
|
||||||
re := regexp.MustCompile(r)
|
re := regexp.MustCompile(r)
|
||||||
h.routes = append(h.routes, &route{re, v, http.HandlerFunc(handler)})
|
h.routes = append(h.routes, &route{re, v, http.HandlerFunc(handler)})
|
||||||
|
Reference in New Issue
Block a user