def test_parse_check_session_request(self): csreq = CheckSessionRequest( id_token=IDTOKEN.to_jwt(key=KC_SYM_S.get(alg2keytype("HS256")), algorithm="HS256")) request = self.srv.parse_check_session_request( query=csreq.to_urlencoded()) assert isinstance(request, IdToken) assert _eq(request.keys(), ['nonce', 'sub', 'aud', 'iss', 'exp', 'iat']) assert request["aud"] == ["client_1"]
def test_parse_check_session_request(self): csreq = CheckSessionRequest(id_token=IDTOKEN.to_jwt( key=KC_SYM_S.get(alg2keytype("HS256")), algorithm="HS256")) request = self.srv.parse_check_session_request( query=csreq.to_urlencoded()) assert isinstance(request, IdToken) assert _eq(request.keys(), ["nonce", "sub", "aud", "iss", "exp", "iat"]) assert request["aud"] == ["client_1"]
def test_check_session_endpoint(self): session = {"sub": "UserID", "client_id": "number5"} idtoken = self.provider.id_token_as_signed_jwt(session) csr = CheckSessionRequest(id_token=idtoken) info = self.provider.check_session_endpoint(request=csr.to_urlencoded()) idt = IdToken().deserialize(info.message, "json") assert _eq(idt.keys(), ['sub', 'aud', 'iss', 'acr', 'exp', 'iat']) assert idt["iss"] == self.provider.name + "/"
def test_check_session_endpoint(): server = provider_init print server.name # server.keyjar["number5"] = KeyChain({"hmac":CDB["number5"]["client_secret"]}, # usage=["ver"]) session = {"sub": "UserID", "client_id": "number5"} idtoken = server.id_token_as_signed_jwt(session) csr = CheckSessionRequest(id_token=idtoken) environ = BASE_ENVIRON.copy() environ["QUERY_STRING"] = csr.to_urlencoded() info = server.check_session_endpoint(environ, start_response) print info idt = IdToken().deserialize(info[0], "json") print idt.keys() assert _eq(idt.keys(), ['sub', 'aud', 'iss', 'acr', 'exp', 'iat']) assert idt["iss"] == server.name
redirect_uris=["http://example.org/jqauthz"], application_name="pacubar", client_id=CLIENT_ID, operation="register", application_type="web") RSREQ = RefreshSessionRequest(id_token="id_token", redirect_url="http://example.com/authz", state="state0") #key, type, usage, owner="." alg = "HS256" ktype = alg2keytype(alg) keys = KC_SYM_S.get(ktype) CSREQ = CheckSessionRequest( id_token=IDTOKEN.to_jwt(key=keys, algorithm="HS256")) ESREQ = EndSessionRequest(id_token=IDTOKEN.to_jwt(key=keys, algorithm="HS256"), redirect_url="http://example.org/jqauthz", state="state0") UINFO = Claims(name={"essential": True}, nickname=None, email={"essential": True}, email_verified={"essential": True}, picture=None) IDT2 = Claims(auth_time={ "essential": True, "acr": { "values": ["urn:mace:incommon:iap:silver"]