示例#1
0
    def setUp(self):
        # local
        _jwt = JWToken('rsa')

        self.jws = JWS()
        self.jwk = _jwt.jwt_target()

        # Default message
        self.message = b'{"user": 1, "email": "*****@*****.**","exp": "1486947255.0"}'

        # Compressed
        self.compact = 'eyJhbGciOiJSUzI1NiJ9.eyJ1c2VyIjogMSwgImVtYWlsIjogImdtanVuMjAwMEBnbWFpbC5jb20iLCJleHAiOiAiMTQ4Njk0NzI1NS4wIn0.L57CzBbMf1aL413EfmVq_mDNCy6Fyh6zRG3wyh_EZP3kJAY_dnuYyD3siEJT2ebhGVmkB0v6YRT6jshi2gCuiAd4xahwsk9MrNsx0_atPJmzRiJr0sVf19iaaVBuVD8ltDDr8Lhh9ccBLgTmzEsHTzQwA-Krb32yApT5a16Mt_Q'
示例#2
0
文件: JWT.py 项目: geolffreym/jwtAuth
    def __init__(self, crypth='rsa'):
        # Setup
        _is_rsa = crypth != 'oct'
        # Private key load
        _key_load = not _is_rsa and load_file_keys(
            JWTSetting.JWT_OCT_KEY, 'r') or load_file_keys(
                JWTSetting.JWT_RSA_PRIVATE_KEY)

        # Json Web Service
        self.jws = JWS()
        # Algorithm
        self.alg = not _is_rsa and 'HS256' or 'RS256'
        # Private key processing
        self.jwk = not _is_rsa and jwk_from(_key_load) or jwk_from(
            _key_load, 'pem')
示例#3
0
    def setUp(self):
        self.inst = JWS()
        self.key = jwk_from_dict(
            json.loads(load_testdata('rsa_privkey.json', 'r')))
        self.pubkey = jwk_from_dict(
            json.loads(load_testdata('rsa_pubkey.json', 'r')))

        self.message = (b'{"iss":"joe",\r\n'
                        b' "exp":1300819380,\r\n'
                        b' "http://example.com/is_root":true}')
        self.compact_jws = (
            'eyJhbGciOiJSUzI1NiJ9'
            '.'
            'eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt'
            'cGxlLmNvbS9pc19yb290Ijp0cnVlfQ'
            '.'
            'cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7'
            'AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4'
            'BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K'
            '0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv'
            'hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB'
            'p0igcN_IoypGlUPQGe77Rw')