【问题标题】:How to use SSO with RingCentral C# SDK?如何将 SSO 与 RingCentral C# SDK 一起使用?
【发布时间】:2019-07-24 04:31:54
【问题描述】:

使用 RingCentral C# 客户端 SDK 时,如何使用生产环境所需的单点登录 (SSO)? SDK 在没有 SSO 的沙盒环境中运行良好。

我按照文档使用授权,但这仅适用于 RingCentral 密码验证,不适用于 SSO。

await rc.Authorize("username", "extension", "password");

这适用于当前和旧版 SDK:

【问题讨论】:

    标签: c# oauth-2.0 ringcentral


    【解决方案1】:

    仅通过授权代码 OAuth 2.0 授权流程支持单点登录,该流程将向用户显示一个带有 SSO 按钮的登录窗口,该按钮会将用户重定向到 SAML 身份提供商 (IdP) 网站以进行基于 SSO 的身份验证.

    此处提供了有关如何使用两个 C# SDK 完成此操作的演示代码:

    https://github.com/ringcentral/ringcentral-demos-oauth/tree/master/csharp-nancy

    以下是主页和 OAuth 重定向 URI 的两个端点的摘录:

        public DefaultModule()
        {
            var authorizeUri = rc.AuthorizeUri(Config.Instance.RedirectUrl, MyState);
            var template = File.ReadAllText("index.html");
            Get["/"] = _ =>
            {
                var tokenJson = "";
                var authData = rc.token;
                if (rc.token != null && rc.token.access_token != null)
                {
                    tokenJson = JsonConvert.SerializeObject(rc.token, Formatting.Indented);
                }
                var page = Engine.Razor.RunCompile(template, "templateKey", null,
                    new { authorize_uri = authorizeUri, redirect_uri = Config.Instance.RedirectUrl, token_json = tokenJson });
                return page;
            };
            Get["/callback"] = _ =>
            {
                var authCode = Request.Query.code.Value;
                rc.Authorize(authCode, Config.Instance.RedirectUrl);
                return ""; // js will close this window and reload parent window
            };
    

    【讨论】:

      猜你喜欢
      • 2017-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多