WCF:由于身份验证失败,所以无法满足对安全令牌的请求

| 我正在使用由Oauth通过DotnetOpenAuth保护的WCF服务。 我在某个地方遇到了配置错误,该错误导致错误“在身份验证代码中无法满足对安全令牌的请求。”在我的代码中,我看不到找到有效的设置。 从localhost到localhost都可以正常工作,但是一旦将其放在我的服务器上(而不是在域上),它就会从该服务器到自身或从localhost到服务器失败。 我有点担心此站点上的其他一些解决方案,因为它们似乎禁用了安全性。通常是因为他们似乎对我不起作用。 提供者:
   <system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name=\"DataApiBehavior\">
                <serviceMetadata httpGetEnabled=\"true\" />
                <serviceDebug includeExceptionDetailInFaults=\"true\" />
                <serviceAuthorization serviceAuthorizationManagerType=\"OAuthServiceProvider.Code.OAuthAuthorizationManager, OAuthServiceProvider\" principalPermissionMode=\"Custom\" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration=\"DataApiBehavior\" name=\"OAuthServiceProvider.DataApi\">
            <endpoint address=\"\" binding=\"wsHttpBinding\" contract=\"OAuthServiceProvider.Code.IDataApi\">
                <identity>
                    <dns value=\"localhost\" />
                </identity>
            </endpoint>
            <endpoint address=\"mex\" binding=\"mexHttpBinding\" contract=\"IMetadataExchange\" />
        </service>
    </services>
    <serviceHostingEnvironment>
        <baseAddressPrefixFilters>
            <add prefix=\"http://devel.nanaimo.ca/\" />
        </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
</system.serviceModel>
消费者:
<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name=\"WSHttpBinding_IDataApi\" closeTimeout=\"00:01:00\"
                openTimeout=\"00:01:00\" receiveTimeout=\"00:10:00\" sendTimeout=\"00:01:00\"
                bypassProxyOnLocal=\"false\" transactionFlow=\"false\" hostNameComparisonMode=\"StrongWildcard\"
                maxBufferPoolSize=\"524288\" maxReceivedMessageSize=\"65536\"
                messageEncoding=\"Text\" textEncoding=\"utf-8\" useDefaultWebProxy=\"true\"
                allowCookies=\"false\">
                <readerQuotas maxDepth=\"32\" maxStringContentLength=\"8192\" maxArrayLength=\"16384\"
                    maxBytesPerRead=\"4096\" maxNameTableCharCount=\"16384\" />
                <reliableSession ordered=\"true\" inactivityTimeout=\"00:10:00\"
                    enabled=\"false\" />
                <security mode=\"Message\">
                    <transport clientCredentialType=\"Windows\" proxyCredentialType=\"None\"
                        realm=\"\" />
                    <message clientCredentialType=\"Windows\" negotiateServiceCredential=\"true\"
                        algorithmSuite=\"Default\" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address=\"http://devel.nanaimo.ca/NanaimoProfile/DataApi.svc\"
            binding=\"wsHttpBinding\" bindingConfiguration=\"WSHttpBinding_IDataApi\"
            contract=\"CodeServiceOauthProvider.IDataApi\" name=\"WSHttpBinding_IDataApi\">
            <identity>
                <dns value=\"localhost\" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>
更新:好像没有实时调用OAuthServiceProvider.Code.OAuthAuthorizationManager。它已实例化,但从未调用CheckAccessCore。我不知道为什么。     
已邀请:
        这只是一个盲注,但是使用
AuthorizationManager
来授权用户,并且在身份验证之后被调用,但是您的服务配置了默认的
WsHttpBinding
-它使用Windows身份验证的消息安全性。 Windows身份验证在不属于同一域的计算机之间不起作用。 我将从“ 4”开始,该默认默认为无安全性(无身份验证)。如果可行,那么您可以考虑您期望什么安全性。     
        我最终只是用很少的权限创建了Windows用户名和密码,并将用户名硬编码到我的库中。获得证书可能是另一个答案,但我从未让他们工作。     

要回复问题请先登录注册