Commit 235fa6b8 authored by Bizon Lavinia's avatar Bizon Lavinia

Merge branch 'pawel-kow/devel' into 'master'

Bugfixes on Python 3 & `callback_endpoint` feature added

See merge request !1
parents cc5ec02a b9d839ee
import binascii
import datetime
import json
import jwt
from dns.exception import Timeout
from dns.resolver import Resolver, NXDOMAIN, YXDOMAIN, NoAnswer, NoNameservers
......@@ -17,6 +18,8 @@ from id4me import app
from id4me.models import IdentityAuthority
from id4me.network import get_json, get_json_auth, post_json
from Crypto.PublicKey import RSA
resolver = Resolver()
if 'DNS_NAMESERVERS' in app.config:
resolver.nameservers = app.config['DNS_NAMESERVERS'].split(',')
......
......@@ -122,6 +122,12 @@ def user_info():
authorized_claims = []
scope = []
user = User.get_user(payload['iss'], subject)
if user is None:
return jsonify(
{
'error': 'identity_unknown',
'error_description': 'no identity for requested iss/sub pair ({}. {})'.format(payload['iss'], subject)
}), 404
claims = User.get_claims_data_for_user(user, authorized_claims, scope)
cstring = ' '.join(sorted(claims.keys()))
print('Reported claims: {}'.format(cstring))
......@@ -152,10 +158,9 @@ def openid_config():
result = {
"issuer": server,
"jwks_uri": "{}{}".format(server, url_for('jwks')),
"response_types_supported": ["code"],
"userinfo_endpoint": "{}{}".format(server, url_for('user_info')),
"id_token_signing_alg_values_supported": ["RS256"],
"claims_supported": [item.claim for item in StandardClaim.get_standard_claims()]
"claims_supported": [item.claim for item in StandardClaim.get_standard_claims()],
"callback_endpoint": "{}{}".format(server, url_for('auth_callback', uuid='')),
}
return jsonify(result)
......
asn1crypto==0.24.0
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
Click==7.0
cryptography==2.7
dnspython==1.16.0
Flask==1.0.3
Flask-SQLAlchemy==2.4.0
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10.1
MarkupSafe==1.1.1
Naked==0.1.31
publicsuffix==1.1.0
pycparser==2.19
pycryptodome==3.8.2
PyJWT==1.7.1
pytz==2019.1
PyYAML==5.1.1
requests==2.22.0
shellescape==3.4.1
six==1.12.0
SQLAlchemy==1.3.4
tz==0.2.2
urllib3==1.25.3
Werkzeug==0.15.4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment