python SAML in GAE

拈花ヽ惹草 提交于 2020-01-06 01:19:46

问题


Is there a library I can use to do a SAML authentication in App Engine using python?

I've looked at pysaml2 which does say it's pure python implementation. However, it's using subprocess.Popen which cannot be used within App Engine and will fail at that point.


回答1:


You can use python-saml on GAE if you use the flex environment with a custom runtime built off of the standard python27 runtime provided by google. I just got onelogin's python-saml flask-demo successfully working with this approach using the following settings:

Dockerfile:

FROM gcr.io/google_appengine/python
LABEL python_version=python
RUN virtualenv /env -p python

# Install system packages for onelogin dependencies not already included in runtime
RUN apt-get update && apt-get --yes --quiet install python2.7-dev libxmlsec1-dev

# Set virtualenv environment variables. This is equivalent to running
# source /env/bin/activate
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
ADD requirements.txt /app/
RUN pip install -r requirements.txt
ADD . /app/
CMD python index.py

app.yaml

runtime: custom
env: flex
entrypoint: python index.py

api_version: 1
threadsafe: true

requirements.txt

flask==0.10.1
python-saml

then simply do gcloud app deploy app.yaml --version v1




回答2:


Try python-saml or python3-saml



来源:https://stackoverflow.com/questions/31599304/python-saml-in-gae

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!