コード例 #1
0
def Login():
    """ Client登录地址,需要跳转到SSO Server上 """
    ReturnUrl = request.args.get("ReturnUrl") or get_referrer_url() or url_for("front.index", _external=True)
    if url_check(sso_server):
        NextUrl = "{}/sso/?sso={}".format(sso_server, set_ssoparam(ReturnUrl))
        return redirect(NextUrl)
    else:
        return "Invalid Configuration"
コード例 #2
0
#: Plugin License
#: 插件许可证
__license__ = "MIT"
#: Plugin License File
#: 插件许可证文件
__license_file__ = "LICENSE"
#: Plugin Readme File
#: 插件自述文件
__readme_file__ = "README"
#: Plugin state, enabled or disabled, default: enabled
#: 插件状态, enabled、disabled, 默认enabled
__state__ = "enabled"

# 定义sso server地址并删除SSO多余参数
sso_server = SSO.get("sso_server").strip("/")
if not url_check(sso_server):
    raise


# 定义请求函数
def sso_request(url, params=None, data=None, timeout=5, num_retries=1):
    """
    @params dict: 请求查询参数
    @data dict: 提交表单数据
    @timeout int: 超时时间,单位秒
    @num_retries int: 超时重试次数
    """
    headers = {
        "User-Agent":
        "Mozilla/5.0 (X11; CentOS; Linux i686; rv:7.0.1406) Gecko/20100101 PassportClient/{}"
        .format(__version__)