2

VS2012 .Net Framework 4.5를 사용하여 Identity and Access Plugin을 사용하여 로컬 STS가있는 WCF 서비스 응용 프로그램을 만들었습니다. 내 목표는 브라우저를 사용하여 인증 할 수 있다는 것입니다. 내가 지금까지 한 일 :인증 리디렉션 루프에 걸림 - STS/WIF

  • WSFAM 및 SAM 모듈이 추가되었습니다.
  • 올바르게 리디렉션되는지 확인하기 위해 피들러를 사용하십시오.
  • FedAuth [] 쿠키가 만들어 졌는지 확인하십시오.

쿠키가 생성 된 직후 (STS) 다시 STS로 리디렉션됩니다. 이것은 내가 루프에 갇혀있는 곳입니다.

WCF 및 웹 서비스는 다음

내 Web.config의의 ... 내가 너무 정교하면 미안, 나에게 아주 새로운 :

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
    <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
    <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
    </configSections> 
    <location path="FederationMetadata"> 
    <system.web> 
     <authorization> 
     <allow users="*" /> 
     </authorization> 
    </system.web> 
    </location> 
    <system.web> 
    <authorization> 
     <deny users="?" /> 
    </authorization> 
    <authentication mode="None" /> 
    <pages validateRequest="false" /> 
    <httpRuntime targetFramework="4.5" /> 
    <compilation debug="true" targetFramework="4.5" /> 
    </system.web> 
    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false before deployment --> 
      <serviceMetadata httpGetEnabled="true" /> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
      <serviceCredentials useIdentityConfiguration="true"> 
      <!--Certificate added by Identity and Access Tool for Visual Studio.--> 
      <serviceCertificate findValue="CN=localhost" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectDistinguishedName" /> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    <protocolMapping> 
     <add scheme="http" binding="ws2007FederationHttpBinding" /> 
    </protocolMapping> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="MyBinding"> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service name="WcfFAMTest.Service1"> 
     <endpoint address="" binding="basicHttpBinding" bindingConfiguration="MyBinding" contract="WcfFAMTest.IService1" /> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"> 
     <add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /> 
     <add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" /> 
    </modules> 
    <directoryBrowse enabled="true" /> 
    </system.webServer> 
    <system.identityModel> 
    <identityConfiguration> 
     <audienceUris> 
     <add value="http://localhost:53655" /> 
     <add value="http://localhost:53655/Service1.svc" /> 
     </audienceUris> 
     <certificateValidation certificateValidationMode="None" /> 
     <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     <trustedIssuers> 
      <add thumbprint="9B74CB2F320F7AAFC156E1252270B1DC01EF40D0" name="LocalSTS" /> 
     </trustedIssuers> 
     </issuerNameRegistry> 
    </identityConfiguration> 
    </system.identityModel> 
    <system.identityModel.services> 
    <federationConfiguration> 
     <wsFederation passiveRedirectEnabled="true" issuer="http://localhost:15937/wsFederationSTS/Issue" realm="http://localhost:53655" reply="http://localhost:53655" requireHttps="false" /> 
     <cookieHandler requireSsl="false" /> 
    </federationConfiguration> 
    </system.identityModel.services> 
    <appSettings> 
    <add key="ida:FederationMetadataLocation" value="http://localhost:15937/wsFederationSTS/FederationMetadata/2007-06/FederationMetadata.xml" /> 
    <add key="ida:ProviderSelection" value="localSTS" /> 
    <add key="ida:EnforceIssuerValidation" value="false" /> 
    </appSettings> 
</configuration> 

피들러 Fiddler

응답 # 10108 - FedAuth 쿠키를 설정하고 리소스로 리디렉션합니다. Response #10108 - sets the FedAuth cookies and redirects to the resource 요청 # 10109 - 지정된 쿠키를 사용하여 리디렉션 된 리소스에 요청합니다. Request #10109 - request to the redirected resource, using the given cookies 응답 #의 10109 - 결과 (401), 리디렉션 내가 이러한 모듈을 지원하지 않습니다 WCF 웹 서비스를 사용하고 있었다 # 10111 Response #10109 - Result 401, redirected to STS again at #10111

답변

0

다시 STS합니다. 같은 방식으로 구성된 ASP.Net 웹 응용 프로그램으로 전환되어 완벽하게 작동합니다.

관련 문제