储存credentails的C#OWIN框架

问题描述

我们有一个托管服务,该服务具有OWIN框架作为身份验证机制,现在我们有一个Windows服务,该服务会定期调用此服务,我们已将用户凭据存储在一个JSON文件中,以便它可以调用该服务以获取令牌然后使用令牌处理请求,但是存储用户凭据会带来安全威胁。

我需要摆脱此JSON文件,并将用户的凭据存储在一个更安全的地方,或者我们还有其他方法可以在不存储凭据的情况下获取令牌,请您给我一个如何完成此操作的想法吗? / p>

注意:Windows服务和IIS服务是可分发服务,将使用用户凭据进行安装,因此我们在此处没有任何服务帐户。

public void ConfigureOAuth(IAppBuilder appBuilder,Func<string,string,string> authAction)
        {
            var expiry = TimeSpan.FromMinutes(40);

            var oAuthServerOptions = new OAuthAuthorizationServerOptions()
            {
                AllowInsecureHttp = true,TokenEndpointPath = new PathString("/api/token"),AccesstokenExpireTimeSpan = expiry,Provider = new AuthorizationProvider(authenticationAction),Refresh = new Refresh()
            };

            // Token Generation
            appBuilder.USEOAuthAuthorizationServer(oAuthServerOptions);
            appBuilder.USEOAuthBearerAuthentication(new OAuthBearerAuthenticationoptions());
        }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)