Skip to main content

oauth2_proxy/oauth2-proxy compatible library to decode and validate authenticated cookie. compatible with cookie signed at sha256.Forked from isra17/oauth2-proxy-cookie.

Project description

https://circleci.com/gh/isra17/oauth2-proxy-cookie.svg?style=svg

Support library to be used with bitly/oauth2_proxy to validate and decode the Cookie passed upstream. The library provide a Flask extension to authorize requests based on the Cookie.

The reference implementation in Go is located here.

Forked from https://github.com/isra17/oauth2-proxy-cookie to modify sign from sha1 to sha256.

Example

from flask import request, abort
from oauth2_proxy_cookie import Validator

secret = <oauth2_proxy cookie secret>
validator = Validator(secret, '_oauth2_proxy')
cookie = request.headers.get('Cookie')
value, time = validator.validate(cookie)

Or with Flask extension:

from flask import request, abort
from oauth2_proxy_cookie import Validator

app = flask.Flask('Foo')
app.config.OAUTH2_PROXY_COOKIE_SECRET = <oauth2_proxy cookie secret>
oauth2_proxy = OAuth2ProxyCookie(force_https=True, allowed=['/public_path'])
oauth2_proxy.init_app(app)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oauth2-proxy-cookie-256-0.1.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oauth2_proxy_cookie_256-0.1.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page