pyxecm 1.3.0__py3-none-any.whl → 1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyxecm might be problematic. Click here for more details.
- pyxecm/__init__.py +3 -0
- pyxecm/coreshare.py +2636 -0
- pyxecm/customizer/__init__.py +6 -0
- pyxecm/customizer/browser_automation.py +231 -56
- pyxecm/customizer/customizer.py +466 -235
- pyxecm/customizer/k8s.py +49 -27
- pyxecm/customizer/m365.py +1183 -263
- pyxecm/customizer/payload.py +13854 -5368
- pyxecm/customizer/pht.py +503 -0
- pyxecm/customizer/salesforce.py +1782 -0
- pyxecm/customizer/sap.py +5 -5
- pyxecm/customizer/servicenow.py +1221 -0
- pyxecm/customizer/successfactors.py +1056 -0
- pyxecm/customizer/translate.py +2 -2
- pyxecm/helper/__init__.py +2 -0
- pyxecm/helper/assoc.py +27 -7
- pyxecm/helper/data.py +1527 -0
- pyxecm/helper/web.py +189 -25
- pyxecm/helper/xml.py +244 -40
- pyxecm/otac.py +311 -25
- pyxecm/otcs.py +3866 -1103
- pyxecm/otds.py +397 -150
- pyxecm/otiv.py +1 -1
- pyxecm/otmm.py +808 -0
- pyxecm/otpd.py +17 -12
- {pyxecm-1.3.0.dist-info → pyxecm-1.5.dist-info}/METADATA +4 -1
- pyxecm-1.5.dist-info/RECORD +30 -0
- {pyxecm-1.3.0.dist-info → pyxecm-1.5.dist-info}/WHEEL +1 -1
- pyxecm-1.3.0.dist-info/RECORD +0 -23
- {pyxecm-1.3.0.dist-info → pyxecm-1.5.dist-info}/LICENSE +0 -0
- {pyxecm-1.3.0.dist-info → pyxecm-1.5.dist-info}/top_level.txt +0 -0
pyxecm/otds.py
CHANGED
|
@@ -96,7 +96,7 @@ update_password_policy: updates the global password policy
|
|
|
96
96
|
"""
|
|
97
97
|
|
|
98
98
|
__author__ = "Dr. Marc Diefenbruch"
|
|
99
|
-
__copyright__ = "Copyright
|
|
99
|
+
__copyright__ = "Copyright 2024, OpenText"
|
|
100
100
|
__credits__ = ["Kai-Philip Gatzweiler", "Jim Bennett"]
|
|
101
101
|
__maintainer__ = "Dr. Marc Diefenbruch"
|
|
102
102
|
__email__ = "mdiefenb@opentext.com"
|
|
@@ -128,6 +128,7 @@ class OTDS:
|
|
|
128
128
|
|
|
129
129
|
_config = None
|
|
130
130
|
_cookie = None
|
|
131
|
+
_otds_ticket = None
|
|
131
132
|
|
|
132
133
|
def __init__(
|
|
133
134
|
self,
|
|
@@ -212,6 +213,8 @@ class OTDS:
|
|
|
212
213
|
"""
|
|
213
214
|
return self._config
|
|
214
215
|
|
|
216
|
+
# end method definition
|
|
217
|
+
|
|
215
218
|
def cookie(self) -> dict:
|
|
216
219
|
"""Returns the login cookie of OTDS.
|
|
217
220
|
This is set by the authenticate() method
|
|
@@ -221,6 +224,8 @@ class OTDS:
|
|
|
221
224
|
"""
|
|
222
225
|
return self._cookie
|
|
223
226
|
|
|
227
|
+
# end method definition
|
|
228
|
+
|
|
224
229
|
def credentials(self) -> dict:
|
|
225
230
|
"""Returns the credentials (username + password)
|
|
226
231
|
|
|
@@ -232,6 +237,8 @@ class OTDS:
|
|
|
232
237
|
"password": self.config()["password"],
|
|
233
238
|
}
|
|
234
239
|
|
|
240
|
+
# end method definition
|
|
241
|
+
|
|
235
242
|
def base_url(self) -> str:
|
|
236
243
|
"""Returns the base URL of OTDS
|
|
237
244
|
|
|
@@ -240,6 +247,8 @@ class OTDS:
|
|
|
240
247
|
"""
|
|
241
248
|
return self.config()["baseUrl"]
|
|
242
249
|
|
|
250
|
+
# end method definition
|
|
251
|
+
|
|
243
252
|
def rest_url(self) -> str:
|
|
244
253
|
"""Returns the REST URL of OTDS
|
|
245
254
|
|
|
@@ -248,6 +257,8 @@ class OTDS:
|
|
|
248
257
|
"""
|
|
249
258
|
return self.config()["restUrl"]
|
|
250
259
|
|
|
260
|
+
# end method definition
|
|
261
|
+
|
|
251
262
|
def credential_url(self) -> str:
|
|
252
263
|
"""Returns the Credentials URL of OTDS
|
|
253
264
|
|
|
@@ -256,6 +267,8 @@ class OTDS:
|
|
|
256
267
|
"""
|
|
257
268
|
return self.config()["credentialUrl"]
|
|
258
269
|
|
|
270
|
+
# end method definition
|
|
271
|
+
|
|
259
272
|
def auth_handler_url(self) -> str:
|
|
260
273
|
"""Returns the Auth Handler URL of OTDS
|
|
261
274
|
|
|
@@ -264,6 +277,8 @@ class OTDS:
|
|
|
264
277
|
"""
|
|
265
278
|
return self.config()["authHandlerUrl"]
|
|
266
279
|
|
|
280
|
+
# end method definition
|
|
281
|
+
|
|
267
282
|
def partition_url(self) -> str:
|
|
268
283
|
"""Returns the Partition URL of OTDS
|
|
269
284
|
|
|
@@ -272,6 +287,8 @@ class OTDS:
|
|
|
272
287
|
"""
|
|
273
288
|
return self.config()["partitionUrl"]
|
|
274
289
|
|
|
290
|
+
# end method definition
|
|
291
|
+
|
|
275
292
|
def access_role_url(self) -> str:
|
|
276
293
|
"""Returns the Access Role URL of OTDS
|
|
277
294
|
|
|
@@ -280,6 +297,8 @@ class OTDS:
|
|
|
280
297
|
"""
|
|
281
298
|
return self.config()["accessRoleUrl"]
|
|
282
299
|
|
|
300
|
+
# end method definition
|
|
301
|
+
|
|
283
302
|
def oauth_client_url(self) -> str:
|
|
284
303
|
"""Returns the OAuth Client URL of OTDS
|
|
285
304
|
|
|
@@ -288,6 +307,8 @@ class OTDS:
|
|
|
288
307
|
"""
|
|
289
308
|
return self.config()["oauthClientUrl"]
|
|
290
309
|
|
|
310
|
+
# end method definition
|
|
311
|
+
|
|
291
312
|
def resource_url(self) -> str:
|
|
292
313
|
"""Returns the Resource URL of OTDS
|
|
293
314
|
|
|
@@ -296,6 +317,8 @@ class OTDS:
|
|
|
296
317
|
"""
|
|
297
318
|
return self.config()["resourceUrl"]
|
|
298
319
|
|
|
320
|
+
# end method definition
|
|
321
|
+
|
|
299
322
|
def license_url(self) -> str:
|
|
300
323
|
"""Returns the License URL of OTDS
|
|
301
324
|
|
|
@@ -304,6 +327,8 @@ class OTDS:
|
|
|
304
327
|
"""
|
|
305
328
|
return self.config()["licenseUrl"]
|
|
306
329
|
|
|
330
|
+
# end method definition
|
|
331
|
+
|
|
307
332
|
def token_url(self) -> str:
|
|
308
333
|
"""Returns the Token URL of OTDS
|
|
309
334
|
|
|
@@ -312,6 +337,8 @@ class OTDS:
|
|
|
312
337
|
"""
|
|
313
338
|
return self.config()["tokenUrl"]
|
|
314
339
|
|
|
340
|
+
# end method definition
|
|
341
|
+
|
|
315
342
|
def users_url(self) -> str:
|
|
316
343
|
"""Returns the Users URL of OTDS
|
|
317
344
|
|
|
@@ -320,6 +347,8 @@ class OTDS:
|
|
|
320
347
|
"""
|
|
321
348
|
return self.config()["usersUrl"]
|
|
322
349
|
|
|
350
|
+
# end method definition
|
|
351
|
+
|
|
323
352
|
def groups_url(self) -> str:
|
|
324
353
|
"""Returns the Groups URL of OTDS
|
|
325
354
|
|
|
@@ -328,6 +357,8 @@ class OTDS:
|
|
|
328
357
|
"""
|
|
329
358
|
return self.config()["groupsUrl"]
|
|
330
359
|
|
|
360
|
+
# end method definition
|
|
361
|
+
|
|
331
362
|
def system_config_url(self) -> str:
|
|
332
363
|
"""Returns the System Config URL of OTDS
|
|
333
364
|
|
|
@@ -336,6 +367,8 @@ class OTDS:
|
|
|
336
367
|
"""
|
|
337
368
|
return self.config()["systemConfigUrl"]
|
|
338
369
|
|
|
370
|
+
# end method definition
|
|
371
|
+
|
|
339
372
|
def consolidation_url(self) -> str:
|
|
340
373
|
"""Returns the Consolidation URL of OTDS
|
|
341
374
|
|
|
@@ -344,6 +377,8 @@ class OTDS:
|
|
|
344
377
|
"""
|
|
345
378
|
return self.config()["consolidationUrl"]
|
|
346
379
|
|
|
380
|
+
# end method definition
|
|
381
|
+
|
|
347
382
|
def parse_request_response(
|
|
348
383
|
self,
|
|
349
384
|
response_object: object,
|
|
@@ -395,11 +430,15 @@ class OTDS:
|
|
|
395
430
|
|
|
396
431
|
# Already authenticated and session still valid?
|
|
397
432
|
if self._cookie and not revalidate:
|
|
433
|
+
logger.debug(
|
|
434
|
+
"Session still valid - return existing cookie -> %s",
|
|
435
|
+
str(self._cookie),
|
|
436
|
+
)
|
|
398
437
|
return self._cookie
|
|
399
438
|
|
|
400
439
|
otds_ticket = "NotSet"
|
|
401
440
|
|
|
402
|
-
logger.
|
|
441
|
+
logger.debug("Requesting OTDS ticket from -> %s", self.credential_url())
|
|
403
442
|
|
|
404
443
|
response = None
|
|
405
444
|
try:
|
|
@@ -424,12 +463,15 @@ class OTDS:
|
|
|
424
463
|
return None
|
|
425
464
|
else:
|
|
426
465
|
otds_ticket = authenticate_dict["ticket"]
|
|
427
|
-
logger.
|
|
466
|
+
logger.debug("Ticket -> %s", otds_ticket)
|
|
428
467
|
else:
|
|
429
468
|
logger.error("Failed to request an OTDS ticket; error -> %s", response.text)
|
|
430
469
|
return None
|
|
431
470
|
|
|
471
|
+
# Store authentication ticket:
|
|
432
472
|
self._cookie = {"OTDSTicket": otds_ticket}
|
|
473
|
+
self._otds_ticket = otds_ticket
|
|
474
|
+
|
|
433
475
|
return self._cookie
|
|
434
476
|
|
|
435
477
|
# end method definition
|
|
@@ -454,7 +496,7 @@ class OTDS:
|
|
|
454
496
|
dict: Request response (dictionary) or None if the REST call fails
|
|
455
497
|
"""
|
|
456
498
|
|
|
457
|
-
logger.
|
|
499
|
+
logger.debug("Reading license file -> %s...", path_to_license_file)
|
|
458
500
|
try:
|
|
459
501
|
with open(path_to_license_file, "rt", encoding="UTF-8") as license_file:
|
|
460
502
|
license_content = license_file.read()
|
|
@@ -483,14 +525,14 @@ class OTDS:
|
|
|
483
525
|
if existing_license:
|
|
484
526
|
request_url += "/" + existing_license[0]["id"]
|
|
485
527
|
else:
|
|
486
|
-
logger.
|
|
528
|
+
logger.debug(
|
|
487
529
|
"No existing license for resource -> %s found - adding a new license...",
|
|
488
530
|
resource_id,
|
|
489
531
|
)
|
|
490
532
|
# change strategy to create a new license:
|
|
491
533
|
update = False
|
|
492
534
|
|
|
493
|
-
logger.
|
|
535
|
+
logger.debug(
|
|
494
536
|
"Adding product license -> %s for product -> %s to resource -> %s; calling -> %s",
|
|
495
537
|
path_to_license_file,
|
|
496
538
|
product_description,
|
|
@@ -522,8 +564,8 @@ class OTDS:
|
|
|
522
564
|
return self.parse_request_response(response)
|
|
523
565
|
# Check if Session has expired - then re-authenticate and try once more
|
|
524
566
|
elif response.status_code == 401 and retries == 0:
|
|
525
|
-
logger.
|
|
526
|
-
self.authenticate(True)
|
|
567
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
568
|
+
self.authenticate(revalidate=True)
|
|
527
569
|
retries += 1
|
|
528
570
|
else:
|
|
529
571
|
logger.error(
|
|
@@ -566,7 +608,7 @@ class OTDS:
|
|
|
566
608
|
+ "&validOnly=false"
|
|
567
609
|
)
|
|
568
610
|
|
|
569
|
-
logger.
|
|
611
|
+
logger.debug(
|
|
570
612
|
"Get license for resource -> %s; calling -> %s", resource_id, request_url
|
|
571
613
|
)
|
|
572
614
|
|
|
@@ -585,8 +627,8 @@ class OTDS:
|
|
|
585
627
|
return response_dict["licenseObjects"]["_licenses"]
|
|
586
628
|
# Check if Session has expired - then re-authenticate and try once more
|
|
587
629
|
elif response.status_code == 401 and retries == 0:
|
|
588
|
-
logger.
|
|
589
|
-
self.authenticate(True)
|
|
630
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
631
|
+
self.authenticate(revalidate=True)
|
|
590
632
|
retries += 1
|
|
591
633
|
else:
|
|
592
634
|
logger.error(
|
|
@@ -611,7 +653,7 @@ class OTDS:
|
|
|
611
653
|
|
|
612
654
|
request_url = "{}/{}".format(self.license_url(), license_id)
|
|
613
655
|
|
|
614
|
-
logger.
|
|
656
|
+
logger.debug(
|
|
615
657
|
"Deleting product license -> %s from resource -> %s; calling -> %s",
|
|
616
658
|
license_id,
|
|
617
659
|
resource_id,
|
|
@@ -630,8 +672,8 @@ class OTDS:
|
|
|
630
672
|
return True
|
|
631
673
|
# Check if Session has expired - then re-authenticate and try once more
|
|
632
674
|
elif response.status_code == 401 and retries == 0:
|
|
633
|
-
logger.
|
|
634
|
-
self.authenticate(True)
|
|
675
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
676
|
+
self.authenticate(revalidate=True)
|
|
635
677
|
retries += 1
|
|
636
678
|
else:
|
|
637
679
|
logger.error(
|
|
@@ -699,7 +741,7 @@ class OTDS:
|
|
|
699
741
|
|
|
700
742
|
request_url = self.license_url() + "/object/" + license_location
|
|
701
743
|
|
|
702
|
-
logger.
|
|
744
|
+
logger.debug(
|
|
703
745
|
"Assign license feature -> %s of license -> %s associated with resource -> %s to user -> %s; calling -> %s",
|
|
704
746
|
license_feature,
|
|
705
747
|
license_location,
|
|
@@ -718,7 +760,7 @@ class OTDS:
|
|
|
718
760
|
timeout=None,
|
|
719
761
|
)
|
|
720
762
|
if response.ok:
|
|
721
|
-
logger.
|
|
763
|
+
logger.debug(
|
|
722
764
|
"Added license feature -> %s for user -> %s",
|
|
723
765
|
license_feature,
|
|
724
766
|
user_id,
|
|
@@ -726,8 +768,8 @@ class OTDS:
|
|
|
726
768
|
return True
|
|
727
769
|
# Check if Session has expired - then re-authenticate and try once more
|
|
728
770
|
elif response.status_code == 401 and retries == 0:
|
|
729
|
-
logger.
|
|
730
|
-
self.authenticate(True)
|
|
771
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
772
|
+
self.authenticate(revalidate=True)
|
|
731
773
|
retries += 1
|
|
732
774
|
else:
|
|
733
775
|
logger.error(
|
|
@@ -804,7 +846,7 @@ class OTDS:
|
|
|
804
846
|
|
|
805
847
|
request_url = self.license_url() + "/object/" + license_location
|
|
806
848
|
|
|
807
|
-
logger.
|
|
849
|
+
logger.debug(
|
|
808
850
|
"Assign license feature -> %s of license -> %s associated with resource -> %s to partition -> %s; calling -> %s",
|
|
809
851
|
license_feature,
|
|
810
852
|
license_location,
|
|
@@ -823,7 +865,7 @@ class OTDS:
|
|
|
823
865
|
timeout=None,
|
|
824
866
|
)
|
|
825
867
|
if response.ok:
|
|
826
|
-
logger.
|
|
868
|
+
logger.debug(
|
|
827
869
|
"Added license feature -> %s for partition -> %s",
|
|
828
870
|
license_feature,
|
|
829
871
|
partition_name,
|
|
@@ -831,8 +873,8 @@ class OTDS:
|
|
|
831
873
|
return True
|
|
832
874
|
# Check if Session has expired - then re-authenticate and try once more
|
|
833
875
|
elif response.status_code == 401 and retries == 0:
|
|
834
|
-
logger.
|
|
835
|
-
self.authenticate(True)
|
|
876
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
877
|
+
self.authenticate(revalidate=True)
|
|
836
878
|
retries += 1
|
|
837
879
|
else:
|
|
838
880
|
logger.error(
|
|
@@ -917,7 +959,7 @@ class OTDS:
|
|
|
917
959
|
+ license_feature
|
|
918
960
|
)
|
|
919
961
|
|
|
920
|
-
logger.
|
|
962
|
+
logger.debug(
|
|
921
963
|
"Get licensed objects for license -> %s and license feature -> %s associated with resource -> %s; calling -> %s",
|
|
922
964
|
license_name,
|
|
923
965
|
license_feature,
|
|
@@ -937,8 +979,8 @@ class OTDS:
|
|
|
937
979
|
return self.parse_request_response(response)
|
|
938
980
|
# Check if Session has expired - then re-authenticate and try once more
|
|
939
981
|
elif response.status_code == 401 and retries == 0:
|
|
940
|
-
logger.
|
|
941
|
-
self.authenticate(True)
|
|
982
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
983
|
+
self.authenticate(revalidate=True)
|
|
942
984
|
retries += 1
|
|
943
985
|
else:
|
|
944
986
|
logger.error(
|
|
@@ -1094,7 +1136,7 @@ class OTDS:
|
|
|
1094
1136
|
|
|
1095
1137
|
request_url = self.partition_url()
|
|
1096
1138
|
|
|
1097
|
-
logger.
|
|
1139
|
+
logger.debug(
|
|
1098
1140
|
"Adding user partition -> %s (%s); calling -> %s",
|
|
1099
1141
|
name,
|
|
1100
1142
|
description,
|
|
@@ -1114,8 +1156,8 @@ class OTDS:
|
|
|
1114
1156
|
return self.parse_request_response(response)
|
|
1115
1157
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1116
1158
|
elif response.status_code == 401 and retries == 0:
|
|
1117
|
-
logger.
|
|
1118
|
-
self.authenticate(True)
|
|
1159
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1160
|
+
self.authenticate(revalidate=True)
|
|
1119
1161
|
retries += 1
|
|
1120
1162
|
else:
|
|
1121
1163
|
logger.error(
|
|
@@ -1141,7 +1183,7 @@ class OTDS:
|
|
|
1141
1183
|
|
|
1142
1184
|
request_url = "{}/{}".format(self.config()["partitionUrl"], name)
|
|
1143
1185
|
|
|
1144
|
-
logger.
|
|
1186
|
+
logger.debug("Getting user partition -> %s; calling -> %s", name, request_url)
|
|
1145
1187
|
|
|
1146
1188
|
retries = 0
|
|
1147
1189
|
while True:
|
|
@@ -1155,8 +1197,8 @@ class OTDS:
|
|
|
1155
1197
|
return self.parse_request_response(response)
|
|
1156
1198
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1157
1199
|
elif response.status_code == 401 and retries == 0:
|
|
1158
|
-
logger.
|
|
1159
|
-
self.authenticate(True)
|
|
1200
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1201
|
+
self.authenticate(revalidate=True)
|
|
1160
1202
|
retries += 1
|
|
1161
1203
|
else:
|
|
1162
1204
|
if show_error:
|
|
@@ -1205,7 +1247,7 @@ class OTDS:
|
|
|
1205
1247
|
|
|
1206
1248
|
request_url = self.users_url()
|
|
1207
1249
|
|
|
1208
|
-
logger.
|
|
1250
|
+
logger.debug(
|
|
1209
1251
|
"Adding user -> %s to partition -> %s; calling -> %s",
|
|
1210
1252
|
name,
|
|
1211
1253
|
partition,
|
|
@@ -1226,8 +1268,8 @@ class OTDS:
|
|
|
1226
1268
|
return self.parse_request_response(response)
|
|
1227
1269
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1228
1270
|
elif response.status_code == 401 and retries == 0:
|
|
1229
|
-
logger.
|
|
1230
|
-
self.authenticate(True)
|
|
1271
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1272
|
+
self.authenticate(revalidate=True)
|
|
1231
1273
|
retries += 1
|
|
1232
1274
|
else:
|
|
1233
1275
|
logger.error(
|
|
@@ -1252,7 +1294,7 @@ class OTDS:
|
|
|
1252
1294
|
|
|
1253
1295
|
request_url = self.users_url() + "/" + user_id + "@" + partition
|
|
1254
1296
|
|
|
1255
|
-
logger.
|
|
1297
|
+
logger.debug(
|
|
1256
1298
|
"Get user -> %s in partition -> %s; calling -> %s",
|
|
1257
1299
|
user_id,
|
|
1258
1300
|
partition,
|
|
@@ -1271,8 +1313,8 @@ class OTDS:
|
|
|
1271
1313
|
return self.parse_request_response(response)
|
|
1272
1314
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1273
1315
|
elif response.status_code == 401 and retries == 0:
|
|
1274
|
-
logger.
|
|
1275
|
-
self.authenticate(True)
|
|
1316
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1317
|
+
self.authenticate(revalidate=True)
|
|
1276
1318
|
retries += 1
|
|
1277
1319
|
else:
|
|
1278
1320
|
logger.error(
|
|
@@ -1309,14 +1351,14 @@ class OTDS:
|
|
|
1309
1351
|
request_url += "?{}".format(encodedQuery)
|
|
1310
1352
|
|
|
1311
1353
|
if partition:
|
|
1312
|
-
logger.
|
|
1354
|
+
logger.debug(
|
|
1313
1355
|
"Get all users in partition -> %s (limit -> %s); calling -> %s",
|
|
1314
1356
|
partition,
|
|
1315
1357
|
limit,
|
|
1316
1358
|
request_url,
|
|
1317
1359
|
)
|
|
1318
1360
|
else:
|
|
1319
|
-
logger.
|
|
1361
|
+
logger.debug(
|
|
1320
1362
|
"Get all users (limit -> %s); calling -> %s",
|
|
1321
1363
|
limit,
|
|
1322
1364
|
request_url,
|
|
@@ -1334,8 +1376,8 @@ class OTDS:
|
|
|
1334
1376
|
return self.parse_request_response(response)
|
|
1335
1377
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1336
1378
|
elif response.status_code == 401 and retries == 0:
|
|
1337
|
-
logger.
|
|
1338
|
-
self.authenticate(True)
|
|
1379
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1380
|
+
self.authenticate(revalidate=True)
|
|
1339
1381
|
retries += 1
|
|
1340
1382
|
else:
|
|
1341
1383
|
if partition:
|
|
@@ -1382,7 +1424,7 @@ class OTDS:
|
|
|
1382
1424
|
|
|
1383
1425
|
request_url = self.users_url() + "/" + user_id
|
|
1384
1426
|
|
|
1385
|
-
logger.
|
|
1427
|
+
logger.debug(
|
|
1386
1428
|
"Update user -> %s attribute -> %s to value -> %s; calling -> %s",
|
|
1387
1429
|
user_id,
|
|
1388
1430
|
attribute_name,
|
|
@@ -1403,9 +1445,12 @@ class OTDS:
|
|
|
1403
1445
|
return self.parse_request_response(response)
|
|
1404
1446
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1405
1447
|
elif response.status_code == 401 and retries == 0:
|
|
1406
|
-
logger.
|
|
1407
|
-
self.authenticate(True)
|
|
1448
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1449
|
+
self.authenticate(revalidate=True)
|
|
1408
1450
|
retries += 1
|
|
1451
|
+
elif response.status_code == 404:
|
|
1452
|
+
logger.warning("User does not exist -> %s", user_id)
|
|
1453
|
+
return None
|
|
1409
1454
|
else:
|
|
1410
1455
|
logger.error(
|
|
1411
1456
|
"Failed to update user -> %s; error -> %s (%s)",
|
|
@@ -1429,7 +1474,7 @@ class OTDS:
|
|
|
1429
1474
|
|
|
1430
1475
|
request_url = self.users_url() + "/" + user_id + "@" + partition
|
|
1431
1476
|
|
|
1432
|
-
logger.
|
|
1477
|
+
logger.debug(
|
|
1433
1478
|
"Delete user -> %s in partition -> %s; calling -> %s",
|
|
1434
1479
|
user_id,
|
|
1435
1480
|
partition,
|
|
@@ -1448,8 +1493,8 @@ class OTDS:
|
|
|
1448
1493
|
return True
|
|
1449
1494
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1450
1495
|
elif response.status_code == 401 and retries == 0:
|
|
1451
|
-
logger.
|
|
1452
|
-
self.authenticate(True)
|
|
1496
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1497
|
+
self.authenticate(revalidate=True)
|
|
1453
1498
|
retries += 1
|
|
1454
1499
|
else:
|
|
1455
1500
|
logger.error(
|
|
@@ -1476,7 +1521,7 @@ class OTDS:
|
|
|
1476
1521
|
|
|
1477
1522
|
request_url = "{}/{}/password".format(self.users_url(), user_id)
|
|
1478
1523
|
|
|
1479
|
-
logger.
|
|
1524
|
+
logger.debug(
|
|
1480
1525
|
"Resetting password for user -> %s; calling -> %s", user_id, request_url
|
|
1481
1526
|
)
|
|
1482
1527
|
|
|
@@ -1493,8 +1538,8 @@ class OTDS:
|
|
|
1493
1538
|
return True
|
|
1494
1539
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1495
1540
|
elif response.status_code == 401 and retries == 0:
|
|
1496
|
-
logger.
|
|
1497
|
-
self.authenticate(True)
|
|
1541
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1542
|
+
self.authenticate(revalidate=True)
|
|
1498
1543
|
retries += 1
|
|
1499
1544
|
else:
|
|
1500
1545
|
logger.error(
|
|
@@ -1526,7 +1571,7 @@ class OTDS:
|
|
|
1526
1571
|
|
|
1527
1572
|
request_url = self.groups_url()
|
|
1528
1573
|
|
|
1529
|
-
logger.
|
|
1574
|
+
logger.debug(
|
|
1530
1575
|
"Adding group -> %s to partition -> %s; calling -> %s",
|
|
1531
1576
|
name,
|
|
1532
1577
|
partition,
|
|
@@ -1547,8 +1592,8 @@ class OTDS:
|
|
|
1547
1592
|
return self.parse_request_response(response)
|
|
1548
1593
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1549
1594
|
elif response.status_code == 401 and retries == 0:
|
|
1550
|
-
logger.
|
|
1551
|
-
self.authenticate(True)
|
|
1595
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1596
|
+
self.authenticate(revalidate=True)
|
|
1552
1597
|
retries += 1
|
|
1553
1598
|
else:
|
|
1554
1599
|
logger.error(
|
|
@@ -1588,7 +1633,7 @@ class OTDS:
|
|
|
1588
1633
|
|
|
1589
1634
|
request_url = self.groups_url() + "/" + group
|
|
1590
1635
|
|
|
1591
|
-
logger.
|
|
1636
|
+
logger.debug("Get group -> %s; calling -> %s", group, request_url)
|
|
1592
1637
|
|
|
1593
1638
|
retries = 0
|
|
1594
1639
|
while True:
|
|
@@ -1602,8 +1647,8 @@ class OTDS:
|
|
|
1602
1647
|
return self.parse_request_response(response)
|
|
1603
1648
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1604
1649
|
elif response.status_code == 401 and retries == 0:
|
|
1605
|
-
logger.
|
|
1606
|
-
self.authenticate(True)
|
|
1650
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1651
|
+
self.authenticate(revalidate=True)
|
|
1607
1652
|
retries += 1
|
|
1608
1653
|
else:
|
|
1609
1654
|
logger.error(
|
|
@@ -1630,7 +1675,7 @@ class OTDS:
|
|
|
1630
1675
|
|
|
1631
1676
|
request_url = self.users_url() + "/" + user + "/memberof"
|
|
1632
1677
|
|
|
1633
|
-
logger.
|
|
1678
|
+
logger.debug(
|
|
1634
1679
|
"Adding user -> %s to group -> %s; calling -> %s", user, group, request_url
|
|
1635
1680
|
)
|
|
1636
1681
|
|
|
@@ -1647,8 +1692,8 @@ class OTDS:
|
|
|
1647
1692
|
return True
|
|
1648
1693
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1649
1694
|
elif response.status_code == 401 and retries == 0:
|
|
1650
|
-
logger.
|
|
1651
|
-
self.authenticate(True)
|
|
1695
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1696
|
+
self.authenticate(revalidate=True)
|
|
1652
1697
|
retries += 1
|
|
1653
1698
|
else:
|
|
1654
1699
|
logger.error(
|
|
@@ -1676,7 +1721,7 @@ class OTDS:
|
|
|
1676
1721
|
|
|
1677
1722
|
request_url = self.groups_url() + "/" + group + "/memberof"
|
|
1678
1723
|
|
|
1679
|
-
logger.
|
|
1724
|
+
logger.debug(
|
|
1680
1725
|
"Adding group -> %s to parent group -> %s; calling -> %s",
|
|
1681
1726
|
group,
|
|
1682
1727
|
parent_group,
|
|
@@ -1697,8 +1742,8 @@ class OTDS:
|
|
|
1697
1742
|
return True
|
|
1698
1743
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1699
1744
|
elif response.status_code == 401 and retries == 0:
|
|
1700
|
-
logger.
|
|
1701
|
-
self.authenticate(True)
|
|
1745
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1746
|
+
self.authenticate(revalidate=True)
|
|
1702
1747
|
retries += 1
|
|
1703
1748
|
else:
|
|
1704
1749
|
logger.error(
|
|
@@ -1743,7 +1788,7 @@ class OTDS:
|
|
|
1743
1788
|
|
|
1744
1789
|
request_url = self.config()["resourceUrl"]
|
|
1745
1790
|
|
|
1746
|
-
logger.
|
|
1791
|
+
logger.debug(
|
|
1747
1792
|
"Adding resource -> %s (%s); calling -> %s", name, description, request_url
|
|
1748
1793
|
)
|
|
1749
1794
|
|
|
@@ -1760,8 +1805,8 @@ class OTDS:
|
|
|
1760
1805
|
return self.parse_request_response(response)
|
|
1761
1806
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1762
1807
|
elif response.status_code == 401 and retries == 0:
|
|
1763
|
-
logger.
|
|
1764
|
-
self.authenticate(True)
|
|
1808
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1809
|
+
self.authenticate(revalidate=True)
|
|
1765
1810
|
retries += 1
|
|
1766
1811
|
else:
|
|
1767
1812
|
logger.error(
|
|
@@ -1786,7 +1831,7 @@ class OTDS:
|
|
|
1786
1831
|
|
|
1787
1832
|
request_url = "{}/{}".format(self.config()["resourceUrl"], name)
|
|
1788
1833
|
|
|
1789
|
-
logger.
|
|
1834
|
+
logger.debug("Retrieving resource -> %s; calling -> %s", name, request_url)
|
|
1790
1835
|
|
|
1791
1836
|
retries = 0
|
|
1792
1837
|
while True:
|
|
@@ -1800,8 +1845,8 @@ class OTDS:
|
|
|
1800
1845
|
return self.parse_request_response(response)
|
|
1801
1846
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1802
1847
|
elif response.status_code == 401 and retries == 0:
|
|
1803
|
-
logger.
|
|
1804
|
-
self.authenticate(True)
|
|
1848
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1849
|
+
self.authenticate(revalidate=True)
|
|
1805
1850
|
retries += 1
|
|
1806
1851
|
else:
|
|
1807
1852
|
# We don't necessarily want to log an error as this function
|
|
@@ -1813,7 +1858,7 @@ class OTDS:
|
|
|
1813
1858
|
response.text,
|
|
1814
1859
|
)
|
|
1815
1860
|
else:
|
|
1816
|
-
logger.
|
|
1861
|
+
logger.debug("Resource -> %s not found.", name)
|
|
1817
1862
|
return None
|
|
1818
1863
|
|
|
1819
1864
|
# end method definition
|
|
@@ -1833,7 +1878,7 @@ class OTDS:
|
|
|
1833
1878
|
|
|
1834
1879
|
request_url = "{}/{}".format(self.config()["resourceUrl"], name)
|
|
1835
1880
|
|
|
1836
|
-
logger.
|
|
1881
|
+
logger.debug("Updating resource -> %s; calling -> %s", name, request_url)
|
|
1837
1882
|
|
|
1838
1883
|
retries = 0
|
|
1839
1884
|
while True:
|
|
@@ -1848,8 +1893,8 @@ class OTDS:
|
|
|
1848
1893
|
return self.parse_request_response(response)
|
|
1849
1894
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1850
1895
|
elif response.status_code == 401 and retries == 0:
|
|
1851
|
-
logger.
|
|
1852
|
-
self.authenticate(True)
|
|
1896
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1897
|
+
self.authenticate(revalidate=True)
|
|
1853
1898
|
retries += 1
|
|
1854
1899
|
else:
|
|
1855
1900
|
# We don't necessarily want to log an error as this function
|
|
@@ -1861,7 +1906,7 @@ class OTDS:
|
|
|
1861
1906
|
response.text,
|
|
1862
1907
|
)
|
|
1863
1908
|
else:
|
|
1864
|
-
logger.
|
|
1909
|
+
logger.debug("Resource -> %s not found.", name)
|
|
1865
1910
|
return None
|
|
1866
1911
|
|
|
1867
1912
|
# end method definition
|
|
@@ -1879,7 +1924,7 @@ class OTDS:
|
|
|
1879
1924
|
|
|
1880
1925
|
request_url = "{}/{}/activate".format(self.config()["resourceUrl"], resource_id)
|
|
1881
1926
|
|
|
1882
|
-
logger.
|
|
1927
|
+
logger.debug(
|
|
1883
1928
|
"Activating resource -> %s; calling -> %s", resource_id, request_url
|
|
1884
1929
|
)
|
|
1885
1930
|
|
|
@@ -1896,8 +1941,8 @@ class OTDS:
|
|
|
1896
1941
|
return self.parse_request_response(response)
|
|
1897
1942
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1898
1943
|
elif response.status_code == 401 and retries == 0:
|
|
1899
|
-
logger.
|
|
1900
|
-
self.authenticate(True)
|
|
1944
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1945
|
+
self.authenticate(revalidate=True)
|
|
1901
1946
|
retries += 1
|
|
1902
1947
|
else:
|
|
1903
1948
|
logger.error(
|
|
@@ -1921,7 +1966,7 @@ class OTDS:
|
|
|
1921
1966
|
|
|
1922
1967
|
request_url = self.config()["accessRoleUrl"]
|
|
1923
1968
|
|
|
1924
|
-
logger.
|
|
1969
|
+
logger.debug("Retrieving access roles; calling -> %s", request_url)
|
|
1925
1970
|
|
|
1926
1971
|
retries = 0
|
|
1927
1972
|
while True:
|
|
@@ -1935,8 +1980,8 @@ class OTDS:
|
|
|
1935
1980
|
return self.parse_request_response(response)
|
|
1936
1981
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1937
1982
|
elif response.status_code == 401 and retries == 0:
|
|
1938
|
-
logger.
|
|
1939
|
-
self.authenticate(True)
|
|
1983
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
1984
|
+
self.authenticate(revalidate=True)
|
|
1940
1985
|
retries += 1
|
|
1941
1986
|
else:
|
|
1942
1987
|
logger.error(
|
|
@@ -1959,7 +2004,7 @@ class OTDS:
|
|
|
1959
2004
|
|
|
1960
2005
|
request_url = self.config()["accessRoleUrl"] + "/" + access_role
|
|
1961
2006
|
|
|
1962
|
-
logger.
|
|
2007
|
+
logger.debug(
|
|
1963
2008
|
"Retrieving access role -> %s; calling -> %s", access_role, request_url
|
|
1964
2009
|
)
|
|
1965
2010
|
|
|
@@ -1975,8 +2020,8 @@ class OTDS:
|
|
|
1975
2020
|
return self.parse_request_response(response)
|
|
1976
2021
|
# Check if Session has expired - then re-authenticate and try once more
|
|
1977
2022
|
elif response.status_code == 401 and retries == 0:
|
|
1978
|
-
logger.
|
|
1979
|
-
self.authenticate(True)
|
|
2023
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2024
|
+
self.authenticate(revalidate=True)
|
|
1980
2025
|
retries += 1
|
|
1981
2026
|
else:
|
|
1982
2027
|
logger.error(
|
|
@@ -2012,7 +2057,7 @@ class OTDS:
|
|
|
2012
2057
|
self.config()["accessRoleUrl"], access_role
|
|
2013
2058
|
)
|
|
2014
2059
|
|
|
2015
|
-
logger.
|
|
2060
|
+
logger.debug(
|
|
2016
2061
|
"Add user partition -> %s to access role -> %s; calling -> %s",
|
|
2017
2062
|
partition,
|
|
2018
2063
|
access_role,
|
|
@@ -2031,8 +2076,8 @@ class OTDS:
|
|
|
2031
2076
|
if response.ok:
|
|
2032
2077
|
return True
|
|
2033
2078
|
elif response.status_code == 401 and retries == 0:
|
|
2034
|
-
logger.
|
|
2035
|
-
self.authenticate(True)
|
|
2079
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2080
|
+
self.authenticate(revalidate=True)
|
|
2036
2081
|
retries += 1
|
|
2037
2082
|
else:
|
|
2038
2083
|
logger.error(
|
|
@@ -2071,14 +2116,14 @@ class OTDS:
|
|
|
2071
2116
|
accessRoleUsers = accessRolesGetResponse["accessRoleMembers"]["users"]
|
|
2072
2117
|
for user in accessRoleUsers:
|
|
2073
2118
|
if user["displayName"] == user_id:
|
|
2074
|
-
logger.
|
|
2119
|
+
logger.debug(
|
|
2075
2120
|
"User -> %s already added to access role -> %s",
|
|
2076
2121
|
user_id,
|
|
2077
2122
|
access_role,
|
|
2078
2123
|
)
|
|
2079
2124
|
return True
|
|
2080
2125
|
|
|
2081
|
-
logger.
|
|
2126
|
+
logger.debug(
|
|
2082
2127
|
"User -> %s is not yet in access role -> %s - adding...",
|
|
2083
2128
|
user_id,
|
|
2084
2129
|
access_role,
|
|
@@ -2091,7 +2136,7 @@ class OTDS:
|
|
|
2091
2136
|
self.config()["accessRoleUrl"], access_role
|
|
2092
2137
|
)
|
|
2093
2138
|
|
|
2094
|
-
logger.
|
|
2139
|
+
logger.debug(
|
|
2095
2140
|
"Add user -> %s to access role -> %s; calling -> %s",
|
|
2096
2141
|
user_id,
|
|
2097
2142
|
access_role,
|
|
@@ -2110,8 +2155,8 @@ class OTDS:
|
|
|
2110
2155
|
if response.ok:
|
|
2111
2156
|
return True
|
|
2112
2157
|
elif response.status_code == 401 and retries == 0:
|
|
2113
|
-
logger.
|
|
2114
|
-
self.authenticate(True)
|
|
2158
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2159
|
+
self.authenticate(revalidate=True)
|
|
2115
2160
|
retries += 1
|
|
2116
2161
|
else:
|
|
2117
2162
|
logger.error(
|
|
@@ -2149,12 +2194,12 @@ class OTDS:
|
|
|
2149
2194
|
accessRoleGroups = accessRolesGetResponse["accessRoleMembers"]["groups"]
|
|
2150
2195
|
for accessRoleGroup in accessRoleGroups:
|
|
2151
2196
|
if accessRoleGroup["name"] == group:
|
|
2152
|
-
logger.
|
|
2197
|
+
logger.debug(
|
|
2153
2198
|
"Group -> %s already added to access role -> %s", group, access_role
|
|
2154
2199
|
)
|
|
2155
2200
|
return True
|
|
2156
2201
|
|
|
2157
|
-
logger.
|
|
2202
|
+
logger.debug(
|
|
2158
2203
|
"Group -> %s is not yet in access role -> %s - adding...",
|
|
2159
2204
|
group,
|
|
2160
2205
|
access_role,
|
|
@@ -2167,7 +2212,7 @@ class OTDS:
|
|
|
2167
2212
|
self.config()["accessRoleUrl"], access_role
|
|
2168
2213
|
)
|
|
2169
2214
|
|
|
2170
|
-
logger.
|
|
2215
|
+
logger.debug(
|
|
2171
2216
|
"Add group -> %s to access role -> %s; calling -> %s",
|
|
2172
2217
|
group,
|
|
2173
2218
|
access_role,
|
|
@@ -2186,8 +2231,8 @@ class OTDS:
|
|
|
2186
2231
|
if response.ok:
|
|
2187
2232
|
return True
|
|
2188
2233
|
elif response.status_code == 401 and retries == 0:
|
|
2189
|
-
logger.
|
|
2190
|
-
self.authenticate(True)
|
|
2234
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2235
|
+
self.authenticate(revalidate=True)
|
|
2191
2236
|
retries += 1
|
|
2192
2237
|
else:
|
|
2193
2238
|
logger.error(
|
|
@@ -2229,7 +2274,7 @@ class OTDS:
|
|
|
2229
2274
|
|
|
2230
2275
|
request_url = "{}/{}/attributes".format(self.config()["accessRoleUrl"], name)
|
|
2231
2276
|
|
|
2232
|
-
logger.
|
|
2277
|
+
logger.debug(
|
|
2233
2278
|
"Update access role -> %s with attributes -> %s; calling -> %s",
|
|
2234
2279
|
name,
|
|
2235
2280
|
accessRolePutBodyJson,
|
|
@@ -2249,8 +2294,8 @@ class OTDS:
|
|
|
2249
2294
|
return self.parse_request_response(response)
|
|
2250
2295
|
# Check if Session has expired - then re-authenticate and try once more
|
|
2251
2296
|
elif response.status_code == 401 and retries == 0:
|
|
2252
|
-
logger.
|
|
2253
|
-
self.authenticate(True)
|
|
2297
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2298
|
+
self.authenticate(revalidate=True)
|
|
2254
2299
|
retries += 1
|
|
2255
2300
|
else:
|
|
2256
2301
|
logger.error(
|
|
@@ -2285,7 +2330,7 @@ class OTDS:
|
|
|
2285
2330
|
request_url = "{}/system_attributes".format(self.config()["systemConfigUrl"])
|
|
2286
2331
|
|
|
2287
2332
|
if description:
|
|
2288
|
-
logger.
|
|
2333
|
+
logger.debug(
|
|
2289
2334
|
"Add system attribute -> %s (%s) with value -> %s; calling -> %s",
|
|
2290
2335
|
name,
|
|
2291
2336
|
description,
|
|
@@ -2293,7 +2338,7 @@ class OTDS:
|
|
|
2293
2338
|
request_url,
|
|
2294
2339
|
)
|
|
2295
2340
|
else:
|
|
2296
|
-
logger.
|
|
2341
|
+
logger.debug(
|
|
2297
2342
|
"Add system attribute -> %s with value -> %s; calling -> %s",
|
|
2298
2343
|
name,
|
|
2299
2344
|
value,
|
|
@@ -2313,8 +2358,8 @@ class OTDS:
|
|
|
2313
2358
|
return self.parse_request_response(response)
|
|
2314
2359
|
# Check if Session has expired - then re-authenticate and try once more
|
|
2315
2360
|
elif response.status_code == 401 and retries == 0:
|
|
2316
|
-
logger.
|
|
2317
|
-
self.authenticate(True)
|
|
2361
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2362
|
+
self.authenticate(revalidate=True)
|
|
2318
2363
|
retries += 1
|
|
2319
2364
|
else:
|
|
2320
2365
|
logger.error(
|
|
@@ -2339,7 +2384,7 @@ class OTDS:
|
|
|
2339
2384
|
|
|
2340
2385
|
request_url = "{}/whitelist".format(self.config()["systemConfigUrl"])
|
|
2341
2386
|
|
|
2342
|
-
logger.
|
|
2387
|
+
logger.debug("Retrieving trusted sites; calling -> %s", request_url)
|
|
2343
2388
|
|
|
2344
2389
|
retries = 0
|
|
2345
2390
|
while True:
|
|
@@ -2353,8 +2398,8 @@ class OTDS:
|
|
|
2353
2398
|
return self.parse_request_response(response)
|
|
2354
2399
|
# Check if Session has expired - then re-authenticate and try once more
|
|
2355
2400
|
elif response.status_code == 401 and retries == 0:
|
|
2356
|
-
logger.
|
|
2357
|
-
self.authenticate(True)
|
|
2401
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2402
|
+
self.authenticate(revalidate=True)
|
|
2358
2403
|
retries += 1
|
|
2359
2404
|
else:
|
|
2360
2405
|
logger.error(
|
|
@@ -2388,7 +2433,7 @@ class OTDS:
|
|
|
2388
2433
|
|
|
2389
2434
|
request_url = "{}/whitelist".format(self.config()["systemConfigUrl"])
|
|
2390
2435
|
|
|
2391
|
-
logger.
|
|
2436
|
+
logger.debug("Add trusted site -> %s; calling -> %s", trusted_site, request_url)
|
|
2392
2437
|
|
|
2393
2438
|
response = requests.put(
|
|
2394
2439
|
url=request_url,
|
|
@@ -2476,7 +2521,7 @@ class OTDS:
|
|
|
2476
2521
|
|
|
2477
2522
|
request_url = "{}/audit".format(self.config()["systemConfigUrl"])
|
|
2478
2523
|
|
|
2479
|
-
logger.
|
|
2524
|
+
logger.debug("Enable audit; calling -> %s", request_url)
|
|
2480
2525
|
|
|
2481
2526
|
response = requests.put(
|
|
2482
2527
|
url=request_url,
|
|
@@ -2597,7 +2642,7 @@ class OTDS:
|
|
|
2597
2642
|
|
|
2598
2643
|
request_url = self.oauth_client_url()
|
|
2599
2644
|
|
|
2600
|
-
logger.
|
|
2645
|
+
logger.debug(
|
|
2601
2646
|
"Adding oauth client -> %s (%s); calling -> %s",
|
|
2602
2647
|
description,
|
|
2603
2648
|
client_id,
|
|
@@ -2617,8 +2662,8 @@ class OTDS:
|
|
|
2617
2662
|
return self.parse_request_response(response)
|
|
2618
2663
|
# Check if Session has expired - then re-authenticate and try once more
|
|
2619
2664
|
elif response.status_code == 401 and retries == 0:
|
|
2620
|
-
logger.
|
|
2621
|
-
self.authenticate(True)
|
|
2665
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2666
|
+
self.authenticate(revalidate=True)
|
|
2622
2667
|
retries += 1
|
|
2623
2668
|
else:
|
|
2624
2669
|
logger.error(
|
|
@@ -2643,7 +2688,7 @@ class OTDS:
|
|
|
2643
2688
|
|
|
2644
2689
|
request_url = "{}/{}".format(self.oauth_client_url(), client_id)
|
|
2645
2690
|
|
|
2646
|
-
logger.
|
|
2691
|
+
logger.debug("Get oauth client -> %s; calling -> %s", client_id, request_url)
|
|
2647
2692
|
|
|
2648
2693
|
retries = 0
|
|
2649
2694
|
while True:
|
|
@@ -2657,8 +2702,8 @@ class OTDS:
|
|
|
2657
2702
|
return self.parse_request_response(response)
|
|
2658
2703
|
# Check if Session has expired - then re-authenticate and try once more
|
|
2659
2704
|
elif response.status_code == 401 and retries == 0:
|
|
2660
|
-
logger.
|
|
2661
|
-
self.authenticate(True)
|
|
2705
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2706
|
+
self.authenticate(revalidate=True)
|
|
2662
2707
|
retries += 1
|
|
2663
2708
|
else:
|
|
2664
2709
|
if show_error:
|
|
@@ -2688,7 +2733,7 @@ class OTDS:
|
|
|
2688
2733
|
|
|
2689
2734
|
request_url = "{}/{}".format(self.oauth_client_url(), client_id)
|
|
2690
2735
|
|
|
2691
|
-
logger.
|
|
2736
|
+
logger.debug(
|
|
2692
2737
|
"Update OAuth client -> %s with -> %s; calling -> %s",
|
|
2693
2738
|
client_id,
|
|
2694
2739
|
updates,
|
|
@@ -2708,8 +2753,8 @@ class OTDS:
|
|
|
2708
2753
|
return self.parse_request_response(response)
|
|
2709
2754
|
# Check if Session has expired - then re-authenticate and try once more
|
|
2710
2755
|
elif response.status_code == 401 and retries == 0:
|
|
2711
|
-
logger.
|
|
2712
|
-
self.authenticate(True)
|
|
2756
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2757
|
+
self.authenticate(revalidate=True)
|
|
2713
2758
|
retries += 1
|
|
2714
2759
|
else:
|
|
2715
2760
|
logger.error(
|
|
@@ -2733,7 +2778,7 @@ class OTDS:
|
|
|
2733
2778
|
|
|
2734
2779
|
request_url = self.config()["accessRoleUrl"] + "/" + access_role_name
|
|
2735
2780
|
|
|
2736
|
-
logger.
|
|
2781
|
+
logger.debug(
|
|
2737
2782
|
"Get access role -> %s; calling -> %s", access_role_name, request_url
|
|
2738
2783
|
)
|
|
2739
2784
|
|
|
@@ -2750,8 +2795,8 @@ class OTDS:
|
|
|
2750
2795
|
break
|
|
2751
2796
|
# Check if Session has expired - then re-authenticate and try once more
|
|
2752
2797
|
elif response.status_code == 401 and retries == 0:
|
|
2753
|
-
logger.
|
|
2754
|
-
self.authenticate(True)
|
|
2798
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2799
|
+
self.authenticate(revalidate=True)
|
|
2755
2800
|
retries += 1
|
|
2756
2801
|
else:
|
|
2757
2802
|
logger.error(
|
|
@@ -2815,7 +2860,7 @@ class OTDS:
|
|
|
2815
2860
|
)
|
|
2816
2861
|
|
|
2817
2862
|
if response.ok:
|
|
2818
|
-
logger.
|
|
2863
|
+
logger.debug(
|
|
2819
2864
|
"OauthClients partition successfully added to access role -> %s",
|
|
2820
2865
|
access_role_name,
|
|
2821
2866
|
)
|
|
@@ -2917,7 +2962,7 @@ class OTDS:
|
|
|
2917
2962
|
|
|
2918
2963
|
request_url = "{}/{}".format(self.auth_handler_url(), name)
|
|
2919
2964
|
|
|
2920
|
-
logger.
|
|
2965
|
+
logger.debug(
|
|
2921
2966
|
"Getting authentication handler -> %s; calling -> %s", name, request_url
|
|
2922
2967
|
)
|
|
2923
2968
|
|
|
@@ -2933,8 +2978,8 @@ class OTDS:
|
|
|
2933
2978
|
return self.parse_request_response(response)
|
|
2934
2979
|
# Check if Session has expired - then re-authenticate and try once more
|
|
2935
2980
|
elif response.status_code == 401 and retries == 0:
|
|
2936
|
-
logger.
|
|
2937
|
-
self.authenticate(True)
|
|
2981
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
2982
|
+
self.authenticate(revalidate=True)
|
|
2938
2983
|
retries += 1
|
|
2939
2984
|
else:
|
|
2940
2985
|
if show_error:
|
|
@@ -3062,12 +3107,214 @@ class OTDS:
|
|
|
3062
3107
|
"_description": "Specifies the SAML binding to use for the response to an AuthnRequest",
|
|
3063
3108
|
"_value": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
|
|
3064
3109
|
},
|
|
3110
|
+
{
|
|
3111
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim1",
|
|
3112
|
+
"_name": "Claim 1",
|
|
3113
|
+
"_description": "SAML attribute/claim that should be mapped to an OTDS user attribute. This value is case sensitive. Note that mapped claims are only relevant if the corresponding account is auto-provisioned in OTDS. See the Administration Guide for details.",
|
|
3114
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
|
|
3115
|
+
},
|
|
3116
|
+
{
|
|
3117
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute1",
|
|
3118
|
+
"_name": "OTDS Attribute 1",
|
|
3119
|
+
"_description": "OTDS user attribute to which the SAML attribute/claim should be mapped",
|
|
3120
|
+
"_value": "mail",
|
|
3121
|
+
},
|
|
3122
|
+
{
|
|
3123
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim2",
|
|
3124
|
+
"_name": "Claim 2",
|
|
3125
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname",
|
|
3126
|
+
},
|
|
3127
|
+
{
|
|
3128
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute2",
|
|
3129
|
+
"_name": "OTDS Attribute 2",
|
|
3130
|
+
"_value": "givenName",
|
|
3131
|
+
},
|
|
3132
|
+
{
|
|
3133
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim3",
|
|
3134
|
+
"_name": "Claim 3",
|
|
3135
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname",
|
|
3136
|
+
},
|
|
3137
|
+
{
|
|
3138
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute3",
|
|
3139
|
+
"_name": "OTDS Attribute 3",
|
|
3140
|
+
"_value": "sn",
|
|
3141
|
+
},
|
|
3142
|
+
{
|
|
3143
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim4",
|
|
3144
|
+
"_name": "Claim 4",
|
|
3145
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
|
|
3146
|
+
},
|
|
3147
|
+
{
|
|
3148
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute4",
|
|
3149
|
+
"_name": "OTDS Attribute 4",
|
|
3150
|
+
"_value": "displayName",
|
|
3151
|
+
},
|
|
3152
|
+
{
|
|
3153
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim5",
|
|
3154
|
+
"_name": "Claim 5",
|
|
3155
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/streetaddress",
|
|
3156
|
+
},
|
|
3157
|
+
{
|
|
3158
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute5",
|
|
3159
|
+
"_name": "OTDS Attribute 5",
|
|
3160
|
+
"_value": "oTStreetAddress",
|
|
3161
|
+
},
|
|
3162
|
+
{
|
|
3163
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim6",
|
|
3164
|
+
"_name": "Claim 6",
|
|
3165
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/locality",
|
|
3166
|
+
},
|
|
3167
|
+
{
|
|
3168
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute6",
|
|
3169
|
+
"_name": "OTDS Attribute 6",
|
|
3170
|
+
"_value": "l",
|
|
3171
|
+
},
|
|
3172
|
+
{
|
|
3173
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim7",
|
|
3174
|
+
"_name": "Claim 7",
|
|
3175
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/stateorprovince",
|
|
3176
|
+
},
|
|
3177
|
+
{
|
|
3178
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute7",
|
|
3179
|
+
"_name": "OTDS Attribute 7",
|
|
3180
|
+
"_value": "st",
|
|
3181
|
+
},
|
|
3182
|
+
{
|
|
3183
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim8",
|
|
3184
|
+
"_name": "Claim 8",
|
|
3185
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/postalcode",
|
|
3186
|
+
},
|
|
3187
|
+
{
|
|
3188
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute8",
|
|
3189
|
+
"_name": "OTDS Attribute 8",
|
|
3190
|
+
"_value": "postalCode",
|
|
3191
|
+
},
|
|
3192
|
+
{
|
|
3193
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim9",
|
|
3194
|
+
"_name": "Claim 9",
|
|
3195
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country",
|
|
3196
|
+
},
|
|
3197
|
+
{
|
|
3198
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute9",
|
|
3199
|
+
"_name": "OTDS Attribute 9",
|
|
3200
|
+
"_value": "countryName",
|
|
3201
|
+
},
|
|
3202
|
+
{
|
|
3203
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim10",
|
|
3204
|
+
"_name": "Claim 10",
|
|
3205
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/otherphone",
|
|
3206
|
+
},
|
|
3207
|
+
{
|
|
3208
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute10",
|
|
3209
|
+
"_name": "OTDS Attribute 10",
|
|
3210
|
+
"_value": "oTTelephoneNumber",
|
|
3211
|
+
},
|
|
3212
|
+
{
|
|
3213
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim11",
|
|
3214
|
+
"_name": "Claim 11",
|
|
3215
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/homephone",
|
|
3216
|
+
},
|
|
3217
|
+
{
|
|
3218
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute11",
|
|
3219
|
+
"_name": "OTDS Attribute 11",
|
|
3220
|
+
"_value": "homePhone",
|
|
3221
|
+
},
|
|
3222
|
+
{
|
|
3223
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim12",
|
|
3224
|
+
"_name": "Claim 12",
|
|
3225
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth",
|
|
3226
|
+
},
|
|
3227
|
+
{
|
|
3228
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute12",
|
|
3229
|
+
"_name": "OTDS Attribute 12",
|
|
3230
|
+
"_value": "birthDate",
|
|
3231
|
+
},
|
|
3232
|
+
{
|
|
3233
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim13",
|
|
3234
|
+
"_name": "Claim 13",
|
|
3235
|
+
"_value": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/gender",
|
|
3236
|
+
},
|
|
3237
|
+
{
|
|
3238
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute13",
|
|
3239
|
+
"_name": "OTDS Attribute 13",
|
|
3240
|
+
"_value": "gender",
|
|
3241
|
+
},
|
|
3242
|
+
{
|
|
3243
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim14",
|
|
3244
|
+
"_name": "Claim 14",
|
|
3245
|
+
"_value": "",
|
|
3246
|
+
},
|
|
3247
|
+
{
|
|
3248
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute14",
|
|
3249
|
+
"_name": "OTDS Attribute 14",
|
|
3250
|
+
"_value": "",
|
|
3251
|
+
},
|
|
3252
|
+
{
|
|
3253
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim15",
|
|
3254
|
+
"_name": "Claim 15",
|
|
3255
|
+
"_value": "http://schemas.xmlsoap.org/claims/Group",
|
|
3256
|
+
},
|
|
3257
|
+
{
|
|
3258
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute15",
|
|
3259
|
+
"_name": "OTDS Attribute 15",
|
|
3260
|
+
"_value": "oTMemberOf",
|
|
3261
|
+
},
|
|
3262
|
+
{
|
|
3263
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim16",
|
|
3264
|
+
"_name": "Claim 16",
|
|
3265
|
+
"_value": "http://schemas.xmlsoap.org/claims/Department",
|
|
3266
|
+
},
|
|
3267
|
+
{
|
|
3268
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute16",
|
|
3269
|
+
"_name": "OTDS Attribute 16",
|
|
3270
|
+
"_value": "oTDepartment",
|
|
3271
|
+
},
|
|
3272
|
+
{
|
|
3273
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim17",
|
|
3274
|
+
"_name": "Claim 17",
|
|
3275
|
+
"_value": "http://schemas.xmlsoap.org/claims/Title",
|
|
3276
|
+
},
|
|
3277
|
+
{
|
|
3278
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute17",
|
|
3279
|
+
"_name": "OTDS Attribute 17",
|
|
3280
|
+
"_value": "title",
|
|
3281
|
+
},
|
|
3282
|
+
{
|
|
3283
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim18",
|
|
3284
|
+
"_name": "Claim 18",
|
|
3285
|
+
"_value": "",
|
|
3286
|
+
},
|
|
3287
|
+
{
|
|
3288
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute18",
|
|
3289
|
+
"_name": "OTDS Attribute 18",
|
|
3290
|
+
"_value": "",
|
|
3291
|
+
},
|
|
3292
|
+
{
|
|
3293
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim19",
|
|
3294
|
+
"_name": "Claim 19",
|
|
3295
|
+
"_value": "http://schemas.microsoft.com/ws/2008/06/identity/claims/role",
|
|
3296
|
+
},
|
|
3297
|
+
{
|
|
3298
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute19",
|
|
3299
|
+
"_name": "OTDS Attribute 19",
|
|
3300
|
+
"_value": "oTMemberOf",
|
|
3301
|
+
},
|
|
3302
|
+
{
|
|
3303
|
+
"_key": "com.opentext.otds.as.drivers.saml.claim20",
|
|
3304
|
+
"_name": "Claim 20",
|
|
3305
|
+
"_value": "",
|
|
3306
|
+
},
|
|
3307
|
+
{
|
|
3308
|
+
"_key": "com.opentext.otds.as.drivers.saml.claimAttribute20",
|
|
3309
|
+
"_name": "OTDS Attribute 20",
|
|
3310
|
+
"_value": "",
|
|
3311
|
+
},
|
|
3065
3312
|
],
|
|
3066
3313
|
}
|
|
3067
3314
|
|
|
3068
3315
|
request_url = self.auth_handler_url()
|
|
3069
3316
|
|
|
3070
|
-
logger.
|
|
3317
|
+
logger.debug(
|
|
3071
3318
|
"Adding SAML auth handler -> %s (%s); calling -> %s",
|
|
3072
3319
|
name,
|
|
3073
3320
|
description,
|
|
@@ -3087,8 +3334,8 @@ class OTDS:
|
|
|
3087
3334
|
return self.parse_request_response(response)
|
|
3088
3335
|
# Check if Session has expired - then re-authenticate and try once more
|
|
3089
3336
|
elif response.status_code == 401 and retries == 0:
|
|
3090
|
-
logger.
|
|
3091
|
-
self.authenticate(True)
|
|
3337
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
3338
|
+
self.authenticate(revalidate=True)
|
|
3092
3339
|
retries += 1
|
|
3093
3340
|
else:
|
|
3094
3341
|
logger.error(
|
|
@@ -3188,7 +3435,7 @@ class OTDS:
|
|
|
3188
3435
|
# 2. Create the auth handler in OTDS
|
|
3189
3436
|
request_url = self.auth_handler_url()
|
|
3190
3437
|
|
|
3191
|
-
logger.
|
|
3438
|
+
logger.debug(
|
|
3192
3439
|
"Adding SAP auth handler -> %s (%s); calling -> %s",
|
|
3193
3440
|
name,
|
|
3194
3441
|
description,
|
|
@@ -3214,7 +3461,7 @@ class OTDS:
|
|
|
3214
3461
|
# 3. Upload the certificate file:
|
|
3215
3462
|
|
|
3216
3463
|
# Check that the certificate (PSE) file is readable:
|
|
3217
|
-
logger.
|
|
3464
|
+
logger.debug("Reading certificate file -> %s...", certificate_file)
|
|
3218
3465
|
try:
|
|
3219
3466
|
# PSE files are binary - so we need to open with "rb":
|
|
3220
3467
|
with open(certificate_file, "rb") as certFile:
|
|
@@ -3238,21 +3485,21 @@ class OTDS:
|
|
|
3238
3485
|
certContentDecoded = base64.b64decode(certContent, validate=True)
|
|
3239
3486
|
certContentEncoded = base64.b64encode(certContentDecoded).decode("utf-8")
|
|
3240
3487
|
if certContentEncoded == certContent.decode("utf-8"):
|
|
3241
|
-
logger.
|
|
3488
|
+
logger.debug(
|
|
3242
3489
|
"Certificate file -> %s is base64 encoded", certificate_file
|
|
3243
3490
|
)
|
|
3244
3491
|
cert_file_encoded = True
|
|
3245
3492
|
else:
|
|
3246
3493
|
cert_file_encoded = False
|
|
3247
3494
|
except TypeError:
|
|
3248
|
-
logger.
|
|
3495
|
+
logger.debug(
|
|
3249
3496
|
"Certificate file -> %s is not base64 encoded", certificate_file
|
|
3250
3497
|
)
|
|
3251
3498
|
cert_file_encoded = False
|
|
3252
3499
|
|
|
3253
3500
|
if cert_file_encoded:
|
|
3254
3501
|
certificate_file = "/tmp/" + os.path.basename(certificate_file)
|
|
3255
|
-
logger.
|
|
3502
|
+
logger.debug("Writing decoded certificate file -> %s...", certificate_file)
|
|
3256
3503
|
try:
|
|
3257
3504
|
# PSE files need to be binary - so we need to open with "wb":
|
|
3258
3505
|
with open(certificate_file, "wb") as certFile:
|
|
@@ -3281,7 +3528,7 @@ class OTDS:
|
|
|
3281
3528
|
|
|
3282
3529
|
request_url = self.auth_handler_url() + "/" + name + "/files"
|
|
3283
3530
|
|
|
3284
|
-
logger.
|
|
3531
|
+
logger.debug(
|
|
3285
3532
|
"Uploading certificate file -> %s for SAP auth handler -> %s (%s); calling -> %s",
|
|
3286
3533
|
certificate_file,
|
|
3287
3534
|
name,
|
|
@@ -3697,7 +3944,7 @@ class OTDS:
|
|
|
3697
3944
|
|
|
3698
3945
|
request_url = self.auth_handler_url()
|
|
3699
3946
|
|
|
3700
|
-
logger.
|
|
3947
|
+
logger.debug(
|
|
3701
3948
|
"Adding OAuth auth handler -> %s (%s); calling -> %s",
|
|
3702
3949
|
name,
|
|
3703
3950
|
description,
|
|
@@ -3717,8 +3964,8 @@ class OTDS:
|
|
|
3717
3964
|
return self.parse_request_response(response)
|
|
3718
3965
|
# Check if Session has expired - then re-authenticate and try once more
|
|
3719
3966
|
elif response.status_code == 401 and retries == 0:
|
|
3720
|
-
logger.
|
|
3721
|
-
self.authenticate(True)
|
|
3967
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
3968
|
+
self.authenticate(revalidate=True)
|
|
3722
3969
|
retries += 1
|
|
3723
3970
|
else:
|
|
3724
3971
|
logger.error(
|
|
@@ -3759,7 +4006,7 @@ class OTDS:
|
|
|
3759
4006
|
|
|
3760
4007
|
request_url = "{}".format(self.consolidation_url())
|
|
3761
4008
|
|
|
3762
|
-
logger.
|
|
4009
|
+
logger.debug(
|
|
3763
4010
|
"Consolidation of resource -> %s; calling -> %s", resource_dn, request_url
|
|
3764
4011
|
)
|
|
3765
4012
|
|
|
@@ -3776,8 +4023,8 @@ class OTDS:
|
|
|
3776
4023
|
return True
|
|
3777
4024
|
# Check if Session has expired - then re-authenticate and try once more
|
|
3778
4025
|
elif response.status_code == 401 and retries == 0:
|
|
3779
|
-
logger.
|
|
3780
|
-
self.authenticate(True)
|
|
4026
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
4027
|
+
self.authenticate(revalidate=True)
|
|
3781
4028
|
retries += 1
|
|
3782
4029
|
else:
|
|
3783
4030
|
logger.error(
|
|
@@ -3817,7 +4064,7 @@ class OTDS:
|
|
|
3817
4064
|
|
|
3818
4065
|
request_url = "{}/{}/impersonation".format(self.resource_url(), resource_name)
|
|
3819
4066
|
|
|
3820
|
-
logger.
|
|
4067
|
+
logger.debug(
|
|
3821
4068
|
"Impersonation settings for resource -> %s; calling -> %s",
|
|
3822
4069
|
resource_name,
|
|
3823
4070
|
request_url,
|
|
@@ -3836,8 +4083,8 @@ class OTDS:
|
|
|
3836
4083
|
return True
|
|
3837
4084
|
# Check if Session has expired - then re-authenticate and try once more
|
|
3838
4085
|
elif response.status_code == 401 and retries == 0:
|
|
3839
|
-
logger.
|
|
3840
|
-
self.authenticate(True)
|
|
4086
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
4087
|
+
self.authenticate(revalidate=True)
|
|
3841
4088
|
retries += 1
|
|
3842
4089
|
else:
|
|
3843
4090
|
logger.error(
|
|
@@ -3876,7 +4123,7 @@ class OTDS:
|
|
|
3876
4123
|
|
|
3877
4124
|
request_url = "{}/{}/impersonation".format(self.oauth_client_url(), client_id)
|
|
3878
4125
|
|
|
3879
|
-
logger.
|
|
4126
|
+
logger.debug(
|
|
3880
4127
|
"Impersonation settings for OAuth Client -> %s; calling -> %s",
|
|
3881
4128
|
client_id,
|
|
3882
4129
|
request_url,
|
|
@@ -3895,8 +4142,8 @@ class OTDS:
|
|
|
3895
4142
|
return True
|
|
3896
4143
|
# Check if Session has expired - then re-authenticate and try once more
|
|
3897
4144
|
elif response.status_code == 401 and retries == 0:
|
|
3898
|
-
logger.
|
|
3899
|
-
self.authenticate(True)
|
|
4145
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
4146
|
+
self.authenticate(revalidate=True)
|
|
3900
4147
|
retries += 1
|
|
3901
4148
|
else:
|
|
3902
4149
|
logger.error(
|
|
@@ -3940,7 +4187,7 @@ class OTDS:
|
|
|
3940
4187
|
|
|
3941
4188
|
request_url = "{}/passwordpolicy".format(self.config()["systemConfigUrl"])
|
|
3942
4189
|
|
|
3943
|
-
logger.
|
|
4190
|
+
logger.debug("Getting password policy; calling -> %s", request_url)
|
|
3944
4191
|
|
|
3945
4192
|
retries = 0
|
|
3946
4193
|
while True:
|
|
@@ -3954,8 +4201,8 @@ class OTDS:
|
|
|
3954
4201
|
return self.parse_request_response(response)
|
|
3955
4202
|
# Check if Session has expired - then re-authenticate and try once more
|
|
3956
4203
|
elif response.status_code == 401 and retries == 0:
|
|
3957
|
-
logger.
|
|
3958
|
-
self.authenticate(True)
|
|
4204
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
4205
|
+
self.authenticate(revalidate=True)
|
|
3959
4206
|
retries += 1
|
|
3960
4207
|
else:
|
|
3961
4208
|
logger.error(
|
|
@@ -4001,7 +4248,7 @@ class OTDS:
|
|
|
4001
4248
|
|
|
4002
4249
|
request_url = "{}/passwordpolicy".format(self.config()["systemConfigUrl"])
|
|
4003
4250
|
|
|
4004
|
-
logger.
|
|
4251
|
+
logger.debug(
|
|
4005
4252
|
"Update password policy with these new values -> %s; calling -> %s",
|
|
4006
4253
|
update_values,
|
|
4007
4254
|
request_url,
|
|
@@ -4020,8 +4267,8 @@ class OTDS:
|
|
|
4020
4267
|
return True
|
|
4021
4268
|
# Check if Session has expired - then re-authenticate and try once more
|
|
4022
4269
|
elif response.status_code == 401 and retries == 0:
|
|
4023
|
-
logger.
|
|
4024
|
-
self.authenticate(True)
|
|
4270
|
+
logger.debug("Session has expired - try to re-authenticate...")
|
|
4271
|
+
self.authenticate(revalidate=True)
|
|
4025
4272
|
retries += 1
|
|
4026
4273
|
else:
|
|
4027
4274
|
logger.error(
|