如何配置自定义安全令牌处理程序?

时间:2015-09-18 10:43:02

标签: wcf security configuration token identityserver3

我已经实现了自定义 Saml2SecurityTokenHandler ,如http://leastprivilege.com/2015/07/02/give-your-wcf-security-architecture-a-makeover-with-identityserver3/所示。

此处理程序的构造函数接受两个自定义参数 - authority和requiredScopes。在示例中,此处理程序在代码中注册。但是,我想在web.config文件中执行此操作。

<system.identityModel> <identityConfiguration saveBootstrapContext="true"> <securityTokenHandlers> <clear /> <add type="MyNamespace.MyCustomSaml2SecurityTokenHandler, MyAssembly" />
</securityTokenHandlers>
</identityConfiguration> </system.identityModel>

是否有可能以某种方式从配置(web.config)传递这两个构造函数参数?

1 个答案:

答案 0 :(得分:0)

给您的类MyCustomSaml2SecurityTokenHandler一个零参数的构造函数。

在运行时从服务器端的本地配置获取这些详细信息。