automatically encrypt/decrypt main_oauth2application.client_secret

see: https://github.com/ansible/awx/issues/1416
This commit is contained in:
Ryan Petrello
2018-04-03 16:51:34 -04:00
parent c2446beb6e
commit 5f01d26224
4 changed files with 66 additions and 0 deletions

View File

@@ -9,6 +9,9 @@ from django.utils.translation import ugettext_lazy as _
# Django OAuth Toolkit
from oauth2_provider.models import AbstractApplication, AbstractAccessToken
from oauth2_provider.generators import generate_client_secret
from awx.main.fields import OAuth2ClientSecretField
DATA_URI_RE = re.compile(r'.*') # FIXME
@@ -39,6 +42,10 @@ class OAuth2Application(AbstractApplication):
null=True,
)
client_secret = OAuth2ClientSecretField(
max_length=1024, blank=True, default=generate_client_secret, db_index=True
)
class OAuth2AccessToken(AbstractAccessToken):