code: def checkAuthentication():
      
      if app.oidcClient is None:
          return
      if flask.request.endpoint == 'oidcCallback':
          return
      key = flask.session.get('key') or flask.request.args.get('key')
      if key is None or not app.cache.get(key):
          if 'key' in flask.request.args:
              raise exceptions.NotAuthenticatedException()
          else:
              return startLogin()
docs: The request will have a parameter 'key' if it came from the command line
      client, or have a session key of 'key' if it's the browser.
      If the token is not found, start the login process.
  
      If there is no oidcClient, we are running naked and we don't check.
      If we're being redirected to the oidcCallback we don't check.
  
      :returns None if all is ok (and the request handler continues as usual).
      Otherwise if the key was in the session (therefore we're in a browser)
      then startLogin() will redirect to the OIDC provider. If the key was in
      the request arguments, we're using the command line and just raise an
      exception.