def setup(self):
        self.consent_db = ConsentDatasetDB("salt", 12)
        self.ticket_db = ConsentRequestDatasetDB("salt")
        self.max_month = 12
        self.signing_key = RSAKey(key=RSA.generate(1024), alg='RS256')

        self.cm = ConsentManager(self.consent_db, self.ticket_db,
                                 [self.signing_key], 3600, self.max_month)
Example #2
0
def init_consent_manager(app: Flask):
    consent_db = ConsentDatasetDB(app.config['CONSENT_SALT'],
                                  app.config['MAX_CONSENT_EXPIRATION_MONTH'],
                                  app.config.get('CONSENT_DATABASE_URL'))
    consent_request_db = ConsentRequestDatasetDB(
        app.config['CONSENT_SALT'],
        app.config.get('CONSENT_REQUEST_DATABASE_URL'))

    trusted_keys = [
        RSAKey(key=rsa_load(key)) for key in app.config['TRUSTED_KEYS']
    ]
    cm = ConsentManager(consent_db, consent_request_db, trusted_keys,
                        app.config['TICKET_TTL'],
                        app.config['MAX_CONSENT_EXPIRATION_MONTH'])
    return cm