puiterwijk / flask-oidc

OpenID Connect support for Flask
BSD 2-Clause "Simplified" License
154 stars 217 forks source link

Dynamic Provider #70

Open HarryKodden opened 5 years ago

HarryKodden commented 5 years ago

Add ability to connect to an OIDC OP at Runtime. For backwards compatibility the existing config option OIDC_CLIENT_SECRETS is still supported.

Usage for dynamic OP connectivity is:

Initialize the Flask App as normal:

app = Flask(__name__)
oidc =  OpenIDConnect(app)

Specify the Provider to connect with:

my_provider = { 
   'base_url': 'https://example.org' , 
   'registration': { 'client_id': 'xxx', 'client_secret': 'yyy' }
} 

Now finalize the configuration for this OIDC Provider (meaning the discovery will take place)

oidc.init_provider(my_provider)

And use the authentication as normal:

@app.route('/private')
@oidc.require_login
def private():
   ...
HarryKodden commented 5 years ago

Travis reports 1 test is failing on Python 2.6. This because 2.6 python fails on the expression number in {2,3,5,7} Since this is part of rsa package, not sure what i can do about that...

svintit commented 4 years ago

@HarryKodden If you want this resolved i'm maintaining a fork of this with some added extensibility. Feel free to open a PR here: