Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
schilder2000
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schilder
schilder2000
Commits
5b26c2df
Commit
5b26c2df
authored
9 months ago
by
Thomas Schneider
Browse files
Options
Downloads
Patches
Plain Diff
Add example config for login
parent
f16e5ed5
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!5
Auth
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/config.py
+112
-0
112 additions, 0 deletions
examples/config.py
with
112 additions
and
0 deletions
examples/config.py
+
112
−
0
View file @
5b26c2df
# Import as needed
from
onelogin.saml2.idp_metadata_parser
import
(
OneLogin_Saml2_IdPMetadataParser
as
IdPMetadataParser
,
)
from
deepmerge
import
always_merger
from
pathlib
import
Path
SQLALCHEMY_DATABASE_URI
=
"
postgresql+psycopg:///schilder2000
"
SQLALCHEMY_DATABASE_URI
=
"
postgresql+psycopg:///schilder2000
"
# To generate a secret key:
# To generate a secret key:
# % python -c 'import secrets; print(secrets.token_hex())'
# % python -c 'import secrets; print(secrets.token_hex())'
...
@@ -11,3 +19,107 @@ PRINTERS = {
...
@@ -11,3 +19,107 @@ PRINTERS = {
"
Office
"
:
"
ipps://printserver.example.com:443/printers/Office
"
,
"
Office
"
:
"
ipps://printserver.example.com:443/printers/Office
"
,
"
Kitchen
"
:
"
ipp://kitchenprinter.local:631/ipp/print
"
,
"
Kitchen
"
:
"
ipp://kitchenprinter.local:631/ipp/print
"
,
}
}
REQUIRE_LOGIN
=
True
# See upstream documentation for reference:
# https://flask-multipass.readthedocs.io
_ldap_config
=
{
"
uri
"
:
"
ldaps://dc.example.org:636
"
,
"
bind_dn
"
:
"
CN=schilder2000,CN=Service Accounts,CN=Users,DC=example,DC=org
"
,
"
bind_password
"
:
"
hunter2
"
,
"
timeout
"
:
30
,
"
verify_cert
"
:
True
,
# optional: if not present, uses certifi's CA bundle (if installed)
# "cert_file": "path/to/server/cert",
"
starttls
"
:
False
,
"
page_size
"
:
1000
,
"
uid
"
:
"
sAMAccountName
"
,
"
user_base
"
:
"
CN=Users,DC=example,DC=org
"
,
"
user_filter
"
:
"
(objectCategory=person)
"
,
}
_saml_config
=
always_merger
.
merge
(
IdPMetadataParser
.
parse_remote
(
"
https://idp.example.org/realms/owca/protocol/saml/descriptor
"
),
{
"
debug
"
:
False
,
"
sp
"
:
{
"
entityId
"
:
"
https://schilder2000.example.org/multipass/saml/fsmpi-saml/metadata
"
,
"
x509cert
"
:
(
Path
(
__file__
).
parent
/
"
saml-cert.pem
"
).
read_text
(),
"
privateKey
"
:
(
Path
(
__file__
).
parent
/
"
saml-key.pem
"
).
read_text
(),
# We don’t use the name anyway
"
NameIDFormat
"
:
"
urn:oasis:names:tc:SAML:2.0:nameid-format:transient
"
,
},
"
security
"
:
{
# Keycloak wants this, even though it doesn’t say so
"
logoutRequestSigned
"
:
True
,
},
},
)
_oidc_config
=
{
"
client_id
"
:
"
schilder2000
"
,
"
client_secret
"
:
"
hunter2
"
,
"
server_metadata_url
"
:
"
https://idp.example.org/realms/owca/.well-known/openid-configuration
"
,
"
client_kwargs
"
:
{
"
scope
"
:
"
openid
"
,
},
}
MULTIPASS_AUTH_PROVIDERS
=
{
"
test_auth_provider
"
:
{
"
type
"
:
"
static
"
,
"
title
"
:
"
Insecure dummy auth
"
,
"
identities
"
:
{
"
gustav
"
:
"
hunter2
"
,
},
},
"
fsmpi-ldap
"
:
{
"
type
"
:
"
ldap
"
,
"
title
"
:
"
O.W.C.A. LDAP
"
,
"
ldap
"
:
_ldap_config
,
},
"
fsmpi-saml
"
:
{
"
type
"
:
"
saml
"
,
"
title
"
:
"
O.W.C.A. SAML
"
,
"
saml_config
"
:
_saml_config
,
},
"
fsmpi-oidc
"
:
{
"
type
"
:
"
authlib
"
,
"
title
"
:
"
O.W.C.A. OIDC
"
,
"
authlib_args
"
:
_oidc_config
,
},
}
MULTIPASS_IDENTITY_PROVIDERS
=
{
"
test_identity_provider
"
:
{
"
type
"
:
"
static
"
,
"
identities
"
:
{
"
gustav
"
:
{},
},
},
"
ldap
"
:
{
"
type
"
:
"
ldap
"
,
"
ldap
"
:
_ldap_config
,
},
"
saml
"
:
{
"
type
"
:
"
saml
"
,
},
"
oidc
"
:
{
"
type
"
:
"
authlib
"
,
"
title
"
:
"
OIDC
"
,
},
}
MULTIPASS_PROVIDER_MAP
=
{
"
test_auth_provider
"
:
"
test_identity_provider
"
,
"
ldap
"
:
"
ldap
"
,
"
saml
"
:
"
saml
"
,
"
oidc
"
:
"
oidc
"
,
}
MULTIPASS_IDENTITY_INFO_KEYS
=
[]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment