Пример #1
0
    def test_create(self):
        from connect.rp.models import RelyingParty
        r = RelyingParty.get_selfissued('http://hoge.com/')

        from connect.messages.auth import AuthReq
        authreq = AuthReq(
            redirect_uri=r.identifier
        )

        from connect.rp.models import SignOn
        s = SignOn.create(r, authreq)
        print s.nonce, s.state, s.request
        print authreq.to_qs()
Пример #2
0
    def test_create(self):
        from connect.rp.models import RelyingParty
        r = RelyingParty.get_selfissued('http://key.com/')
        self.assertEqual(r.keys.count(), 0)
        self.assertEqual(r.authority.keys.count(), 0)

        from jose.jwk import Jwk, JwkSet
        from jose.jwa import keys

        jwkset = JwkSet()
        jwkset.keys.append(Jwk(kid='kidRsa', kty=keys.KeyTypeEnum.RSA))
        jwkset.keys.append(Jwk(kid='kidEc', kty=keys.KeyTypeEnum.EC))
        jwkset.keys.append(Jwk(kid='kidOct', kty=keys.KeyTypeEnum.OCT))
        jwkset.save(r)

        self.assertEqual(r.keys.count(), 1)
        self.assertEqual(r.authority.keys.count(), 0)

        jwkset.save(r.authority)
        self.assertEqual(r.keys.count(), 1)
        self.assertEqual(r.authority.keys.count(), 1)