Skip to content

Commit

Permalink
Added encrypted client secret in sap configuration (#2231)
Browse files Browse the repository at this point in the history
* feat: added encrypted client secret for SAP config
  • Loading branch information
MueezKhan246 authored Sep 6, 2024
1 parent 336dee5 commit cba67ec
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Unreleased
----------
* nothing unreleased

[4.25.3]
----------
* feat: added encrypted client secret for SAP config

[4.25.2]
----------
* feat: added migration file for removing char field decrypted_secret
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "4.25.2"
__version__ = "4.25.3"
2 changes: 2 additions & 0 deletions enterprise/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,5 @@ def update_decrypted_credentials(sender, instance, **kwargs): # pylint: disa
"""
if instance.key != instance.decrypted_key:
instance.decrypted_key = instance.key
if instance.secret != instance.decrypted_secret:
instance.decrypted_secret = instance.secret
1 change: 1 addition & 0 deletions integrated_channels/sap_success_factors/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class SAPSuccessFactorsEnterpriseCustomerConfigurationAdmin(DjangoObjectActions,
"key",
"decrypted_key",
"secret",
"decrypted_secret",
"sapsf_user_id",
"user_type",
"has_access_token",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.23 on 2024-09-04 14:35

from django.db import migrations
import fernet_fields.fields


class Migration(migrations.Migration):

dependencies = [
('sap_success_factors', '0020_remove_sapsuccessfactorsenterprisecustomerconfiguration_decrypted_secret'),
]

operations = [
migrations.AddField(
model_name='sapsuccessfactorsenterprisecustomerconfiguration',
name='decrypted_secret',
field=fernet_fields.fields.EncryptedCharField(blank=True, default='', help_text='The encrypted OAuth client secret. It will be encrypted when stored in the database.', max_length=255, null=True, verbose_name='Encrypted Client Secret'),
),
]
12 changes: 12 additions & 0 deletions integrated_channels/sap_success_factors/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ class SAPSuccessFactorsEnterpriseCustomerConfiguration(EnterpriseCustomerPluginC
help_text=_("OAuth client secret.")
)

decrypted_secret = EncryptedCharField(
max_length=255,
blank=True,
default='',
verbose_name="Encrypted Client Secret",
help_text=_(
"The encrypted OAuth client secret."
" It will be encrypted when stored in the database."
),
null=True
)

user_type = models.CharField(
max_length=20,
choices=USER_TYPE_CHOICES,
Expand Down

0 comments on commit cba67ec

Please sign in to comment.