예제 #1
0
 def test_construct_with_receiver(self):
     _srv = self.service['registration']
     _srv.service_context.federation_entity.metadata_statements[
         'registration'] = {}
     make_signing_sequence([FOODLE.iss, UNINETT.iss, FEIDE.iss],
                           FEDENT,
                           context='registration')
     _req = _srv.construct(receiver='https://example.com/op')
     assert isinstance(_req, MetadataStatement)
     assert len(_req) == 2
     assert set(_req['metadata_statements'].keys()) == {FEIDE.iss}
     op = Operator(jwks_bundle=fo_keybundle)
     r = op.unpack_metadata_statement(_req)
     assert r
     l = op.evaluate_metadata_statement(r.result)
     assert l
     assert len(l) == 1
     assert set(l[0].le.keys()) == {'redirect_uris'}
예제 #2
0
def test_pack_and_unpack_ms_lev0():
    cms = ClientMetadataStatement(signing_keys=FOP.signing_keys_as_jwks_json(),
                                  contacts=['*****@*****.**'],
                                  scope=['openid'])

    _jwt = FOP.pack_metadata_statement(cms, sign_alg='RS256')

    assert _jwt
    json_ms = unfurl(_jwt)
    #  print(json_ms.keys())
    assert set(json_ms.keys()) == {
        'signing_keys', 'iss', 'iat', 'exp', 'kid', 'scope', 'contacts', 'aud'
    }

    # Unpack what you have packed
    _kj = KeyJar().import_jwks(FOP.signing_keys_as_jwks(), '')
    op = Operator(_kj, jwks_bundle=public_jwks_bundle(FOP.jwks_bundle))
    pr = op.unpack_metadata_statement(jwt_ms=_jwt)

    assert pr.result