Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit 2b3df02

Browse files
committed
Added option validation to auth config
1 parent 588ae2d commit 2b3df02

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

batchapps/config.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ def remove(self, setting):
779779
return False
780780

781781
def aad_config(self, account=None, key=None, client_id=None, tenant=None,
782-
redirect=None, endpoint=None, unattended=False, **kwargs):
782+
redirect=None, endpoint=None, unattended=False, validate=True, **kwargs):
783783
"""Configure AAD authentication parameters to accompany an existing
784784
Batch Apps Service.
785785
If new values are set, :meth:`.save_config()` must be called for
@@ -827,25 +827,29 @@ def aad_config(self, account=None, key=None, client_id=None, tenant=None,
827827
for setting in auth_cfg:
828828
self._config.set("Authentication", setting, auth_cfg[setting])
829829

830-
if account:
830+
if account is not None:
831831
self._config.set("Authentication", "unattended_account", str(account))
832832

833-
if key:
833+
if key is not None:
834834
self._config.set("Authentication", "unattended_key", str(key))
835835

836-
if client_id:
836+
if client_id is not None:
837837
self._config.set("Authentication", "client_id", str(client_id))
838838

839-
if tenant:
839+
if tenant is not None:
840840
self._config.set("Authentication", "tenant", str(tenant))
841841

842-
if redirect:
842+
if redirect is not None:
843843
self._config.set("Authentication", "redirect_uri", str(redirect))
844844

845-
if endpoint:
845+
if endpoint is not None:
846846
self._config.set("Authentication", "endpoint", str(endpoint))
847847

848-
auth_dict = self._validate_auth(unattended)
848+
if validate:
849+
auth_dict = self._validate_auth(unattended)
850+
else:
851+
auth_dict = dict(self._config.items("Authentication"))
852+
849853
return auth_dict
850854

851855
def _invalid_data(self, value):

0 commit comments

Comments
 (0)