def create_sdb(self): _sso_db = SSODb() passwd = rndstr(24) _th_args = { "code": { "lifetime": 600, "password": passwd }, "token": { "lifetime": 3600, "password": passwd }, "refresh": { "lifetime": 86400, "password": passwd }, } _token_handler = token_handler.factory(None, **_th_args) userinfo = UserInfo(db_file=full_path("users.json")) self.sdb = SessionDB(InMemoryDataBase(), _token_handler, _sso_db, userinfo)
TOKEN_REQ = AccessTokenRequest(client_id='client_1', redirect_uri='https://example.com/cb', state='STATE', grant_type='authorization_code', client_secret='hemligt') TOKEN_REQ_DICT = TOKEN_REQ.to_dict() BASEDIR = os.path.abspath(os.path.dirname(__file__)) def full_path(local_file): return os.path.join(BASEDIR, local_file) USERINFO = UserInfo(json.loads(open(full_path('users.json')).read())) def setup_session(endpoint_context, areq): authn_event = create_authn_event(uid="uid", salt='salt', authn_info=INTERNETPROTOCOLPASSWORD, time_stamp=time.time()) sid = endpoint_context.sdb.create_authz_session(authn_event, areq, client_id='client_id') endpoint_context.sdb.do_sub(sid, '') return sid class TestEndpoint(object):
{ "type": "EC", "crv": "P-256", "use": ["sig"] }, ] BASEDIR = os.path.abspath(os.path.dirname(__file__)) def full_path(local_file): return os.path.join(BASEDIR, local_file) USERS = json.loads(open(full_path("users.json")).read()) USERINFO = UserInfo(USERS) AREQN = AuthorizationRequest( response_type="code", client_id="client1", redirect_uri="http://example.com/authz", scope=["openid"], state="state000", nonce="nonce", ) conf = { "issuer": "https://example.com/", "password": "******", "token_expires_in": 600, "grant_expires_in": 300,