|
|
@ -1,4 +1,5 @@ |
|
|
|
from .. import random_tokens |
|
|
|
from odoo import api, SUPERUSER_ID |
|
|
|
from . import random_tokens |
|
|
|
|
|
|
|
try: |
|
|
|
from jwcrypto import jwk |
|
|
@ -6,7 +7,8 @@ except ImportError: |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def init_keys(IrConfigParameter): |
|
|
|
def init_keys(cr, registry): |
|
|
|
env = api.Environment(cr, SUPERUSER_ID, {}) |
|
|
|
keys = { |
|
|
|
"galicea_openid_connect.authorization_code_jwk": lambda: jwk.JWK.generate( |
|
|
|
kty="oct", |
|
|
@ -24,14 +26,8 @@ def init_keys(IrConfigParameter): |
|
|
|
).export(), |
|
|
|
} |
|
|
|
|
|
|
|
for key, gen in keys.iteritems(): |
|
|
|
if not IrConfigParameter.search([("key", "=", key)]): |
|
|
|
IrConfigParameter.create( |
|
|
|
{ |
|
|
|
"key": key, |
|
|
|
"value": gen(), |
|
|
|
"group_ids": [ |
|
|
|
(4, IrConfigParameter.env.ref("base.group_erp_manager").id) |
|
|
|
], |
|
|
|
} |
|
|
|
for key, gen in keys.items(): |
|
|
|
if not env["ir.config_parameter"].search([("key", "=", key)]): |
|
|
|
env["ir.config_parameter"].create( |
|
|
|
{"key": key, "value": gen(),} |
|
|
|
) |