Skip to content
GitLab
Explore
Sign in
Register
shore
ldap-auth
Compare revisions
527b6bddbfd48fba78956526150b6203ad1a723c to 703db441bf52cbf4a17eb729ead8f037d8dccd59
Commits on Source (4)
Update the base image.
· a3561da1
nimrod
authored
Jul 16, 2022
a3561da1
Use renamed CI templates repo.
· 7fccf665
nimrod
authored
Jul 16, 2022
7fccf665
Update pre-commit.
· a694e56d
nimrod
authored
Jul 16, 2022
a694e56d
Some pre-commit fixes.
· 703db441
nimrod
authored
Jul 16, 2022
703db441
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
703db441
---
---
include
:
include
:
-
project
:
shore/ci-
templates
-
project
:
shore/ci-
stuff
file
:
templates/pre-commit.yml
file
:
templates/pre-commit.yml
-
project
:
shore/ci-
templates
-
project
:
shore/ci-
stuff
file
:
templates/docker.yml
file
:
templates/docker.yml
stages
:
stages
:
...
@@ -10,7 +10,7 @@ stages:
...
@@ -10,7 +10,7 @@ stages:
-
build
-
build
-
deploy
-
deploy
build
:
docker-
build
:
extends
:
.docker-build-shore
extends
:
.docker-build-shore
push
:
push
:
...
...
.pre-commit-config.yaml
View file @
703db441
---
---
repos
:
repos
:
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
.git
rev
:
v
3.4
.0
rev
:
v
4.3
.0
hooks
:
hooks
:
-
id
:
check-executables-have-shebangs
-
id
:
check-merge-conflict
-
id
:
check-merge-conflict
-
id
:
check-toml
-
id
:
check-yaml
files
:
Pipfile
-
id
:
detect-private-key
-
id
:
end-of-file-fixer
-
id
:
trailing-whitespace
-
id
:
trailing-whitespace
exclude
:
\.diff$
-
repo
:
https://github.com/
Yelp/detect-secrets
-
repo
:
https://github.com/
codespell-project/codespell.git
rev
:
v
0
.1
4.3
rev
:
v
2
.1
.0
hooks
:
hooks
:
-
id
:
detect-secrets
-
id
:
codespell
-
repo
:
https://github.com/
adrienverge/yamllin
t
-
repo
:
https://github.com/
Yelp/detect-secrets.gi
t
rev
:
v1.2
5
.0
rev
:
v1.2.0
hooks
:
hooks
:
-
id
:
yamllint
-
id
:
detect-secrets
-
repo
:
https://github.com/amperser/proselint
/
-
repo
:
https://github.com/amperser/proselint
.git
rev
:
0.10.2
rev
:
0.10.2
hooks
:
hooks
:
-
id
:
proselint
-
id
:
proselint
types
:
[
plain-text
]
types
:
[
plain-text
]
exclude
:
LICENSE
exclude
:
LICENSE
-
repo
:
https://github.com/ambv/black
-
repo
:
https://gitlab.com/devopshq/gitlab-ci-linter.git
rev
:
20.8b1
rev
:
v1.0.3
hooks
:
-
id
:
gitlab-ci-linter
args
:
-
"
--server"
-
https://git.shore.co.il
-
repo
:
https://git.shore.co.il/nimrod/yamltool.git
rev
:
v0.1.2
hooks
:
-
id
:
yamltool
-
repo
:
https://github.com/adrienverge/yamllint.git
rev
:
v1.27.1
hooks
:
-
id
:
yamllint
-
repo
:
https://github.com/executablebooks/mdformat.git
rev
:
0.7.14
hooks
:
-
id
:
mdformat
-
repo
:
https://github.com/AleksaC/hadolint-py.git
rev
:
v2.10.0
hooks
:
-
id
:
hadolint
-
repo
:
https://github.com/ambv/black.git
rev
:
22.6.0
hooks
:
hooks
:
-
id
:
black
-
id
:
black
args
:
args
:
-
|
-
|
--line-length=79
--line-length=79
-
repo
:
https://github.com/PyCQA/prospector
-
repo
:
https://github.com/PyCQA/isort
rev
:
1.3.1
rev
:
5.10.1
hooks
:
-
id
:
isort
args
:
[
"
--filter-files"
,
"
--profile"
,
"
black"
]
-
repo
:
https://github.com/PyCQA/prospector.git
rev
:
1.7.7
hooks
:
hooks
:
-
id
:
prospector
-
id
:
prospector
args
:
args
:
...
@@ -62,7 +97,7 @@ repos:
...
@@ -62,7 +97,7 @@ repos:
-
pyroma
-
pyroma
-
repo
:
https://gitlab.com/pycqa/flake8.git
-
repo
:
https://gitlab.com/pycqa/flake8.git
rev
:
3.
8.4
rev
:
3.
9.2
hooks
:
hooks
:
-
id
:
flake8
-
id
:
flake8
args
:
args
:
...
@@ -70,13 +105,29 @@ repos:
...
@@ -70,13 +105,29 @@ repos:
--doctests
--doctests
additional_dependencies
:
additional_dependencies
:
-
flake8-bugbear
-
flake8-bugbear
-
flake8-builtins
-
flake8-comprehensions
-
flake8-loopy
-
flake8-pie
-
flake8-tuple
-
flake8-warnings
-
repo
:
https://github.com/
executablebooks/mdformat
.git
-
repo
:
https://github.com/
Lucas-C/pre-commit-hooks-safety
.git
rev
:
0.5.3
rev
:
v1.3.0
hooks
:
hooks
:
-
id
:
mdformat
-
id
:
python-safety-dependencies-check
-
repo
:
https://git
.shore.co.il/nimrod/docker-pre-commit
.git
/
-
repo
:
https://git
hub.com/asottile/pyupgrade
.git
rev
:
v
0
.3
.0
rev
:
v
2
.3
7.1
hooks
:
hooks
:
-
id
:
hadolint
-
id
:
pyupgrade
-
repo
:
https://github.com/hadialqattan/pycln.git
rev
:
v2.0.2
hooks
:
-
id
:
pycln
-
repo
:
https://github.com/PyCQA/docformatter.git
rev
:
v1.4
hooks
:
-
id
:
docformatter
Dockerfile
View file @
703db441
FROM
registry.hub.
docker.
com
/library/python:3.
9
-slim-bu
ster
as
wheels
FROM
docker.
io
/library/python:3.
10
-slim-bu
llseye
as
wheels
# hadolint ignore=DL3008,DL3015
# hadolint ignore=DL3008,DL3015
RUN
apt-get update
&&
\
RUN
apt-get update
&&
\
DEBIAN_FRONTEND
=
noninteractive apt-get
install
-y
\
DEBIAN_FRONTEND
=
noninteractive apt-get
install
-y
\
...
@@ -9,9 +9,10 @@ RUN apt-get update && \
...
@@ -9,9 +9,10 @@ RUN apt-get update && \
;
;
WORKDIR
/wheels
WORKDIR
/wheels
RUN
python3
-m
pip wheel https://github.com/python-ldap/python-ldap/releases/download/python-ldap-3.3.1/python-ldap-3.3.1.tar.gz
RUN
python3
-m
pip wheel https://github.com/python-ldap/python-ldap/releases/download/python-ldap-3.3.1/python-ldap-3.3.1.tar.gz
# hadolint ignore=DL3059
RUN
python3
-m
pip wheel git+https://github.com/adarnimrod/flask-simpleldap.git@ldapi-support#egg
=
flask-simpleldap
RUN
python3
-m
pip wheel git+https://github.com/adarnimrod/flask-simpleldap.git@ldapi-support#egg
=
flask-simpleldap
FROM
registry.hub.
docker.
com
/library/python:3.
9
-slim-bu
ster
FROM
docker.
io
/library/python:3.
10
-slim-bu
llseye
# hadolint ignore=DL3008
# hadolint ignore=DL3008
RUN
apt-get update
&&
\
RUN
apt-get update
&&
\
DEBIAN_FRONTEND
=
noninteractive apt-get
install
-y
--no-install-recommends
\
DEBIAN_FRONTEND
=
noninteractive apt-get
install
-y
--no-install-recommends
\
...
@@ -21,6 +22,7 @@ RUN apt-get update && \
...
@@ -21,6 +22,7 @@ RUN apt-get update && \
&&
\
&&
\
rm
-rf
/tmp/
*
/var/tmp/
*
/var/lib/apt/lists/
*
/var/cache/apt/archives/
*
rm
-rf
/tmp/
*
/var/tmp/
*
/var/lib/apt/lists/
*
/var/cache/apt/archives/
*
COPY
--from=wheels /wheels/*.whl /wheels/
COPY
--from=wheels /wheels/*.whl /wheels/
# hadolint ignore=DL3042
RUN
pip
install
/wheels/
*
.whl
RUN
pip
install
/wheels/
*
.whl
WORKDIR
/app
WORKDIR
/app
COPY
requirements.txt ./
COPY
requirements.txt ./
...
...
README.md
View file @
703db441
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
[
![pipeline status
](
https://git.shore.co.il/shore/ldap-auth/badges/master/pipeline.svg
)
](https://git.shore.co.il/shore/ldap-auth/-/commits/master)
[
![pipeline status
](
https://git.shore.co.il/shore/ldap-auth/badges/master/pipeline.svg
)
](https://git.shore.co.il/shore/ldap-auth/-/commits/master)
LDAP authentication webserver to use with Nginx' auth
\
_
request. See this
[
blog
LDAP authentication webserver to use with Nginx' auth_request. See this
[
blog
post
](
https://www.shore.co.il/blog/ldap-auth/
)
for further explanation.
post
](
https://www.shore.co.il/blog/ldap-auth/
)
for further explanation.
## Configuration
## Configuration
...
...
app.py
View file @
703db441
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# pylint: disable=import-error
# pylint: disable=import-error
import
os
import
os
from
flask
import
Flask
from
flask
import
Flask
from
flask_simpleldap
import
LDAP
from
flask_simpleldap
import
LDAP
...
@@ -44,6 +45,7 @@ def ping():
...
@@ -44,6 +45,7 @@ def ping():
@app.route
(
"
/validate
"
)
@app.route
(
"
/validate
"
)
@ldap.basic_auth_required
@ldap.basic_auth_required
def
login
():
def
login
():
"""
Login to the app, requires LDAP authentication.
"""
return
"
OK
"
return
"
OK
"
...
...