original_docstring:  Set up OAuth handlers based on configuration 
docstring: Set up OAuth handlers based on configuration
docstring_tokens: Set up OAuth handlers based on configuration
code: def register_oauthhandlers(app):
      """ Set up OAuth handlers based on configuration """
      # TODO: move to auth class
      blueprint = None
      if not app.config["OAUTH_TYPE"]:
          return
      if app.config["OAUTH_TYPE"] == 'slack':
          blueprint = slack.make_slack_blueprint(
              client_id=app.config["OAUTH_ID"],
              client_secret=app.config["OAUTH_SECRET"],
              scope="identity.basic,identity.email",
              redirect_to="auth.slack_login",
              login_url="/login",
              # authorized_url=None,
              # session_class=None,
              # storage=None,
              subdomain=app.config["OAUTH_DOMAIN"],
          )
      elif app.config["OAUTH_TYPE"] == 'azure':
          blueprint = azure.make_azure_blueprint(
              client_id=app.config["OAUTH_ID"],
              client_secret=app.config["OAUTH_SECRET"],
              tenant=app.config["OAUTH_DOMAIN"],
              scope="profile email User.ReadBasic.All openid",
              redirect_to="auth.azure_login",
              login_url="/login",
          )
      elif app.config["OAUTH_TYPE"] == 'github':
          blueprint = github.make_github_blueprint(
              client_id=app.config["OAUTH_ID"],
              client_secret=app.config["OAUTH_SECRET"],
              # scope="user,read:user",
              redirect_to="auth.github_login",
              login_url="/login",
          )
      if blueprint is not None:
          app.register_blueprint(blueprint, url_prefix="/oauth")
code_tokens: def register_oauthhandlers ( app ) : blueprint = None if not app . config [ "OAUTH_TYPE" ] : return if app . config [ "OAUTH_TYPE" ] == 'slack' : blueprint = slack . make_slack_blueprint ( client_id = app . config [ "OAUTH_ID" ] , client_secret = app . config [ "OAUTH_SECRET" ] , scope = "identity.basic,identity.email" , redirect_to = "auth.slack_login" , login_url = "/login" , subdomain = app . config [ "OAUTH_DOMAIN" ] , ) elif app . config [ "OAUTH_TYPE" ] == 'azure' : blueprint = azure . make_azure_blueprint ( client_id = app . config [ "OAUTH_ID" ] , client_secret = app . config [ "OAUTH_SECRET" ] , tenant = app . config [ "OAUTH_DOMAIN" ] , scope = "profile email User.ReadBasic.All openid" , redirect_to = "auth.azure_login" , login_url = "/login" , ) elif app . config [ "OAUTH_TYPE" ] == 'github' : blueprint = github . make_github_blueprint ( client_id = app . config [ "OAUTH_ID" ] , client_secret = app . config [ "OAUTH_SECRET" ] , redirect_to = "auth.github_login" , login_url = "/login" , ) if blueprint is not None : app . register_blueprint ( blueprint , url_prefix = "/oauth" )
short_docstring: Set up OAuth handlers based on configuration
short_docstring_tokens: Set up OAuth handlers based on configuration
comment: """ Set up OAuth handlers based on configuration """$SEP$# TODO: move to auth class$SEP$# authorized_url=None,$SEP$# session_class=None,$SEP$# storage=None,$SEP$# scope="user,read:user",