在GAE中的python SAML [英] python SAML in GAE
问题描述
是否有一个库可用于在App Engine中使用python进行SAML身份验证?
我看了 pysaml2 ,它确实说它是纯粹的python实现。但是,它使用subprocess.Popen,它不能在App Engine中使用,并且在那个时候会失败。
您可以使用python -saml on GAE如果您使用flex环境并使用由标准python27 构建的自定义运行时运行时由Google提供。我刚刚获得了onelogin的 python-saml flask-demo ,成功地处理了这个问题使用以下设置:
Dockerfile:
FROM gcr。 io / google_appengine / python
LABEL python_version = python
运行virtualenv / env -p python
#为运行时尚未包含的onelogin依赖项安装系统软件包
RUN apt - 更新&& apt-get --yes --quiet install python2.7-dev libxmlsec1-dev
#设置virtualenv环境变量。这相当于运行
#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
运行时:自定义
env:flex
入口点:python index.py
api_version:1
threadsafe:true
requirements.txt
flask == 0.10.1
python-saml
然后简单地执行 gcloud app deploy app.yaml --version v1
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.
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
这篇关于在GAE中的python SAML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!