From 4afd22dbfa75deb912d6ee7ebb6fc134d372d612 Mon Sep 17 00:00:00 2001 From: Kenny Kwan Date: Fri, 1 Jun 2018 09:34:38 -0400 Subject: [PATCH] For SG-6337 - Add validation for username/password when Oxygen is enabled --- shotgun_api3/shotgun.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/shotgun_api3/shotgun.py b/shotgun_api3/shotgun.py index a3e8c1d2..b600f059 100755 --- a/shotgun_api3/shotgun.py +++ b/shotgun_api3/shotgun.py @@ -135,6 +135,13 @@ class UserCredentialsNotAllowedForSSOAuthenticationFault(Fault): """ pass +class UserCredentialsNotAllowedForOxygenAuthenticationFault(Fault): + """ + Exception when the server is configured to use Oxygen. It is not possible to use + a username/password pair to authenticate on such server. + """ + pass + # ---------------------------------------------------------------------------- # API @@ -3384,6 +3391,7 @@ def _response_errors(self, sg_response): ERR_AUTH = 102 # error code for authentication related problems ERR_2FA = 106 # error code when 2FA authentication is required but no 2FA token provided. ERR_SSO = 108 # error code when SSO is activated on the site, preventing the use of username/password for authentication. + ERR_OXYG = 110 # error code when Oxygen is activated on the site, preventing the use of username/password for authentication. if isinstance(sg_response, dict) and sg_response.get("exception"): if sg_response.get("error_code") == ERR_AUTH: @@ -3394,6 +3402,10 @@ def _response_errors(self, sg_response): raise UserCredentialsNotAllowedForSSOAuthenticationFault( sg_response.get("message", "Authentication using username/password is not allowed for an SSO-enabled Shotgun site") ) + elif sg_response.get("error_code") == ERR_OXYG: + raise UserCredentialsNotAllowedForOxygenAuthenticationFault( + sg_response.get("message", "Authentication using username/password is not allowed for an Autodesk Identity enabled Shotgun site") + ) else: # raise general Fault raise Fault(sg_response.get("message", "Unknown Error"))