Exemplo n.º 1
0
    "use": ["sig"]
}]

SYMKEY = rndstr(16)

TOOL_ISS = 'https://localhost'

ALL = [
    'https://swamid.sunet.se', 'https://www.feide.no', 'https://sunet.se',
    'https://uninett.no', 'https://sunet.se/op', 'https://foodle.uninett.no'
]

_path = os.path.realpath(__file__)
root_dir, _fname = os.path.split(_path)

FEDENT = create_federation_entities(ALL, KEYDEFS, root_dir=root_dir)

fo_keybundle = JWKSBundle('')
for iss in ['https://swamid.sunet.se', 'https://www.feide.no']:
    kj = KeyJar()
    kj.import_jwks(FEDENT[iss].signing_keys_as_jwks(), iss)
    fo_keybundle[iss] = kj

SUNET_OP = FEDENT['https://sunet.se/op']
ORG_SUNET = FEDENT['https://sunet.se']
SWAMID = FEDENT['https://swamid.sunet.se']
FOODLE = FEDENT['https://foodle.uninett.no']
FEIDE = FEDENT['https://www.feide.no']
UNINETT = FEDENT['https://uninett.no']

Exemplo n.º 2
0
client.service_context.redirect_uris = ['https://entity.example.com/cb']
_srv = client.service['registration']

reg_req = _srv.construct()

SUNET_RP = client.service_context.federation_entity

# The kind of keys the federation entities has
FED_KEYDEF = [{"type": "EC", "crv": "P-256", "use": ["sig"]}]

# Identifiers for all the entities
ALL = ['https://edugain.org', 'https://swamid.sunet.se']

# Create the federation entities
FEDENT = create_federation_entities(ALL, FED_KEYDEF, root_dir='../')
SWAMID = FEDENT['https://swamid.sunet.se']
EDUGAIN = FEDENT['https://edugain.org']

FEDENT[SUNET_RP.iss] = SUNET_RP

try:
    _sms = make_signing_sequence([SUNET_RP.iss, SWAMID.iss, EDUGAIN.iss],
                                 FEDENT, 'registration', lifetime=86400)
except Exception as err:
    print(err)
else:
    fp = open('sms/registration/{}'.format(quote_plus(EDUGAIN.iss)), 'w')
    fp.write(_sms)
    fp.close()
Exemplo n.º 3
0
    fe = make_federation_entity(config, 'https://op.example.com')

    req = MetadataStatement(foo='bar')

    fe.add_sms_spec_to_request(req)
    fe.add_signing_keys(req)
    updated_req = fe.self_sign(req, 'https://example.com')

    assert updated_req
    assert set(updated_req.keys()) == {'foo', 'signing_keys',
                                       'metadata_statements'}


ENTITY = create_federation_entities(['https://op.sunet.se', 'https://sunet.se',
                                     'https://swamid.sunet.se'], KEYDEFS,
                                    root_dir=root_dir)


def test_update_metadata_statement():
    make_signing_sequence(['https://op.sunet.se', 'https://sunet.se',
                           'https://swamid.sunet.se'], ENTITY)

    op = ENTITY['https://op.sunet.se']
    metadata_statement = MetadataStatement(foo='bar')
    metadata_statement = op.update_metadata_statement(metadata_statement)
    assert metadata_statement
    assert set(metadata_statement.keys()) == {'foo', 'metadata_statements'}

    swamid = ENTITY['https://swamid.sunet.se']
    # on the RP side