需要从Web应用程序重定向到Zoho Desk



我有Zoho desk跟踪帐户。我们希望通过单击按钮从我们的web应用程序重定向到Zoho Desk添加票证页面。

我已经从下面提到的链接配置了SAML SSO

https://help.zoho.com/portal/en/kb/desk/for-administrators/user-access-and-security/articles/setting-up-saml-single-signon-for-help-center

我如何在不登录或使用SAML SSO自动注册/登录Zoho Desk的情况下实现这一点?

.net核心中的Web应用程序。

如果有人使用代码完成了此操作,请回复。

我找到了一个解决方案。

下载";部件SAML";包是付费包,但您将获得30天试用版或安装NuGet包";ComponentSpace.saml2";。

创建自签名的X.509证书。在Zoho Desk SAML配置上上传公钥,并在您的项目中添加私钥(在证书文件夹下(。

对于Dot-net核心应用程序,您需要在appsettings.json文件中添加以下设置。

"SAML": {
"$schema": "https://www.componentspace.com/schemas/saml-config-schema-v1.0.json",
"Configurations": [
{
"LocalIdentityProviderConfiguration": {
"LocalCertificates": [
{
"FileName": "certificates/idp.pfx",
"Password": "password"
}
]
},
"PartnerServiceProviderConfigurations": [
{
"Name": "{Entity Id from Zoho desk SAML Screen}",
"SignSamlResponse": true,
"AssertionConsumerServiceUrl": {Help Center SAML Response URL}
}
]
}
]
},
"ZohoDeskSettings": {
"PartnerName": "{Entity Id from Zoho desk SAML Screen}",
"RelayState": "{url on which you want to redirect after SSO}"
}

Startup.cs(ConfigurationService方法(中添加以下代码

services.AddSaml(Configuration.GetSection("SAML"));

在您的控制器中添加以下代码,从那里您将单击链接重定向到zoho门户

[Authorize]
[HttpGet]
public async Task<IActionResult> InitiateSingleSignOn()
{
// Get the name of the logged in user.
var userName = User.Identity.Name;
// For demonstration purposes, include some claims.
var attributes = new List<SamlAttribute>()
{
new SamlAttribute(ClaimTypes.Email, /*{Users Email}*/),
new SamlAttribute(ClaimTypes.GivenName, /*{Users FirstName}*/),
new SamlAttribute(ClaimTypes.Surname, /*{Users LastName}*/),
};
var partnerName = /*{Get setting from appsettings.json}*/;
var relayState = /*{Get setting from appsettings.json}*/;

// Initiate single sign-on to the service provider (IdP-initiated SSO)
// by sending a SAML response containing a SAML assertion to the SP.
// The optional relay state normally specifies the target URL once SSO completes.
await _samlIdentityProvider.InitiateSsoAsync(partnerName, userName, attributes, relayState);
return new EmptyResult();
}

您也可以查看组件SAML 提供的示例

最新更新