Пример #1
0
def test_1():
    rest = REST('http://localhost')
    cnf = create_model('C.T.T.T')

    cnf['tool']['issuer'] = 'http://example.com/op'
    cnf['tool']['sig'] = True

    qiss = quote_plus(cnf['tool']['issuer'])
    qtag = cnf['tool']['tag']
    rest.write(qiss, qtag, cnf)

    _ecnf = rest.construct_config(qiss, qtag)

    assert set(_ecnf.keys()) == {'client', 'keys', 'tool'}
    assert set(_ecnf['client'].keys()) == {'behaviour', 'client_prefs',
                                           'registration_info'}
Пример #2
0
def test_1():
    rest = REST('http://localhost')
    cnf = create_model('C.T.T.T')

    cnf['tool']['issuer'] = 'http://example.com/op'
    cnf['tool']['sig'] = True

    qiss = quote_plus(cnf['tool']['issuer'])
    qtag = cnf['tool']['tag']
    rest.write(qiss, qtag, cnf)

    _ecnf = rest.construct_config(qiss, qtag)

    assert set(_ecnf.keys()) == {'client', 'keys', 'tool'}
    assert set(_ecnf['client'].keys()) == {
        'behaviour', 'client_prefs', 'registration_info'
    }
Пример #3
0
if __name__ == '__main__':
    sys.path.insert(0, '.')
    rest = REST('', '../entities')
    assigned_port = AssignedPorts('../aasigned_ports', 60000, 64000)
    for fil in sys.argv[1:]:
        if fil.endswith('.py'):
            print(fil)
            port, cnf = convert(fil[:-3])
            try:
                iss = cnf['tool']['issuer']
            except KeyError:
                iss = cnf['client']['provider_info']['issuer']
            qiss = quote_plus(iss.lower())

            if qiss.startswith('http'):
                qtag = quote_plus(cnf['tool']['tag'])
                fname = rest.entity_file_name(qiss, qtag)
                _key = '{}:{}'.format(qiss, qtag)
                if not os.path.isfile(fname):
                    rest.write(qiss, qtag, cnf)
                    try:
                        _p = assigned_port[_key]
                    except KeyError:
                        assigned_port[_key] = port
                    else:
                        _p = assigned_port.register_port(qiss, qtag)
                        print('{}/{} got other port {}->{}'.format(
                            qiss, qtag, port, _p))
            else:
                print('skipped: {}'.format(fil))
Пример #4
0
parser.add_argument('-i', dest='issuer')
parser.add_argument('-l', dest='ui_locales')
parser.add_argument('-L', dest='claims_locales')
parser.add_argument('-p', dest='profile', default='C.T.T.T')
parser.add_argument('-s', dest='sig', action='store_true')
parser.add_argument('-t', dest='tag')
parser.add_argument('-x', dest='extra', action='store_true')
parser.add_argument('-w', dest='webfinger_email')
parser.add_argument('-W', dest='webfinger_url')

args = parser.parse_args()

ent_info_path='{}/entity_info'.format(args.entity_root)

rest = REST('', '{}/entities'.format(args.entity_root), ent_info_path)
cnf = create_model(args.profile, ent_info_path)

for item in ['sig', 'enc', 'extra']:
    if getattr(args, item):
        cnf['tool'][item] = True

for item in ['acr_values', 'login_hint', 'ui_locales', 'claims_locales',
             'webfinger_url', 'webfinger_email', 'issuer', 'profile', 'tag']:
    v = getattr(args, item)
    if v:
        cnf['tool'][item] = v

qiss = quote_plus(cnf['tool']['issuer'])
qtag = cnf['tool']['tag']
rest.write(qiss, qtag, cnf)
Пример #5
0
            if d:
                for t in d:
                    rport.append((iss, t))

for l in set(old_info.keys()).difference(set(present_info.keys())):
    for t in old_info[l]:
        rport.append((l, t))

print('-------')
for l in rport:
    del_port(*l)
    old.delete(*l)

print('+++++++')
for l in nport:
    # copy conf
    #qp = [quote_plus(x) for x in l]
    t, cnf = present.read_conf(*l)
    try:
        ruri = cnf['client']['registration_response']['redirect_uris']
    except:
        new_port(*l)
    else:
        if isinstance(ruri, list):
            ruri = ruri[0]
        else:
            cnf['client']['registration_response']['redirect_uris'] = [ruri]
        _p = ruri[:-9].split(':')[-1]
        new_port(l[0], l[1], _p)
    old.write(l[0], l[1], cnf)