(self)
| 271 | |
| 272 | @property |
| 273 | def auth(self) -> Optional[AuthBase]: |
| 274 | auth = self.get('auth', None) |
| 275 | if not auth or not auth['type']: |
| 276 | return |
| 277 | |
| 278 | plugin = plugin_manager.get_auth_plugin(auth['type'])() |
| 279 | |
| 280 | credentials = {'username': None, 'password': None} |
| 281 | try: |
| 282 | # New style |
| 283 | plugin.raw_auth = auth['raw_auth'] |
| 284 | except KeyError: |
| 285 | # Old style |
| 286 | credentials = { |
| 287 | 'username': auth['username'], |
| 288 | 'password': auth['password'], |
| 289 | } |
| 290 | else: |
| 291 | if plugin.auth_parse: |
| 292 | from .cli.argtypes import parse_auth |
| 293 | parsed = parse_auth(plugin.raw_auth) |
| 294 | credentials = { |
| 295 | 'username': parsed.key, |
| 296 | 'password': parsed.value, |
| 297 | } |
| 298 | |
| 299 | return plugin.get_auth(**credentials) |
| 300 | |
| 301 | @auth.setter |
| 302 | def auth(self, auth: dict): |
nothing calls this directly
no test coverage detected