symphony_bdk_python 2.10.dev0__py3-none-any.whl → 2.11.0__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.
Files changed (435) hide show
  1. symphony/bdk/core/__init__.py +1 -0
  2. symphony/bdk/core/activity/__init__.py +1 -2
  3. symphony/bdk/core/activity/api.py +4 -4
  4. symphony/bdk/core/activity/command.py +17 -9
  5. symphony/bdk/core/activity/exception.py +2 -4
  6. symphony/bdk/core/activity/help_command.py +3 -2
  7. symphony/bdk/core/activity/parsing/arguments.py +1 -1
  8. symphony/bdk/core/activity/parsing/command_token.py +5 -4
  9. symphony/bdk/core/activity/parsing/input_tokenizer.py +13 -5
  10. symphony/bdk/core/activity/parsing/match_result.py +5 -3
  11. symphony/bdk/core/activity/parsing/message_entities.py +7 -6
  12. symphony/bdk/core/activity/parsing/slash_command_pattern.py +22 -7
  13. symphony/bdk/core/activity/registry.py +17 -7
  14. symphony/bdk/core/auth/__init__.py +1 -2
  15. symphony/bdk/core/auth/auth_session.py +33 -14
  16. symphony/bdk/core/auth/authenticator_factory.py +41 -21
  17. symphony/bdk/core/auth/bot_authenticator.py +33 -21
  18. symphony/bdk/core/auth/exception.py +3 -6
  19. symphony/bdk/core/auth/ext_app_authenticator.py +40 -30
  20. symphony/bdk/core/auth/jwt_helper.py +36 -15
  21. symphony/bdk/core/auth/obo_authenticator.py +27 -18
  22. symphony/bdk/core/auth/tokens_repository.py +5 -6
  23. symphony/bdk/core/client/__init__.py +2 -2
  24. symphony/bdk/core/client/api_client_factory.py +40 -22
  25. symphony/bdk/core/client/trace_id.py +3 -4
  26. symphony/bdk/core/config/__init__.py +1 -2
  27. symphony/bdk/core/config/exception.py +2 -4
  28. symphony/bdk/core/config/loader.py +2 -2
  29. symphony/bdk/core/config/model/bdk_app_config.py +5 -3
  30. symphony/bdk/core/config/model/bdk_authentication_config.py +13 -7
  31. symphony/bdk/core/config/model/bdk_bot_config.py +6 -3
  32. symphony/bdk/core/config/model/bdk_client_config.py +1 -1
  33. symphony/bdk/core/config/model/bdk_config.py +12 -7
  34. symphony/bdk/core/config/model/bdk_datafeed_config.py +7 -6
  35. symphony/bdk/core/config/model/bdk_datahose_config.py +1 -2
  36. symphony/bdk/core/config/model/bdk_retry_config.py +7 -3
  37. symphony/bdk/core/config/model/bdk_rsa_key_config.py +4 -5
  38. symphony/bdk/core/config/model/bdk_server_config.py +7 -2
  39. symphony/bdk/core/extension.py +15 -13
  40. symphony/bdk/core/retry/__init__.py +13 -9
  41. symphony/bdk/core/retry/_asyncio.py +10 -7
  42. symphony/bdk/core/retry/strategy.py +5 -2
  43. symphony/bdk/core/service/__init__.py +1 -2
  44. symphony/bdk/core/service/application/application_service.py +51 -41
  45. symphony/bdk/core/service/connection/connection_service.py +14 -23
  46. symphony/bdk/core/service/connection/model/connection_status.py +1 -0
  47. symphony/bdk/core/service/datafeed/abstract_ackId_event_loop.py +24 -14
  48. symphony/bdk/core/service/datafeed/abstract_datafeed_loop.py +16 -7
  49. symphony/bdk/core/service/datafeed/abstract_datahose_loop.py +2 -2
  50. symphony/bdk/core/service/datafeed/datafeed_loop_v1.py +18 -10
  51. symphony/bdk/core/service/datafeed/datafeed_loop_v2.py +31 -21
  52. symphony/bdk/core/service/datafeed/datahose_loop.py +22 -11
  53. symphony/bdk/core/service/datafeed/on_disk_datafeed_id_repository.py +10 -4
  54. symphony/bdk/core/service/datafeed/real_time_event_listener.py +32 -18
  55. symphony/bdk/core/service/exception.py +3 -6
  56. symphony/bdk/core/service/health/health_service.py +5 -4
  57. symphony/bdk/core/service/message/message_parser.py +10 -8
  58. symphony/bdk/core/service/message/message_service.py +196 -161
  59. symphony/bdk/core/service/message/messageml_util.py +6 -6
  60. symphony/bdk/core/service/message/model.py +15 -5
  61. symphony/bdk/core/service/message/multi_attachments_messages_api.py +134 -219
  62. symphony/bdk/core/service/obo_services.py +5 -4
  63. symphony/bdk/core/service/pagination.py +9 -6
  64. symphony/bdk/core/service/presence/presence_service.py +40 -28
  65. symphony/bdk/core/service/session/session_service.py +7 -13
  66. symphony/bdk/core/service/signal/signal_service.py +66 -33
  67. symphony/bdk/core/service/stream/stream_service.py +186 -69
  68. symphony/bdk/core/service/stream/stream_util.py +1 -0
  69. symphony/bdk/core/service/user/model/delegate_action_enum.py +1 -0
  70. symphony/bdk/core/service/user/model/role_id.py +1 -0
  71. symphony/bdk/core/service/user/user_service.py +225 -313
  72. symphony/bdk/core/service/user/user_util.py +4 -6
  73. symphony/bdk/core/service/version/__init__.py +0 -0
  74. symphony/bdk/core/service/version/agent_version_service.py +62 -0
  75. symphony/bdk/core/service_factory.py +50 -53
  76. symphony/bdk/core/symphony_bdk.py +34 -18
  77. symphony/bdk/ext/group.py +52 -37
  78. symphony/bdk/gen/agent_api/attachments_api.py +10 -18
  79. symphony/bdk/gen/agent_api/audit_trail_api.py +8 -12
  80. symphony/bdk/gen/agent_api/datafeed_api.py +34 -219
  81. symphony/bdk/gen/agent_api/datahose_api.py +184 -0
  82. symphony/bdk/gen/agent_api/dlp_policies_and_dictionary_management_api.py +130 -214
  83. symphony/bdk/gen/agent_api/messages_api.py +99 -119
  84. symphony/bdk/gen/agent_api/share_api.py +7 -11
  85. symphony/bdk/gen/agent_api/signals_api.py +1 -1
  86. symphony/bdk/gen/agent_api/system_api.py +1 -1
  87. symphony/bdk/gen/agent_api/util_api.py +13 -21
  88. symphony/bdk/gen/agent_api/violations_api.py +45 -73
  89. symphony/bdk/gen/agent_model/ack_id.py +1 -1
  90. symphony/bdk/gen/agent_model/agent_info.py +1 -1
  91. symphony/bdk/gen/agent_model/attachment_info.py +1 -1
  92. symphony/bdk/gen/agent_model/base_message.py +1 -1
  93. symphony/bdk/gen/agent_model/base_signal.py +1 -1
  94. symphony/bdk/gen/agent_model/channel_subscriber.py +1 -1
  95. symphony/bdk/gen/agent_model/channel_subscriber_response.py +1 -1
  96. symphony/bdk/gen/agent_model/channel_subscription_error.py +1 -1
  97. symphony/bdk/gen/agent_model/channel_subscription_response.py +1 -1
  98. symphony/bdk/gen/agent_model/connection_request_message.py +1 -1
  99. symphony/bdk/gen/agent_model/connection_request_message_all_of.py +1 -1
  100. symphony/bdk/gen/agent_model/datafeed.py +1 -1
  101. symphony/bdk/gen/agent_model/error.py +1 -1
  102. symphony/bdk/gen/agent_model/import_response.py +1 -1
  103. symphony/bdk/gen/agent_model/import_response_list.py +1 -1
  104. symphony/bdk/gen/agent_model/imported_message.py +1 -1
  105. symphony/bdk/gen/agent_model/ingestion_error.py +266 -0
  106. symphony/bdk/gen/agent_model/message.py +1 -1
  107. symphony/bdk/gen/agent_model/message_all_of.py +1 -1
  108. symphony/bdk/gen/agent_model/message_import_list.py +1 -1
  109. symphony/bdk/gen/agent_model/message_list.py +1 -1
  110. symphony/bdk/gen/agent_model/message_search_query.py +1 -1
  111. symphony/bdk/gen/agent_model/message_submission.py +1 -1
  112. symphony/bdk/gen/agent_model/pagination.py +1 -1
  113. symphony/bdk/gen/agent_model/pagination_cursors.py +1 -1
  114. symphony/bdk/gen/agent_model/room_created_message.py +1 -1
  115. symphony/bdk/gen/agent_model/room_created_message_all_of.py +1 -1
  116. symphony/bdk/gen/agent_model/room_deactivated_message.py +1 -1
  117. symphony/bdk/gen/agent_model/room_deactivated_message_all_of.py +1 -1
  118. symphony/bdk/gen/agent_model/room_member_demoted_from_owner_message.py +1 -1
  119. symphony/bdk/gen/agent_model/room_member_demoted_from_owner_message_all_of.py +1 -1
  120. symphony/bdk/gen/agent_model/room_member_promoted_to_owner_message.py +1 -1
  121. symphony/bdk/gen/agent_model/room_member_promoted_to_owner_message_all_of.py +1 -1
  122. symphony/bdk/gen/agent_model/room_reactivated_message.py +1 -1
  123. symphony/bdk/gen/agent_model/room_reactivated_message_all_of.py +1 -1
  124. symphony/bdk/gen/agent_model/room_tag.py +1 -1
  125. symphony/bdk/gen/agent_model/room_updated_message.py +1 -1
  126. symphony/bdk/gen/agent_model/room_updated_message_all_of.py +1 -1
  127. symphony/bdk/gen/agent_model/share_article.py +1 -1
  128. symphony/bdk/gen/agent_model/share_content.py +1 -1
  129. symphony/bdk/gen/agent_model/signal.py +1 -1
  130. symphony/bdk/gen/agent_model/signal_all_of.py +1 -6
  131. symphony/bdk/gen/agent_model/signal_list.py +1 -1
  132. symphony/bdk/gen/agent_model/simple_message.py +1 -1
  133. symphony/bdk/gen/agent_model/success_response.py +1 -1
  134. symphony/bdk/gen/agent_model/user_joined_room_message.py +1 -1
  135. symphony/bdk/gen/agent_model/user_joined_room_message_all_of.py +1 -1
  136. symphony/bdk/gen/agent_model/user_left_room_message.py +1 -1
  137. symphony/bdk/gen/agent_model/user_left_room_message_all_of.py +1 -1
  138. symphony/bdk/gen/agent_model/v1_audit_trail_initiator_list.py +1 -1
  139. symphony/bdk/gen/agent_model/v1_audit_trail_initiator_response.py +1 -1
  140. symphony/bdk/gen/agent_model/v1_dlp_content_type.py +1 -1
  141. symphony/bdk/gen/agent_model/v1_dlp_dictionary.py +1 -1
  142. symphony/bdk/gen/agent_model/v1_dlp_dictionary_content.py +1 -1
  143. symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata.py +1 -1
  144. symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_collection_response.py +1 -1
  145. symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_create_request.py +1 -1
  146. symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_response.py +1 -1
  147. symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_update_request.py +1 -1
  148. symphony/bdk/gen/agent_model/v1_dlp_dictionary_ref.py +1 -1
  149. symphony/bdk/gen/agent_model/v1_dlp_matched_policy.py +1 -1
  150. symphony/bdk/gen/agent_model/v1_dlp_matched_policy_list.py +1 -1
  151. symphony/bdk/gen/agent_model/v1_dlp_outcome.py +1 -1
  152. symphony/bdk/gen/agent_model/v1_dlp_policies_collection_response.py +1 -1
  153. symphony/bdk/gen/agent_model/v1_dlp_policy.py +1 -1
  154. symphony/bdk/gen/agent_model/v1_dlp_policy_request.py +9 -8
  155. symphony/bdk/gen/agent_model/v1_dlp_policy_response.py +1 -1
  156. symphony/bdk/gen/agent_model/v1_dlp_signal.py +6 -1
  157. symphony/bdk/gen/agent_model/v1_dlp_stream.py +1 -1
  158. symphony/bdk/gen/agent_model/v1_dlp_violation.py +1 -1
  159. symphony/bdk/gen/agent_model/v1_dlp_violation_message.py +1 -1
  160. symphony/bdk/gen/agent_model/v1_dlp_violation_message_response.py +1 -1
  161. symphony/bdk/gen/agent_model/v1_dlp_violation_signal.py +1 -1
  162. symphony/bdk/gen/agent_model/v1_dlp_violation_signal_response.py +1 -1
  163. symphony/bdk/gen/agent_model/v1_dlp_violation_stream.py +1 -1
  164. symphony/bdk/gen/agent_model/v1_dlp_violation_stream_response.py +1 -1
  165. symphony/bdk/gen/agent_model/v1_health_check_response.py +1 -1
  166. symphony/bdk/gen/agent_model/v2_base_message.py +1 -1
  167. symphony/bdk/gen/agent_model/v2_error.py +1 -1
  168. symphony/bdk/gen/agent_model/v2_health_check_response.py +1 -1
  169. symphony/bdk/gen/agent_model/v2_import_response.py +1 -1
  170. symphony/bdk/gen/agent_model/v2_import_response_list.py +1 -1
  171. symphony/bdk/gen/agent_model/v2_imported_message.py +1 -1
  172. symphony/bdk/gen/agent_model/v2_message.py +1 -1
  173. symphony/bdk/gen/agent_model/v2_message_all_of.py +1 -1
  174. symphony/bdk/gen/agent_model/v2_message_import_list.py +1 -1
  175. symphony/bdk/gen/agent_model/v2_message_list.py +1 -1
  176. symphony/bdk/gen/agent_model/v2_message_submission.py +1 -1
  177. symphony/bdk/gen/agent_model/v3_dlp_dictionary_meta.py +1 -1
  178. symphony/bdk/gen/agent_model/v3_dlp_file_classifier_config.py +1 -1
  179. symphony/bdk/gen/agent_model/v3_dlp_file_extension_config.py +1 -1
  180. symphony/bdk/gen/agent_model/v3_dlp_file_password_config.py +1 -1
  181. symphony/bdk/gen/agent_model/v3_dlp_file_size_config.py +1 -1
  182. symphony/bdk/gen/agent_model/v3_dlp_policies_collection_response.py +1 -1
  183. symphony/bdk/gen/agent_model/v3_dlp_policy.py +1 -1
  184. symphony/bdk/gen/agent_model/v3_dlp_policy_applies_to.py +1 -1
  185. symphony/bdk/gen/agent_model/v3_dlp_policy_request.py +1 -1
  186. symphony/bdk/gen/agent_model/v3_dlp_policy_response.py +1 -1
  187. symphony/bdk/gen/agent_model/v3_dlp_rule.py +1 -1
  188. symphony/bdk/gen/agent_model/v3_dlp_text_match_config.py +1 -1
  189. symphony/bdk/gen/agent_model/v3_dlp_violation.py +1 -1
  190. symphony/bdk/gen/agent_model/v3_dlp_violation_message.py +1 -1
  191. symphony/bdk/gen/agent_model/v3_dlp_violation_message_response.py +1 -1
  192. symphony/bdk/gen/agent_model/v3_dlp_violation_signal.py +1 -1
  193. symphony/bdk/gen/agent_model/v3_dlp_violation_signal_response.py +1 -1
  194. symphony/bdk/gen/agent_model/v3_dlp_violation_stream.py +1 -1
  195. symphony/bdk/gen/agent_model/v3_dlp_violation_stream_response.py +1 -1
  196. symphony/bdk/gen/agent_model/v3_health.py +1 -1
  197. symphony/bdk/gen/agent_model/v3_health_auth_type.py +1 -1
  198. symphony/bdk/gen/agent_model/v3_health_component.py +1 -1
  199. symphony/bdk/gen/agent_model/v3_health_status.py +1 -1
  200. symphony/bdk/gen/agent_model/v4_attachment_info.py +1 -1
  201. symphony/bdk/gen/agent_model/v4_connection_accepted.py +1 -1
  202. symphony/bdk/gen/agent_model/v4_connection_requested.py +1 -1
  203. symphony/bdk/gen/agent_model/v4_event.py +3 -3
  204. symphony/bdk/gen/agent_model/v4_event_list.py +1 -1
  205. symphony/bdk/gen/agent_model/v4_generic_system_event.py +279 -0
  206. symphony/bdk/gen/agent_model/v4_import_response.py +1 -1
  207. symphony/bdk/gen/agent_model/v4_import_response_list.py +1 -1
  208. symphony/bdk/gen/agent_model/v4_imported_message.py +1 -1
  209. symphony/bdk/gen/agent_model/v4_imported_message_attachment.py +1 -1
  210. symphony/bdk/gen/agent_model/v4_initiator.py +1 -1
  211. symphony/bdk/gen/agent_model/v4_instant_message_created.py +1 -1
  212. symphony/bdk/gen/agent_model/v4_key_value_pair.py +1 -1
  213. symphony/bdk/gen/agent_model/v4_message.py +1 -1
  214. symphony/bdk/gen/agent_model/v4_message_blast_response.py +1 -1
  215. symphony/bdk/gen/agent_model/v4_message_import_list.py +1 -1
  216. symphony/bdk/gen/agent_model/v4_message_list.py +1 -1
  217. symphony/bdk/gen/agent_model/v4_message_sent.py +1 -1
  218. symphony/bdk/gen/agent_model/v4_message_suppressed.py +1 -1
  219. symphony/bdk/gen/agent_model/v4_payload.py +8 -1
  220. symphony/bdk/gen/agent_model/v4_room_created.py +1 -1
  221. symphony/bdk/gen/agent_model/v4_room_deactivated.py +1 -1
  222. symphony/bdk/gen/agent_model/v4_room_member_demoted_from_owner.py +1 -1
  223. symphony/bdk/gen/agent_model/v4_room_member_promoted_to_owner.py +1 -1
  224. symphony/bdk/gen/agent_model/v4_room_properties.py +1 -1
  225. symphony/bdk/gen/agent_model/v4_room_reactivated.py +1 -1
  226. symphony/bdk/gen/agent_model/v4_room_updated.py +1 -1
  227. symphony/bdk/gen/agent_model/v4_shared_post.py +1 -1
  228. symphony/bdk/gen/agent_model/v4_stream.py +6 -1
  229. symphony/bdk/gen/agent_model/v4_symphony_elements_action.py +1 -1
  230. symphony/bdk/gen/agent_model/v4_thumbnail_info.py +1 -1
  231. symphony/bdk/gen/agent_model/v4_user.py +1 -1
  232. symphony/bdk/gen/agent_model/v4_user_joined_room.py +1 -1
  233. symphony/bdk/gen/agent_model/v4_user_left_room.py +1 -1
  234. symphony/bdk/gen/agent_model/v4_user_requested_to_join_room.py +1 -1
  235. symphony/bdk/gen/agent_model/v5_datafeed.py +3 -3
  236. symphony/bdk/gen/agent_model/v5_datafeed_create_body.py +1 -1
  237. symphony/bdk/gen/agent_model/v5_event_list.py +1 -1
  238. symphony/bdk/gen/agent_model/v5_events_read_body.py +5 -5
  239. symphony/bdk/gen/pod_api/app_entitlement_api.py +1 -1
  240. symphony/bdk/gen/pod_api/application_api.py +1 -1
  241. symphony/bdk/gen/pod_api/connection_api.py +1 -1
  242. symphony/bdk/gen/pod_api/default_api.py +1 -1
  243. symphony/bdk/gen/pod_api/disclaimer_api.py +1 -1
  244. symphony/bdk/gen/pod_api/info_barriers_api.py +1 -1
  245. symphony/bdk/gen/pod_api/message_api.py +1 -1
  246. symphony/bdk/gen/pod_api/message_suppression_api.py +1 -1
  247. symphony/bdk/gen/pod_api/pod_api.py +1 -1
  248. symphony/bdk/gen/pod_api/presence_api.py +1 -1
  249. symphony/bdk/gen/pod_api/room_membership_api.py +1 -1
  250. symphony/bdk/gen/pod_api/security_api.py +1 -1
  251. symphony/bdk/gen/pod_api/session_api.py +1 -1
  252. symphony/bdk/gen/pod_api/streams_api.py +162 -1
  253. symphony/bdk/gen/pod_api/system_api.py +1 -1
  254. symphony/bdk/gen/pod_api/user_api.py +264 -2
  255. symphony/bdk/gen/pod_api/users_api.py +421 -1
  256. symphony/bdk/gen/pod_model/admin_justified_action.py +1 -1
  257. symphony/bdk/gen/pod_model/admin_justified_user_action.py +1 -1
  258. symphony/bdk/gen/pod_model/app_authentication_key.py +1 -1
  259. symphony/bdk/gen/pod_model/app_authentication_keys.py +1 -1
  260. symphony/bdk/gen/pod_model/app_notification.py +1 -1
  261. symphony/bdk/gen/pod_model/app_properties.py +1 -1
  262. symphony/bdk/gen/pod_model/app_property.py +1 -1
  263. symphony/bdk/gen/pod_model/application_detail.py +1 -1
  264. symphony/bdk/gen/pod_model/application_info.py +1 -1
  265. symphony/bdk/gen/pod_model/assignee_candidate.py +1 -1
  266. symphony/bdk/gen/pod_model/assignee_candidates.py +1 -1
  267. symphony/bdk/gen/pod_model/attachment_preview.py +1 -1
  268. symphony/bdk/gen/pod_model/avatar.py +1 -1
  269. symphony/bdk/gen/pod_model/avatar_list.py +1 -1
  270. symphony/bdk/gen/pod_model/avatar_update.py +1 -1
  271. symphony/bdk/gen/pod_model/bulk_action_result.py +1 -1
  272. symphony/bdk/gen/pod_model/cert_info.py +1 -1
  273. symphony/bdk/gen/pod_model/cert_info_item.py +1 -1
  274. symphony/bdk/gen/pod_model/company_cert.py +1 -1
  275. symphony/bdk/gen/pod_model/company_cert_attributes.py +1 -1
  276. symphony/bdk/gen/pod_model/company_cert_detail.py +1 -1
  277. symphony/bdk/gen/pod_model/company_cert_info.py +1 -1
  278. symphony/bdk/gen/pod_model/company_cert_info_list.py +1 -1
  279. symphony/bdk/gen/pod_model/company_cert_status.py +1 -1
  280. symphony/bdk/gen/pod_model/company_cert_type.py +1 -1
  281. symphony/bdk/gen/pod_model/company_cert_type_list.py +1 -1
  282. symphony/bdk/gen/pod_model/conversation_specific_stream_attributes.py +1 -1
  283. symphony/bdk/gen/pod_model/delegate_action.py +1 -1
  284. symphony/bdk/gen/pod_model/disclaimer.py +1 -1
  285. symphony/bdk/gen/pod_model/disclaimer_list.py +1 -1
  286. symphony/bdk/gen/pod_model/download_receipt_count.py +1 -1
  287. symphony/bdk/gen/pod_model/error.py +1 -1
  288. symphony/bdk/gen/pod_model/faceted_match_count.py +1 -1
  289. symphony/bdk/gen/pod_model/feature.py +1 -1
  290. symphony/bdk/gen/pod_model/feature_list.py +1 -1
  291. symphony/bdk/gen/pod_model/file_extension.py +6 -1
  292. symphony/bdk/gen/pod_model/file_extensions_response.py +1 -1
  293. symphony/bdk/gen/pod_model/followers_list.py +1 -1
  294. symphony/bdk/gen/pod_model/followers_list_response.py +1 -1
  295. symphony/bdk/gen/pod_model/following_list_response.py +1 -1
  296. symphony/bdk/gen/pod_model/group.py +1 -1
  297. symphony/bdk/gen/pod_model/group_item.py +1 -1
  298. symphony/bdk/gen/pod_model/group_list.py +1 -1
  299. symphony/bdk/gen/pod_model/group_role_scope.py +1 -1
  300. symphony/bdk/gen/pod_model/im_system_info.py +1 -1
  301. symphony/bdk/gen/pod_model/immutable_room_attributes.py +1 -1
  302. symphony/bdk/gen/pod_model/integer_list.py +1 -1
  303. symphony/bdk/gen/pod_model/languages.py +1 -1
  304. symphony/bdk/gen/pod_model/member_info.py +1 -1
  305. symphony/bdk/gen/pod_model/membership_data.py +1 -1
  306. symphony/bdk/gen/pod_model/membership_list.py +1 -1
  307. symphony/bdk/gen/pod_model/message_detail.py +1 -1
  308. symphony/bdk/gen/pod_model/message_details.py +1 -1
  309. symphony/bdk/gen/pod_model/message_download_receipt_count.py +1 -1
  310. symphony/bdk/gen/pod_model/message_ids.py +1 -1
  311. symphony/bdk/gen/pod_model/message_metadata_response.py +1 -1
  312. symphony/bdk/gen/pod_model/message_metadata_response_parent.py +1 -1
  313. symphony/bdk/gen/pod_model/message_receipt_detail.py +1 -1
  314. symphony/bdk/gen/pod_model/message_receipt_detail_response.py +1 -1
  315. symphony/bdk/gen/pod_model/message_status.py +1 -1
  316. symphony/bdk/gen/pod_model/message_status_user.py +1 -1
  317. symphony/bdk/gen/pod_model/message_stream.py +1 -1
  318. symphony/bdk/gen/pod_model/message_suppression_response.py +1 -1
  319. symphony/bdk/gen/pod_model/message_user.py +1 -1
  320. symphony/bdk/gen/pod_model/name_value_pair.py +1 -1
  321. symphony/bdk/gen/pod_model/pagination.py +1 -1
  322. symphony/bdk/gen/pod_model/pagination_cursors.py +1 -1
  323. symphony/bdk/gen/pod_model/password.py +1 -1
  324. symphony/bdk/gen/pod_model/password_reset.py +1 -1
  325. symphony/bdk/gen/pod_model/pod_app_entitlement.py +1 -1
  326. symphony/bdk/gen/pod_model/pod_app_entitlement_list.py +1 -1
  327. symphony/bdk/gen/pod_model/pod_certificate.py +1 -1
  328. symphony/bdk/gen/pod_model/policy.py +1 -1
  329. symphony/bdk/gen/pod_model/policy_list.py +1 -1
  330. symphony/bdk/gen/pod_model/product.py +1 -1
  331. symphony/bdk/gen/pod_model/product_list.py +1 -1
  332. symphony/bdk/gen/pod_model/protocol.py +1 -1
  333. symphony/bdk/gen/pod_model/role.py +1 -1
  334. symphony/bdk/gen/pod_model/role_detail.py +1 -1
  335. symphony/bdk/gen/pod_model/role_detail_list.py +1 -1
  336. symphony/bdk/gen/pod_model/role_list.py +1 -1
  337. symphony/bdk/gen/pod_model/room_attributes.py +1 -1
  338. symphony/bdk/gen/pod_model/room_detail.py +1 -1
  339. symphony/bdk/gen/pod_model/room_search_criteria.py +1 -1
  340. symphony/bdk/gen/pod_model/room_specific_stream_attributes.py +1 -1
  341. symphony/bdk/gen/pod_model/room_system_info.py +1 -1
  342. symphony/bdk/gen/pod_model/room_tag.py +1 -1
  343. symphony/bdk/gen/pod_model/service_account_manifest.py +264 -0
  344. symphony/bdk/gen/pod_model/stream.py +1 -1
  345. symphony/bdk/gen/pod_model/stream_attachment_item.py +1 -1
  346. symphony/bdk/gen/pod_model/stream_attachment_response.py +1 -1
  347. symphony/bdk/gen/pod_model/stream_attributes.py +1 -1
  348. symphony/bdk/gen/pod_model/stream_filter.py +1 -1
  349. symphony/bdk/gen/pod_model/stream_list.py +1 -1
  350. symphony/bdk/gen/pod_model/stream_type.py +1 -1
  351. symphony/bdk/gen/pod_model/string_id.py +1 -1
  352. symphony/bdk/gen/pod_model/string_list.py +1 -1
  353. symphony/bdk/gen/pod_model/success_response.py +1 -1
  354. symphony/bdk/gen/pod_model/user_app_entitlement.py +1 -1
  355. symphony/bdk/gen/pod_model/user_app_entitlement_list.py +1 -1
  356. symphony/bdk/gen/pod_model/user_app_entitlement_patch.py +1 -1
  357. symphony/bdk/gen/pod_model/user_app_entitlement_patch_enum.py +1 -1
  358. symphony/bdk/gen/pod_model/user_app_entitlements_patch_list.py +1 -1
  359. symphony/bdk/gen/pod_model/user_attributes.py +1 -1
  360. symphony/bdk/gen/pod_model/user_compp.py +1 -1
  361. symphony/bdk/gen/pod_model/user_connection.py +1 -1
  362. symphony/bdk/gen/pod_model/user_connection_list.py +1 -1
  363. symphony/bdk/gen/pod_model/user_connection_request.py +1 -1
  364. symphony/bdk/gen/pod_model/user_data.py +1 -1
  365. symphony/bdk/gen/pod_model/user_detail.py +1 -1
  366. symphony/bdk/gen/pod_model/user_detail_list.py +1 -1
  367. symphony/bdk/gen/pod_model/user_error.py +1 -1
  368. symphony/bdk/gen/pod_model/user_filter.py +1 -1
  369. symphony/bdk/gen/pod_model/user_group_assignee.py +1 -1
  370. symphony/bdk/gen/pod_model/user_group_assignee_response.py +1 -1
  371. symphony/bdk/gen/pod_model/user_group_assignee_update.py +1 -1
  372. symphony/bdk/gen/pod_model/user_group_assignment_response.py +1 -1
  373. symphony/bdk/gen/pod_model/user_group_create.py +1 -1
  374. symphony/bdk/gen/pod_model/user_group_data.py +1 -1
  375. symphony/bdk/gen/pod_model/user_group_membership_data.py +1 -1
  376. symphony/bdk/gen/pod_model/user_group_membership_request.py +1 -1
  377. symphony/bdk/gen/pod_model/user_group_membership_response.py +1 -1
  378. symphony/bdk/gen/pod_model/user_group_membership_response_data.py +1 -1
  379. symphony/bdk/gen/pod_model/user_group_membership_update.py +1 -1
  380. symphony/bdk/gen/pod_model/user_group_response.py +1 -1
  381. symphony/bdk/gen/pod_model/user_group_response_list.py +1 -1
  382. symphony/bdk/gen/pod_model/user_group_update.py +1 -1
  383. symphony/bdk/gen/pod_model/user_id.py +1 -1
  384. symphony/bdk/gen/pod_model/user_id_list.py +1 -1
  385. symphony/bdk/gen/pod_model/user_info.py +1 -1
  386. symphony/bdk/gen/pod_model/user_name.py +1 -1
  387. symphony/bdk/gen/pod_model/user_name_list.py +1 -1
  388. symphony/bdk/gen/pod_model/user_search_filter.py +1 -1
  389. symphony/bdk/gen/pod_model/user_search_query.py +1 -1
  390. symphony/bdk/gen/pod_model/user_search_results.py +1 -1
  391. symphony/bdk/gen/pod_model/user_status.py +1 -1
  392. symphony/bdk/gen/pod_model/user_suspension.py +1 -1
  393. symphony/bdk/gen/pod_model/user_system_info.py +1 -1
  394. symphony/bdk/gen/pod_model/user_v2.py +1 -1
  395. symphony/bdk/gen/pod_model/v1_im_attributes.py +1 -1
  396. symphony/bdk/gen/pod_model/v1_im_detail.py +1 -1
  397. symphony/bdk/gen/pod_model/v1_session.py +301 -0
  398. symphony/bdk/gen/pod_model/v1_user_sessions.py +259 -0
  399. symphony/bdk/gen/pod_model/v2_admin_stream_attributes.py +6 -1
  400. symphony/bdk/gen/pod_model/v2_admin_stream_filter.py +1 -1
  401. symphony/bdk/gen/pod_model/v2_admin_stream_info.py +1 -1
  402. symphony/bdk/gen/pod_model/v2_admin_stream_info_list.py +1 -1
  403. symphony/bdk/gen/pod_model/v2_admin_stream_list.py +1 -1
  404. symphony/bdk/gen/pod_model/v2_admin_stream_type.py +1 -1
  405. symphony/bdk/gen/pod_model/v2_conversation_specific_stream_attributes.py +1 -1
  406. symphony/bdk/gen/pod_model/v2_member_info.py +1 -1
  407. symphony/bdk/gen/pod_model/v2_member_info_list.py +1 -1
  408. symphony/bdk/gen/pod_model/v2_member_user_detail.py +1 -1
  409. symphony/bdk/gen/pod_model/v2_membership_list.py +1 -1
  410. symphony/bdk/gen/pod_model/v2_presence.py +1 -1
  411. symphony/bdk/gen/pod_model/v2_presence_all_of.py +1 -1
  412. symphony/bdk/gen/pod_model/v2_presence_list.py +1 -1
  413. symphony/bdk/gen/pod_model/v2_presence_status.py +1 -1
  414. symphony/bdk/gen/pod_model/v2_room_search_criteria.py +1 -1
  415. symphony/bdk/gen/pod_model/v2_room_search_criteria_all_of.py +1 -1
  416. symphony/bdk/gen/pod_model/v2_room_specific_stream_attributes.py +1 -1
  417. symphony/bdk/gen/pod_model/v2_stream_attributes.py +1 -1
  418. symphony/bdk/gen/pod_model/v2_stream_type.py +1 -1
  419. symphony/bdk/gen/pod_model/v2_user_attributes.py +1 -1
  420. symphony/bdk/gen/pod_model/v2_user_create.py +1 -1
  421. symphony/bdk/gen/pod_model/v2_user_detail.py +1 -1
  422. symphony/bdk/gen/pod_model/v2_user_detail_list.py +1 -1
  423. symphony/bdk/gen/pod_model/v2_user_key_request.py +1 -1
  424. symphony/bdk/gen/pod_model/v2_user_list.py +1 -1
  425. symphony/bdk/gen/pod_model/v2_user_presence.py +1 -1
  426. symphony/bdk/gen/pod_model/v2_user_presence_all_of.py +1 -1
  427. symphony/bdk/gen/pod_model/v3_room_attributes.py +6 -1
  428. symphony/bdk/gen/pod_model/v3_room_detail.py +1 -1
  429. symphony/bdk/gen/pod_model/v3_room_search_results.py +1 -1
  430. {symphony_bdk_python-2.10.dev0.dist-info → symphony_bdk_python-2.11.0.dist-info}/METADATA +19 -5
  431. symphony_bdk_python-2.11.0.dist-info/RECORD +546 -0
  432. symphony_bdk_python-2.10.dev0.dist-info/RECORD +0 -538
  433. {symphony_bdk_python-2.10.dev0.dist-info → symphony_bdk_python-2.11.0.dist-info}/LICENSE +0 -0
  434. {symphony_bdk_python-2.10.dev0.dist-info → symphony_bdk_python-2.11.0.dist-info}/NOTICE +0 -0
  435. {symphony_bdk_python-2.10.dev0.dist-info → symphony_bdk_python-2.11.0.dist-info}/WHEEL +0 -0
@@ -1,27 +1,30 @@
1
- """Module containing extension app authenticator classes.
2
- """
1
+ """Module containing extension app authenticator classes."""
2
+
3
3
  from abc import ABC, abstractmethod
4
4
 
5
5
  from symphony.bdk.core.auth.auth_session import AppAuthSession
6
- from symphony.bdk.core.auth.jwt_helper import validate_jwt, create_signed_jwt
7
- from symphony.bdk.core.auth.tokens_repository import TokensRepository, InMemoryTokensRepository
6
+ from symphony.bdk.core.auth.jwt_helper import create_signed_jwt, validate_jwt
7
+ from symphony.bdk.core.auth.tokens_repository import InMemoryTokensRepository, TokensRepository
8
8
  from symphony.bdk.core.config.model.bdk_retry_config import BdkRetryConfig
9
9
  from symphony.bdk.core.config.model.bdk_rsa_key_config import BdkRsaKeyConfig
10
10
  from symphony.bdk.core.retry import retry
11
11
  from symphony.bdk.core.retry.strategy import authentication_retry
12
12
  from symphony.bdk.gen.auth_api.certificate_authentication_api import CertificateAuthenticationApi
13
13
  from symphony.bdk.gen.auth_api.certificate_pod_api import CertificatePodApi
14
- from symphony.bdk.gen.auth_model.extension_app_authenticate_request import ExtensionAppAuthenticateRequest
14
+ from symphony.bdk.gen.auth_model.extension_app_authenticate_request import (
15
+ ExtensionAppAuthenticateRequest,
16
+ )
15
17
  from symphony.bdk.gen.login_api.authentication_api import AuthenticationApi
16
- from symphony.bdk.gen.login_model.authenticate_extension_app_request import AuthenticateExtensionAppRequest
18
+ from symphony.bdk.gen.login_model.authenticate_extension_app_request import (
19
+ AuthenticateExtensionAppRequest,
20
+ )
17
21
  from symphony.bdk.gen.login_model.extension_app_tokens import ExtensionAppTokens
18
22
  from symphony.bdk.gen.pod_api.pod_api import PodApi
19
23
  from symphony.bdk.gen.pod_model.pod_certificate import PodCertificate
20
24
 
21
25
 
22
26
  class ExtensionAppAuthenticator(ABC):
23
- """Base abstract class to handle extension app authentication.
24
- """
27
+ """Base abstract class to handle extension app authentication."""
25
28
 
26
29
  def __init__(self, app_id: str, tokens_repository: TokensRepository = None):
27
30
  """
@@ -93,16 +96,17 @@ class ExtensionAppAuthenticator(ABC):
93
96
 
94
97
 
95
98
  class ExtensionAppAuthenticatorRsa(ExtensionAppAuthenticator):
96
- """A subclass of :class:`ExtensionAppAuthenticator` specific to extension app RSA authentication.
97
- """
98
-
99
- def __init__(self,
100
- authentication_api: AuthenticationApi,
101
- pod_api: PodApi,
102
- app_id: str,
103
- private_key_config: BdkRsaKeyConfig,
104
- retry_config: BdkRetryConfig,
105
- tokens_repository: TokensRepository = None):
99
+ """A subclass of :class:`ExtensionAppAuthenticator` specific to extension app RSA authentication."""
100
+
101
+ def __init__(
102
+ self,
103
+ authentication_api: AuthenticationApi,
104
+ pod_api: PodApi,
105
+ app_id: str,
106
+ private_key_config: BdkRsaKeyConfig,
107
+ retry_config: BdkRetryConfig,
108
+ tokens_repository: TokensRepository = None,
109
+ ):
106
110
  """
107
111
 
108
112
  :param authentication_api: the AuthenticationApi instance
@@ -122,9 +126,13 @@ class ExtensionAppAuthenticatorRsa(ExtensionAppAuthenticator):
122
126
  @retry(retry=authentication_retry)
123
127
  async def _retrieve_tokens(self, app_token: str) -> ExtensionAppTokens:
124
128
  jwt = create_signed_jwt(self._private_key_config, self._app_id)
125
- authentication_request = AuthenticateExtensionAppRequest(app_token=app_token, auth_token=jwt)
129
+ authentication_request = AuthenticateExtensionAppRequest(
130
+ app_token=app_token, auth_token=jwt
131
+ )
126
132
 
127
- return await self._authentication_api.v1_pubkey_app_authenticate_extension_app_post(authentication_request)
133
+ return await self._authentication_api.v1_pubkey_app_authenticate_extension_app_post(
134
+ authentication_request
135
+ )
128
136
 
129
137
  @retry(retry=authentication_retry)
130
138
  async def _get_pod_certificate(self) -> PodCertificate:
@@ -132,15 +140,16 @@ class ExtensionAppAuthenticatorRsa(ExtensionAppAuthenticator):
132
140
 
133
141
 
134
142
  class ExtensionAppAuthenticatorCert(ExtensionAppAuthenticator):
135
- """A subclass of :class:`ExtensionAppAuthenticator` specific to extension app certificate authentication.
136
- """
137
-
138
- def __init__(self,
139
- certificate_authentication_api: CertificateAuthenticationApi,
140
- certificate_pod_api: CertificatePodApi,
141
- app_id: str,
142
- retry_config: BdkRetryConfig,
143
- tokens_repository: TokensRepository = None):
143
+ """A subclass of :class:`ExtensionAppAuthenticator` specific to extension app certificate authentication."""
144
+
145
+ def __init__(
146
+ self,
147
+ certificate_authentication_api: CertificateAuthenticationApi,
148
+ certificate_pod_api: CertificatePodApi,
149
+ app_id: str,
150
+ retry_config: BdkRetryConfig,
151
+ tokens_repository: TokensRepository = None,
152
+ ):
144
153
  """
145
154
 
146
155
  :param certificate_authentication_api: the CertificateAuthenticationApi instance
@@ -159,7 +168,8 @@ class ExtensionAppAuthenticatorCert(ExtensionAppAuthenticator):
159
168
  async def _retrieve_tokens(self, app_token: str) -> ExtensionAppTokens:
160
169
  authentication_request = ExtensionAppAuthenticateRequest(app_token=app_token)
161
170
  return await self._certificate_authentication_api.v1_authenticate_extension_app_post(
162
- auth_request=authentication_request)
171
+ auth_request=authentication_request
172
+ )
163
173
 
164
174
  @retry(retry=authentication_retry)
165
175
  async def _get_pod_certificate(self) -> PodCertificate:
@@ -1,10 +1,10 @@
1
- """Module to help with jwt handling.
2
- """
1
+ """Module to help with jwt handling."""
2
+
3
3
  import datetime
4
4
 
5
- from jwt import PyJWT, DecodeError, ExpiredSignatureError
6
5
  from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
7
6
  from cryptography.x509 import load_pem_x509_certificate
7
+ from jwt import DecodeError, ExpiredSignatureError, PyJWT
8
8
 
9
9
  from symphony.bdk.core.auth.exception import AuthInitializationError
10
10
  from symphony.bdk.core.config.model.bdk_rsa_key_config import BdkRsaKeyConfig
@@ -15,7 +15,10 @@ DEFAULT_EXPIRATION_SECONDS = (5 * 50) - 10
15
15
 
16
16
  jwt = PyJWT({"verify_sub": False})
17
17
 
18
- def create_signed_jwt(private_key_config: BdkRsaKeyConfig, username: str, expiration: int = None) -> str:
18
+
19
+ def create_signed_jwt(
20
+ private_key_config: BdkRsaKeyConfig, username: str, expiration: int = None
21
+ ) -> str:
19
22
  """Creates a JWT with the provided user name and expiration date, signed with the provided private key.
20
23
 
21
24
  :param private_key_config: The private key configuration for a service account or an extension app.
@@ -26,12 +29,14 @@ def create_signed_jwt(private_key_config: BdkRsaKeyConfig, username: str, expira
26
29
 
27
30
  :return: a signed JWT for a specific user or an extension app.
28
31
  """
29
- expiration = expiration if expiration is not None else int(
30
- datetime.datetime.now(datetime.timezone.utc).timestamp() + DEFAULT_EXPIRATION_SECONDS)
31
- payload = {
32
- "sub": username,
33
- "exp": expiration
34
- }
32
+ expiration = (
33
+ expiration
34
+ if expiration is not None
35
+ else int(
36
+ datetime.datetime.now(datetime.timezone.utc).timestamp() + DEFAULT_EXPIRATION_SECONDS
37
+ )
38
+ )
39
+ payload = {"sub": username, "exp": expiration}
35
40
  return create_signed_jwt_with_claims(private_key_config.get_private_key_content(), payload)
36
41
 
37
42
 
@@ -56,8 +61,12 @@ def validate_jwt(jwt_token: str, certificate: str, allowed_audience: str) -> dic
56
61
  :raise AuthInitializationError: If the certificate or jwt are invalid.
57
62
  """
58
63
  try:
59
- return jwt.decode(jwt_token, _parse_public_key_from_x509_cert(certificate),
60
- algorithms=[JWT_ENCRYPTION_ALGORITHM], audience=allowed_audience)
64
+ return jwt.decode(
65
+ jwt_token,
66
+ _parse_public_key_from_x509_cert(certificate),
67
+ algorithms=[JWT_ENCRYPTION_ALGORITHM],
68
+ audience=allowed_audience,
69
+ )
61
70
  except (DecodeError, ExpiredSignatureError) as exc:
62
71
  raise AuthInitializationError("Unable to validate the jwt") from exc
63
72
 
@@ -67,8 +76,7 @@ def generate_expiration_time() -> int:
67
76
  :return: timestamp value
68
77
  """
69
78
  return int(
70
- datetime.datetime.now(datetime.timezone.utc).timestamp()
71
- + DEFAULT_EXPIRATION_SECONDS
79
+ datetime.datetime.now(datetime.timezone.utc).timestamp() + DEFAULT_EXPIRATION_SECONDS
72
80
  )
73
81
 
74
82
 
@@ -82,4 +90,17 @@ def _parse_public_key_from_x509_cert(certificate: str) -> str:
82
90
  public_key = load_pem_x509_certificate(certificate.encode()).public_key()
83
91
  return public_key.public_bytes(Encoding.PEM, PublicFormat.SubjectPublicKeyInfo).decode()
84
92
  except ValueError as exc:
85
- raise AuthInitializationError("Unable to parse the certificate. Check certificate format.") from exc
93
+ raise AuthInitializationError(
94
+ "Unable to parse the certificate. Check certificate format."
95
+ ) from exc
96
+
97
+
98
+ def extract_token_claims(session_token):
99
+ try:
100
+ return jwt.decode(
101
+ session_token,
102
+ algorithms=[JWT_ENCRYPTION_ALGORITHM],
103
+ options={"verify_signature": False},
104
+ )
105
+ except DecodeError:
106
+ return {}
@@ -1,5 +1,5 @@
1
- """Module containing OBO authenticator classes.
2
- """
1
+ """Module containing OBO authenticator classes."""
2
+
3
3
  from abc import ABC, abstractmethod
4
4
 
5
5
  from symphony.bdk.core.auth.auth_session import OboAuthSession
@@ -14,11 +14,9 @@ from symphony.bdk.gen.login_model.authenticate_request import AuthenticateReques
14
14
 
15
15
 
16
16
  class OboAuthenticator(ABC):
17
- """Obo authentication service.
18
- """
17
+ """Obo authentication service."""
19
18
 
20
- unauthorized_message = \
21
- "Extension Application is not authorized to authenticate in OBO mode. Check if credentials are valid."
19
+ unauthorized_message = "Extension Application is not authorized to authenticate in OBO mode. Check if credentials are valid."
22
20
 
23
21
  @abstractmethod
24
22
  async def retrieve_obo_session_token_by_user_id(self, user_id: int) -> str:
@@ -56,10 +54,14 @@ class OboAuthenticator(ABC):
56
54
 
57
55
 
58
56
  class OboAuthenticatorRsa(OboAuthenticator):
59
- """Obo authenticator RSA implementation.
60
- """
61
-
62
- def __init__(self, app_config: BdkAppConfig, authentication_api: AuthenticationApi, retry_config: BdkRetryConfig):
57
+ """Obo authenticator RSA implementation."""
58
+
59
+ def __init__(
60
+ self,
61
+ app_config: BdkAppConfig,
62
+ authentication_api: AuthenticationApi,
63
+ retry_config: BdkRetryConfig,
64
+ ):
63
65
  self._app_config = app_config
64
66
  self._authentication_api = authentication_api
65
67
  self._retry_config = retry_config
@@ -95,21 +97,26 @@ class OboAuthenticatorRsa(OboAuthenticator):
95
97
  @retry(retry=authentication_retry)
96
98
  async def _authenticate_by_user_id(self, app_session_token, user_id) -> str:
97
99
  token = await self._authentication_api.pubkey_app_user_user_id_authenticate_post(
98
- session_token=app_session_token, user_id=user_id)
100
+ session_token=app_session_token, user_id=user_id
101
+ )
99
102
  return token.token
100
103
 
101
104
  @retry(retry=authentication_retry)
102
105
  async def _authenticate_by_username(self, app_session_token, username) -> str:
103
106
  token = await self._authentication_api.pubkey_app_username_username_authenticate_post(
104
- session_token=app_session_token, username=username)
107
+ session_token=app_session_token, username=username
108
+ )
105
109
  return token.token
106
110
 
107
111
 
108
112
  class OboAuthenticatorCert(OboAuthenticator):
109
- """Obo authenticator Certificate implementation.
110
- """
113
+ """Obo authenticator Certificate implementation."""
111
114
 
112
- def __init__(self, certificate_authenticator_api: CertificateAuthenticationApi, retry_config: BdkRetryConfig):
115
+ def __init__(
116
+ self,
117
+ certificate_authenticator_api: CertificateAuthenticationApi,
118
+ retry_config: BdkRetryConfig,
119
+ ):
113
120
  self._authentication_api = certificate_authenticator_api
114
121
  self._retry_config = retry_config
115
122
 
@@ -122,8 +129,9 @@ class OboAuthenticatorCert(OboAuthenticator):
122
129
  :raise AuthUnauthorizedError: if session token cannot be retrieved
123
130
  """
124
131
  app_session_token = await self._retrieve_app_session_token()
125
- obo_auth = await self._authentication_api.v1_app_user_uid_authenticate_post(session_token=app_session_token,
126
- uid=user_id)
132
+ obo_auth = await self._authentication_api.v1_app_user_uid_authenticate_post(
133
+ session_token=app_session_token, uid=user_id
134
+ )
127
135
  return obo_auth.session_token
128
136
 
129
137
  @retry(retry=authentication_retry)
@@ -136,7 +144,8 @@ class OboAuthenticatorCert(OboAuthenticator):
136
144
  """
137
145
  app_session_token = await self._retrieve_app_session_token()
138
146
  obo_auth = await self._authentication_api.v1_app_username_username_authenticate_post(
139
- session_token=app_session_token, username=username)
147
+ session_token=app_session_token, username=username
148
+ )
140
149
  return obo_auth.session_token
141
150
 
142
151
  @retry(retry=authentication_retry)
@@ -1,11 +1,10 @@
1
- """Module which handles the storage of valid extension app tokens.
2
- """
1
+ """Module which handles the storage of valid extension app tokens."""
2
+
3
3
  from abc import ABC, abstractmethod
4
4
 
5
5
 
6
6
  class TokensRepository(ABC):
7
- """Base abstract class to store and retrieve extension app tokens.
8
- """
7
+ """Base abstract class to store and retrieve extension app tokens."""
9
8
 
10
9
  @abstractmethod
11
10
  async def save(self, app_token: str, symphony_token: str) -> None:
@@ -26,8 +25,8 @@ class TokensRepository(ABC):
26
25
 
27
26
 
28
27
  class InMemoryTokensRepository(TokensRepository):
29
- """Class implementing an in-memory TokensRepository.
30
- """
28
+ """Class implementing an in-memory TokensRepository."""
29
+
31
30
  def __init__(self):
32
31
  self._tokens = {}
33
32
 
@@ -1,5 +1,5 @@
1
- """Package for instantiating internal API clients
2
- """
1
+ """Package for instantiating internal API clients"""
2
+
3
3
  from symphony.bdk.core.client.trace_id import setup_trace_id_log_record_factory
4
4
 
5
5
  setup_trace_id_log_record_factory()
@@ -1,14 +1,14 @@
1
- """Module containing the ApiClientFactory class.
2
- """
1
+ """Module containing the ApiClientFactory class."""
2
+
3
3
  import logging
4
4
  import sys
5
- from importlib.metadata import distribution, PackageNotFoundError
5
+ from importlib.metadata import PackageNotFoundError, distribution
6
6
  from ssl import SSLError
7
7
 
8
8
  import urllib3
9
9
  from aiohttp.hdrs import USER_AGENT
10
10
 
11
- from symphony.bdk.core.client.trace_id import add_x_trace_id, X_TRACE_ID
11
+ from symphony.bdk.core.client.trace_id import X_TRACE_ID, add_x_trace_id
12
12
  from symphony.bdk.gen.api_client import ApiClient
13
13
  from symphony.bdk.gen.configuration import Configuration
14
14
 
@@ -23,8 +23,7 @@ logger = logging.getLogger(__name__)
23
23
 
24
24
 
25
25
  class ApiClientFactory:
26
- """Factory responsible for creating ApiClient instances for each main Symphony's components.
27
- """
26
+ """Factory responsible for creating ApiClient instances for each main Symphony's components."""
28
27
 
29
28
  def __init__(self, config):
30
29
  self._config = config
@@ -32,12 +31,15 @@ class ApiClientFactory:
32
31
  self._pod_client = self._get_api_client(self._config.pod, POD)
33
32
  self._relay_client = self._get_api_client(self._config.key_manager, RELAY)
34
33
  self._agent_client = self._get_api_client(self._config.agent, AGENT)
35
- self._session_auth_client = self._get_api_client_with_client_cert(self._config.session_auth, SESSION_AUTH,
36
- self._config.bot.certificate.path)
37
- self._key_auth_client = self._get_api_client_with_client_cert(self._config.key_manager, KEY_AUTH,
38
- self._config.bot.certificate.path)
39
- self._app_session_auth_client = self._get_api_client_with_client_cert(self._config.session_auth, SESSION_AUTH,
40
- self._config.app.certificate.path)
34
+ self._session_auth_client = self._get_api_client_with_client_cert(
35
+ self._config.session_auth, SESSION_AUTH, self._config.bot.certificate.path
36
+ )
37
+ self._key_auth_client = self._get_api_client_with_client_cert(
38
+ self._config.key_manager, KEY_AUTH, self._config.bot.certificate.path
39
+ )
40
+ self._app_session_auth_client = self._get_api_client_with_client_cert(
41
+ self._config.session_auth, SESSION_AUTH, self._config.app.certificate.path
42
+ )
41
43
  self._custom_clients = []
42
44
 
43
45
  def get_login_client(self) -> ApiClient:
@@ -117,14 +119,18 @@ class ApiClientFactory:
117
119
  configuration = self._get_client_config(context, server_config)
118
120
  return ApiClientFactory._get_api_client_from_config(configuration, server_config)
119
121
 
120
- def _get_api_client_with_client_cert(self, server_config, context, certificate_path) -> ApiClient:
122
+ def _get_api_client_with_client_cert(
123
+ self, server_config, context, certificate_path
124
+ ) -> ApiClient:
121
125
  configuration = self._get_client_config(context, server_config)
122
126
  configuration.cert_file = certificate_path
123
127
 
124
128
  return ApiClientFactory._get_api_client_from_config(configuration, server_config)
125
129
 
126
130
  def _get_client_config(self, context, server_config):
127
- configuration = Configuration(host=(server_config.get_base_path() + context), discard_unknown_keys=True)
131
+ configuration = Configuration(
132
+ host=(server_config.get_base_path() + context), discard_unknown_keys=True
133
+ )
128
134
  configuration.verify_ssl = True
129
135
  configuration.ssl_ca_cert = self._config.ssl.trust_store_path
130
136
  if server_config.proxy is not None:
@@ -138,7 +144,9 @@ class ApiClientFactory:
138
144
  ApiClientFactory._add_headers(client, server_config)
139
145
  return client
140
146
  except SSLError as exc:
141
- logger.exception("SSL error when instantiating clients, please check certificates are valid")
147
+ logger.exception(
148
+ "SSL error when instantiating clients, please check certificates are valid"
149
+ )
142
150
  raise exc
143
151
 
144
152
  @staticmethod
@@ -149,7 +157,9 @@ class ApiClientFactory:
149
157
  client.set_default_header(header_name, header_value)
150
158
  client.user_agent = ApiClientFactory._user_agent(server_config)
151
159
 
152
- if X_TRACE_ID.lower() not in (header_name.lower() for header_name in default_headers.keys()):
160
+ if X_TRACE_ID.lower() not in (
161
+ header_name.lower() for header_name in default_headers.keys()
162
+ ):
153
163
  client._ApiClient__call_api = add_x_trace_id(client._ApiClient__call_api)
154
164
 
155
165
  @staticmethod
@@ -159,23 +169,31 @@ class ApiClientFactory:
159
169
 
160
170
  configuration.proxy = proxy_config.get_url()
161
171
  if proxy_config.are_credentials_defined():
162
- configuration.proxy_headers = urllib3.util.make_headers(proxy_basic_auth=proxy_config.get_credentials(),
163
- user_agent=user_agent)
172
+ configuration.proxy_headers = urllib3.util.make_headers(
173
+ proxy_basic_auth=proxy_config.get_credentials(), user_agent=user_agent
174
+ )
164
175
  else:
165
176
  configuration.proxy_headers = urllib3.util.make_headers(user_agent=user_agent)
166
177
 
167
178
  @staticmethod
168
179
  def _sanitized_default_headers(server_config):
169
- default_headers = server_config.default_headers if server_config.default_headers is not None else {}
180
+ default_headers = (
181
+ server_config.default_headers if server_config.default_headers is not None else {}
182
+ )
170
183
 
171
184
  # we do this because we want to handle user-agent header separately
172
185
  # for client configuration and proxy header
173
- return {header_key: default_headers[header_key] for header_key in default_headers
174
- if header_key.lower() != USER_AGENT.lower()}
186
+ return {
187
+ header_key: default_headers[header_key]
188
+ for header_key in default_headers
189
+ if header_key.lower() != USER_AGENT.lower()
190
+ }
175
191
 
176
192
  @staticmethod
177
193
  def _user_agent(server_config):
178
- default_headers = server_config.default_headers if server_config.default_headers is not None else {}
194
+ default_headers = (
195
+ server_config.default_headers if server_config.default_headers is not None else {}
196
+ )
179
197
 
180
198
  for header_key, header_value in default_headers.items():
181
199
  if header_key.lower() == USER_AGENT.lower():
@@ -1,5 +1,5 @@
1
- """Module responsible for managing the trace ID sent as X-Trace-Id header and logged under the `trace_id` variable
2
- """
1
+ """Module responsible for managing the trace ID sent as X-Trace-Id header and logged under the `trace_id` variable"""
2
+
3
3
  import logging
4
4
  import random
5
5
  import string
@@ -49,8 +49,7 @@ def add_x_trace_id(func):
49
49
 
50
50
 
51
51
  class DistributedTracingContext:
52
- """Class to manage the tracing id context.
53
- """
52
+ """Class to manage the tracing id context."""
54
53
 
55
54
  _trace_id_context = ContextVar("_trace_id_context")
56
55
  _is_trace_id_set_by_user = False
@@ -1,2 +1 @@
1
- """Package containing configuration-related modules
2
- """
1
+ """Package containing configuration-related modules"""
@@ -1,10 +1,8 @@
1
- """Module containing all configuration related exception.
2
- """
1
+ """Module containing all configuration related exception."""
3
2
 
4
3
 
5
4
  class BdkConfigError(Exception):
6
- """Exception class raised when configuration is invalid.
7
- """
5
+ """Exception class raised when configuration is invalid."""
8
6
 
9
7
 
10
8
  class BotNotConfiguredError(Exception):
@@ -8,7 +8,7 @@ from symphony.bdk.core.config.model.bdk_config import BdkConfig
8
8
 
9
9
 
10
10
  class BdkConfigLoader:
11
- """ Config loader class
11
+ """Config loader class
12
12
 
13
13
  Provide methods to load a JSON or YAML configuration
14
14
  from an absolute path or `$HOME/.symphony``
@@ -54,7 +54,7 @@ class BdkConfigLoader:
54
54
 
55
55
 
56
56
  class BdkConfigParser:
57
- """ Config Parser class
57
+ """Config Parser class
58
58
 
59
59
  Provide methods to Deserialize a configuration content
60
60
  as a ``str`` in a JSON or YAML format to a BdkConfig object.
@@ -2,12 +2,14 @@ from symphony.bdk.core.config.model.bdk_authentication_config import BdkAuthenti
2
2
 
3
3
 
4
4
  class BdkAppConfig(BdkAuthenticationConfig):
5
- """Class containing the extension app configuration
6
- """
5
+ """Class containing the extension app configuration"""
7
6
 
8
7
  def __init__(self, config):
9
8
  if config is not None:
10
9
  self.app_id = config.get("appId")
11
- super().__init__(private_key_config=config.get("privateKey"), certificate_config=config.get("certificate"))
10
+ super().__init__(
11
+ private_key_config=config.get("privateKey"),
12
+ certificate_config=config.get("certificate"),
13
+ )
12
14
  else:
13
15
  super().__init__()
@@ -1,7 +1,7 @@
1
- """Module handling authentication part of the configuration.
2
- """
3
- from symphony.bdk.core.config.model.bdk_rsa_key_config import BdkRsaKeyConfig
1
+ """Module handling authentication part of the configuration."""
2
+
4
3
  from symphony.bdk.core.config.model.bdk_certificate_config import BdkCertificateConfig
4
+ from symphony.bdk.core.config.model.bdk_rsa_key_config import BdkRsaKeyConfig
5
5
 
6
6
 
7
7
  class BdkAuthenticationConfig:
@@ -11,10 +11,16 @@ class BdkAuthenticationConfig:
11
11
  """
12
12
 
13
13
  def __init__(self, private_key_config=None, certificate_config=None):
14
- self.private_key = BdkRsaKeyConfig(
15
- **private_key_config) if private_key_config is not None else BdkRsaKeyConfig()
16
- self.certificate = BdkCertificateConfig(
17
- **certificate_config) if certificate_config is not None else BdkCertificateConfig()
14
+ self.private_key = (
15
+ BdkRsaKeyConfig(**private_key_config)
16
+ if private_key_config is not None
17
+ else BdkRsaKeyConfig()
18
+ )
19
+ self.certificate = (
20
+ BdkCertificateConfig(**certificate_config)
21
+ if certificate_config is not None
22
+ else BdkCertificateConfig()
23
+ )
18
24
 
19
25
  def is_authentication_configured(self) -> bool:
20
26
  """Check if either RSA or certificate authentication is configured
@@ -2,11 +2,14 @@ from symphony.bdk.core.config.model.bdk_authentication_config import BdkAuthenti
2
2
 
3
3
 
4
4
  class BdkBotConfig(BdkAuthenticationConfig):
5
- """Class containing the bot configuration
6
- """
5
+ """Class containing the bot configuration"""
6
+
7
7
  def __init__(self, config):
8
8
  if config is not None:
9
9
  self.username = config.get("username")
10
- super().__init__(private_key_config=config.get("privateKey"), certificate_config=config.get("certificate"))
10
+ super().__init__(
11
+ private_key_config=config.get("privateKey"),
12
+ certificate_config=config.get("certificate"),
13
+ )
11
14
  else:
12
15
  super().__init__()
@@ -1,4 +1,4 @@
1
- from symphony.bdk.core.config.model.bdk_server_config import BdkServerConfig, BdkProxyConfig
1
+ from symphony.bdk.core.config.model.bdk_server_config import BdkProxyConfig, BdkServerConfig
2
2
 
3
3
 
4
4
  class BdkClientConfig(BdkServerConfig):
@@ -1,25 +1,29 @@
1
1
  from symphony.bdk.core.config.model.bdk_app_config import BdkAppConfig
2
2
  from symphony.bdk.core.config.model.bdk_bot_config import BdkBotConfig
3
3
  from symphony.bdk.core.config.model.bdk_client_config import BdkClientConfig
4
+ from symphony.bdk.core.config.model.bdk_datafeed_config import BdkDatafeedConfig
5
+ from symphony.bdk.core.config.model.bdk_datahose_config import BdkDatahoseConfig
4
6
  from symphony.bdk.core.config.model.bdk_retry_config import BdkRetryConfig
5
7
  from symphony.bdk.core.config.model.bdk_server_config import BdkServerConfig
6
8
  from symphony.bdk.core.config.model.bdk_ssl_config import BdkSslConfig
7
- from symphony.bdk.core.config.model.bdk_datafeed_config import BdkDatafeedConfig
8
- from symphony.bdk.core.config.model.bdk_datahose_config import BdkDatahoseConfig
9
9
 
10
10
 
11
11
  class BdkConfig(BdkServerConfig):
12
- """Class containing the whole BDK configuration.
13
- """
12
+ """Class containing the whole BDK configuration."""
14
13
 
15
14
  def __init__(self, **config):
16
15
  """
17
16
 
18
17
  :param config: the dict containing the server configuration parameters.
19
18
  """
20
- super().__init__(scheme=config.get("scheme"), host=config.get("host"), port=config.get("port"),
21
- context=config.get("context"), proxy=config.get("proxy"),
22
- default_headers=config.get("defaultHeaders"))
19
+ super().__init__(
20
+ scheme=config.get("scheme"),
21
+ host=config.get("host"),
22
+ port=config.get("port"),
23
+ context=config.get("context"),
24
+ proxy=config.get("proxy"),
25
+ default_headers=config.get("defaultHeaders"),
26
+ )
23
27
  self.agent = BdkClientConfig(self, config.get("agent"))
24
28
  self.pod = BdkClientConfig(self, config.get("pod"))
25
29
  self.key_manager = BdkClientConfig(self, config.get("keyManager"))
@@ -30,6 +34,7 @@ class BdkConfig(BdkServerConfig):
30
34
  self.datafeed = BdkDatafeedConfig(config.get("datafeed"))
31
35
  self.datahose = BdkDatahoseConfig(config.get("datahose"))
32
36
  self.retry = BdkRetryConfig(config.get("retry"))
37
+ self.manifest = config.get("manifest")
33
38
 
34
39
  def is_bot_configured(self) -> bool:
35
40
  """