Ejemplo n.º 1
0
__license_file__ = "LICENSE"
#: Plugin Readme File
#: 插件自述文件
__readme_file__ = "README"
#: Plugin state, enabled or disabled, default: enabled
#: 插件状态, enabled、disabled, 默认enabled
name = "weibo"
if PLUGINS[name]["ENABLE"] in ("true", "True", True):
    __state__ = "enabled"
else:
    __state__ = "disabled"

weibo = OAuth2(name,
               client_id=PLUGINS[name]["APP_ID"],
               client_secret=PLUGINS[name]["APP_KEY"],
               redirect_url=PLUGINS[name]["REDIRECT_URI"],
               authorize_url="https://api.weibo.com/oauth2/authorize",
               access_token_url="https://api.weibo.com/oauth2/access_token",
               get_openid_url="https://api.weibo.com/2/account/get_uid.json",
               get_userinfo_url="https://api.weibo.com/2/users/show.json")

plugin_blueprint = Blueprint("oauth2_weibo", "oauth2_weibo")


@plugin_blueprint.route("/login")
def login():
    """ 跳转此OAuth应用登录以授权
    此路由地址:/oauth2/weibo/login
    """
    return weibo.authorize()

Ejemplo n.º 2
0
__license_file__= "LICENSE"
#: Plugin Readme File
#: 插件自述文件
__readme_file__ = "README"
#: Plugin state, enabled or disabled, default: enabled
#: 插件状态, enabled、disabled, 默认enabled
name = "github"
if PLUGINS[name]["ENABLE"] in ("true", "True", True):
    __state__   = "enabled"
else:
    __state__   = "disabled"

github = OAuth2(name,
    client_id = PLUGINS[name]["APP_ID"],
    client_secret = PLUGINS[name]["APP_KEY"],
    redirect_url = PLUGINS[name]["REDIRECT_URI"],
    authorize_url = "https://github.com/login/oauth/authorize",
    access_token_url = "https://github.com/login/oauth/access_token",
    get_userinfo_url = "https://api.github.com/user"
)

plugin_blueprint = Blueprint("oauth2_github", "oauth2_github")
@plugin_blueprint.route("/login")
def login():
    """ 跳转此OAuth应用登录以授权
    此路由地址:/oauth2/github/login
    """
    return github.authorize()

@plugin_blueprint.route("/authorized")
def authorized():
    """ 授权回调路由
Ejemplo n.º 3
0
__license_file__ = "LICENSE"
#: Plugin Readme File
#: 插件自述文件
__readme_file__ = "README"
#: Plugin state, enabled or disabled, default: enabled
#: 插件状态, enabled、disabled, 默认enabled
name = "gitee"
if PLUGINS[name]["ENABLE"] in ("true", "True", True):
    __state__ = "enabled"
else:
    __state__ = "disabled"

gitee = OAuth2(name,
               client_id=PLUGINS[name]["APP_ID"],
               client_secret=PLUGINS[name]["APP_KEY"],
               redirect_url=PLUGINS[name]["REDIRECT_URI"],
               authorize_url="https://gitee.com/oauth/authorize",
               access_token_url="https://gitee.com/oauth/token",
               get_userinfo_url="https://gitee.com/api/v5/user",
               scope="user_info")

plugin_blueprint = Blueprint("oauth2_gitee", "oauth2_gitee")


@plugin_blueprint.route("/login")
def login():
    """ 跳转此OAuth应用登录以授权
    此路由地址:/oauth2/gitee/login
    """
    return gitee.authorize()

Ejemplo n.º 4
0
#: 插件自述文件
__readme_file__ = "README"
#: Plugin state, enabled or disabled, default: enabled
#: 插件状态, enabled、disabled, 默认enabled
name = "coding"
if PLUGINS[name]["ENABLE"] in ("true", "True", True):
    __state__ = "enabled"
else:
    __state__ = "disabled"

coding = OAuth2(
    name,
    client_id=PLUGINS[name]["APP_ID"],
    client_secret=PLUGINS[name]["APP_KEY"],
    redirect_url=PLUGINS[name]["REDIRECT_URI"],
    authorize_url="https://coding.net/oauth_authorize.html",
    access_token_url="https://coding.net/api/oauth/access_token",
    get_userinfo_url="https://coding.net/api/account/current_user",
    scope="user",
    verify_state=False,
)

plugin_blueprint = Blueprint("oauth2_coding", "oauth2_coding")


@plugin_blueprint.route("/login")
def login():
    """ 跳转此OAuth应用登录以授权
    此路由地址:/oauth2/coding/login
    """
    return coding.authorize()
Ejemplo n.º 5
0
#: 插件自述文件
__readme_file__ = "README"
#: Plugin state, enabled or disabled, default: enabled
#: 插件状态, enabled、disabled, 默认enabled
name = "qq"
if PLUGINS[name]["ENABLE"] in ("true", "True", True):
    __state__   = "enabled"
else:
    __state__   = "disabled"

qq = OAuth2(name,
    client_id = PLUGINS[name]["APP_ID"],
    client_secret = PLUGINS[name]["APP_KEY"],
    redirect_url = PLUGINS[name]["REDIRECT_URI"],
    authorize_url = "https://graph.qq.com/oauth2.0/authorize",
    access_token_url = "https://graph.qq.com/oauth2.0/token",
    access_token_method = "get",
    get_openid_url = "https://graph.qq.com/oauth2.0/me",
    get_openid_method = "get",
    get_userinfo_url = "https://graph.qq.com/user/get_user_info",
    get_userinfo_method = "get"
)

plugin_blueprint = Blueprint("oauth2_qq", "oauth2_qq")
@plugin_blueprint.route("/login")
def login():
    """ 跳转此OAuth应用登录以授权
    此路由地址:/oauth2/qq/login
    """
    return qq.authorize()

@plugin_blueprint.route("/authorized")
Ejemplo n.º 6
0
__license_file__= "LICENSE"
#: Plugin Readme File
#: 插件自述文件
__readme_file__ = "README"
#: Plugin state, enabled or disabled, default: enabled
#: 插件状态, enabled、disabled, 默认enabled
name = "baidu"
if PLUGINS[name]["ENABLE"] in ("true", "True", True):
    __state__   = "enabled"
else:
    __state__   = "disabled"

baidu = OAuth2(name,
    client_id = PLUGINS[name]["APP_ID"],
    client_secret = PLUGINS[name]["APP_KEY"],
    redirect_url = PLUGINS[name]["REDIRECT_URI"],
    authorize_url = "https://openapi.baidu.com/oauth/2.0/authorize",
    access_token_url = "https://openapi.baidu.com/oauth/2.0/token",
    get_userinfo_url = "https://openapi.baidu.com/rest/2.0/passport/users/getInfo"
)

plugin_blueprint = Blueprint("oauth2_baidu", "oauth2_baidu")
@plugin_blueprint.route("/login")
def login():
    """ 跳转此OAuth应用登录以授权
    此路由地址:/oauth2/baidu/login
    """
    return baidu.authorize()

@plugin_blueprint.route("/authorized")
def authorized():
    """ 授权回调路由