django-oidc-provider/oidc_provider/lib/endpoints/discovery.py

32 lines
No EOL
1 KiB
Python

from django.core.urlresolvers import reverse
from oidc_provider import settings
from oidc_provider.lib.utils.common import get_issuer
class ProviderInfoEndpoint(object):
@classmethod
def create_response_dic(cls):
dic = {}
dic['issuer'] = get_issuer()
SITE_URL = settings.get('SITE_URL')
dic['authorization_endpoint'] = SITE_URL + reverse('oidc_provider:authorize')
dic['token_endpoint'] = SITE_URL + reverse('oidc_provider:token')
dic['userinfo_endpoint'] = SITE_URL + reverse('oidc_provider:userinfo')
from oidc_provider.models import Client
types_supported = [x[0] for x in Client.RESPONSE_TYPE_CHOICES]
dic['response_types_supported'] = types_supported
dic['jwks_uri'] = SITE_URL + reverse('oidc_provider:jwks')
dic['id_token_signing_alg_values_supported'] = ['RS256']
# See: http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes
dic['subject_types_supported'] = ['public']
return dic