Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def use_authentication(self, strategy: Optional[AuthenticationStrategy] = None) -> AuthenticationStrategy:
if self.started:
raise RuntimeError('The application is already running, configure authentication '
'before starting the application')
if not strategy:
strategy = AuthenticationStrategy()
self._authentication_strategy = strategy
return strategy