示例#1
0
def includeme(config):
    # authorization
    #config.include('pyramid_ipauth')

    config.include('pyramid_exclog')

    config.include("cornice")

    config.scan("trunion.views")

    crypto.init(key=config.registry.settings['trunion.keyfile'],
                cert=config.registry.settings['trunion.certfile'],
                chain=config.registry.settings['trunion.chainfile'],
                engine=config.registry.settings.get('trunion.engine', None))

    # So many fugly hacks
    if config.registry.settings.get('trunion.we_are_signing',
                                    None) == 'addons':
        crypto.init_ca(sectionify(config.registry.settings, 'addons'),
                       sectionify(config.registry.settings, 'dnbase'),
                       sectionify(config.registry.settings, 'extensions'))

    issuers = config.registry.settings.get('trunion.permitted_issuers', '')
    issuers = issuers.split(',')
    iss = []
    for issuer in issuers:
        iss.append(issuer.strip())
    if len(iss) < 1:
        raise Exception("No issuers provided in the config file!")
    config.registry.settings['trunion.permitted_issuers'] = iss
示例#2
0
    def setUp(self):
        self.path = '/1.0/sign'
        self.config = testing.setUp()
        self.ini = os.path.join(os.path.dirname(__file__), 'trunion-test.ini')
        settings = {}
        load_into_settings(self.ini, settings)
        self.config.add_settings(settings)
        self.config.include("trunion")
        # All of that just for this
        crypto.init(key=self.config.registry.settings['trunion.keyfile'],
                    cert=self.config.registry.settings['trunion.certfile'])

        self.signing = crypto.KEYSTORE.cert_data
        self._template = dict(typ="purchase-receipt",
                              product={
                                  "url": "https://grumpybadgers.com",
                                  "storedata": "5169314356"
                              },
                              user={
                                  "type": "email",
                                  "value": "*****@*****.**"
                              },
                              iss=crypto.KEYSTORE.cert_data['iss'],
                              nbf=self.signing['iat'],
                              iat=self.signing['iat'],
                              detail="https://appstore.com/receipt/5169314356",
                              verify="https://appstore.com/verify/5169314356")
示例#3
0
def includeme(config):
    # authorization
    #config.include('pyramid_ipauth')

    config.include('pyramid_exclog')

    config.include("cornice")

    config.scan("trunion.views")

    crypto.init(key=config.registry.settings['trunion.keyfile'],
                cert=config.registry.settings['trunion.certfile'],
                chain=config.registry.settings['trunion.chainfile'],
                engine=config.registry.settings.get('trunion.engine', None))

    # So many fugly hacks
    if config.registry.settings.get('trunion.we_are_signing', None) == 'addons':
        crypto.init_ca(sectionify(config.registry.settings, 'addons'),
                       sectionify(config.registry.settings, 'dnbase'),
                       sectionify(config.registry.settings, 'extensions'))

    issuers = config.registry.settings.get('trunion.permitted_issuers', '')
    issuers = issuers.split(',')
    iss = []
    for issuer in issuers:
        iss.append(issuer.strip())
    if len(iss) < 1:
        raise Exception("No issuers provided in the config file!")
    config.registry.settings['trunion.permitted_issuers'] = iss
示例#4
0
 def setUp(self):
     self.path = '/status'
     self.config = testing.setUp()
     self.ini = os.path.join(os.path.dirname(__file__), 'trunion-test.ini')
     settings = {}
     load_into_settings(self.ini, settings)
     self.config.add_settings(settings)
     self.config.include("trunion")
     # All of that just for this
     crypto.init(key=self.config.registry.settings['trunion.keyfile'],
                 cert=self.config.registry.settings['trunion.certfile'],
                 chain=self.config.registry.settings['trunion.chainfile'])
示例#5
0
 def setUp(self):
     self.path = '/status'
     self.config = testing.setUp()
     self.ini = os.path.join(os.path.dirname(__file__), 'trunion-test.ini')
     settings = {}
     load_into_settings(self.ini, settings)
     self.config.add_settings(settings)
     self.config.include("trunion")
     # All of that just for this
     crypto.init(key=self.config.registry.settings['trunion.keyfile'],
                 cert=self.config.registry.settings['trunion.certfile'],
                 chain=self.config.registry.settings['trunion.chainfile'])
示例#6
0
    def setUp(self):
        self.path = '/1.0/sign_addon'
        self.config = testing.setUp()
        self.ini = os.path.join(os.path.dirname(__file__), 'trunion-test.ini')
        settings = {}
        load_into_settings(self.ini, settings)
        # FIXME Just have a separate INI file
        settings['trunion.we_are_signing'] = 'addons'
        self.config.add_settings(settings)
        self.config.include("trunion")
        # All of that just for this
        settings = self.config.registry.settings
        crypto.init(key=settings['trunion.keyfile'],
                    cert=settings['trunion.certfile'],
                    chain=settings['trunion.chainfile'])

        crypto.init_ca(self.sectionify(settings, 'addons'),
                       self.sectionify(settings, 'dnbase'),
                       self.sectionify(settings, 'extensions'))
示例#7
0
    def setUp(self):
        self.path = '/1.0/sign_addon'
        self.config = testing.setUp()
        self.ini = os.path.join(os.path.dirname(__file__), 'trunion-test.ini')
        settings = {}
        load_into_settings(self.ini, settings)
        # FIXME Just have a separate INI file
        settings['trunion.we_are_signing'] = 'addons'
        self.config.add_settings(settings)
        self.config.include("trunion")
        # All of that just for this
        settings = self.config.registry.settings
        crypto.init(key=settings['trunion.keyfile'],
                    cert=settings['trunion.certfile'],
                    chain=settings['trunion.chainfile'])

        crypto.init_ca(self.sectionify(settings, 'addons'),
                       self.sectionify(settings, 'dnbase'),
                       self.sectionify(settings, 'extensions'))
示例#8
0
文件: base.py 项目: mozilla/trunion
    def setUp(self):
        self.path = '/1.0/sign'
        self.config = testing.setUp()
        self.ini = os.path.join(os.path.dirname(__file__), 'trunion-test.ini')
        settings = {}
        load_into_settings(self.ini, settings)
        self.config.add_settings(settings)
        self.config.include("trunion")
        # All of that just for this
        crypto.init(key=self.config.registry.settings['trunion.keyfile'],
                    cert=self.config.registry.settings['trunion.certfile'])

        self.signing = crypto.KEYSTORE.cert_data
        self._template = dict(typ="purchase-receipt",
                              product={"url": "https://grumpybadgers.com",
                                       "storedata": "5169314356"},
                              user={"type": "email",
                                    "value": "*****@*****.**"},
                              iss=crypto.KEYSTORE.cert_data['iss'],
                              nbf=self.signing['iat'],
                              iat=self.signing['iat'],
                              detail="https://appstore.com/receipt/5169314356",
                              verify="https://appstore.com/verify/5169314356")