def _add_auth(self):
if not self.auth:<EOL><INDENT>return<EOL><DEDENT>if self.auth and not self.definition_body:<EOL><INDENT>raise InvalidResourceException(self.logical_id,<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if not all(key in AuthProperties._fields for key in self.auth.keys()):<EOL><INDENT>raise InvalidResourceException(<EOL>self.logical_id, "<STR_LIT>")<EOL><DEDENT>if not SwaggerEditor.is_valid(self.definition_body):<EOL><INDENT>raise InvalidResourceException(self.logical_id, "<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>swagger_editor = SwaggerEditor(self.definition_body)<EOL>auth_properties = AuthProperties(**self.auth)<EOL>authorizers = self._get_authorizers(auth_properties.Authorizers, auth_properties.DefaultAuthorizer)<EOL>if authorizers:<EOL><INDENT>swagger_editor.add_authorizers(authorizers)<EOL>self._set_default_authorizer(swagger_editor, authorizers, auth_properties.DefaultAuthorizer)<EOL><DEDENT>self.definition_body = swagger_editor.swagger<EOL>
Add Auth configuration to the Swagger file, if necessary