blob: fd6cc152e176b50378b760571c0fa12822e4f5f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
__author__ = 'leifj'
from django.conf import settings
from django.utils.importlib import import_module
_consumer_provider_modules = list()
def autodiscover():
for app in settings.INSTALLED_APPS:
mod = import_module("%.models" % app)
if hasattr(mod,'consumer_providers' and hasattr(mod.consumer_providers,'__call__')):
_consumer_provider_modules.append(mod)
def consumer_providers():
p = list()
for mod in _consumer_provider_modules:
p.extend(mod.token_providers())
return p
def consumer_provider(name):
for mod in _consumer_provider_modules:
for p in mod.token_providers():
if p.name == name:
return p
return None
autodiscover()
# self.authorization_uri
# self.logo
# self.name
# self.description
# self.service_uri
# self.is_authorized(user)
|