Use SAML2 auth with Weblate

613 views Asked by At

I am trying to force Weblate running in docker to support SAML2 authentication (we have corporate ADFS). I found plugin for django. So I create own Dockerfile:

from weblate/weblate
RUN set -x \
    && apt-get install --no-install-recommends -y xmlsec1 build-essential \
    && pip install django_saml2_auth

RUN (echo && echo 'execfile("/app/data/settings.override.py")') >> /app/etc/settings.py

content of settings.override.py:

INSTALLED_APPS = INSTALLED_APPS + ('django_saml2_auth',)                                                      

SAML2_AUTH = {                                                                                                
    'METADATA_AUTO_CONF_URL': 'https://adfs.homecredit.net/federationmetadata/2007-06/federationmetadata.xml',
}                                                                                                             

I failed with setting of 'urls.py' as mantioned in plugin's manual (I cannot find this file inside docker container) - I am not python/django developer and don't know how to continue.

Thanks for help.

2

There are 2 answers

2
Michal Čihař On

Weblate already uses python-social-auth, so it's probably easier try it's SAML support first. At least you don't have to care about integration of authentication framework into Weblate, but just on setting up the authentication (what seems to be quite complex thing with SAML anyway).

See their docs for instructions: https://python-social-auth.readthedocs.io/en/latest/backends/saml.html

PS: If you manage to setup this, I'm happy to integrate this into Weblate - at least as documentation or any code changes if something is needed.

0
camelBack On

I recently tried to integrate this app into my dev environment, and I got stuck on a different issue, you can see in my question

Regarding your question- why are you creating settings.override.py?
Do you not have access to modify settings.py?
You need to see where the file actually resides in the Docker environment, did you place it in the wrong location?
It might be that you need to ADD the file, i.e:

ADD <file_name> /you/path/here/<file_name>

And then RUN the exec on that file.