1

런타임 중에 내 클라이언트가 사용하는 보안 토큰 서버를 변경할 수 있습니까?METRO SOAP 클라이언트에서 프로그래밍 방식으로 STS 서버 변경

Active Directory Federation Service의 보안 토큰 서비스를 사용하여 보안 된 .NET 서비스 용 METRO 2.3 클라이언트가 있습니다. 모든 것이 xml fles를 사용하여 구성됩니다. 이 서비스는 두 개의 동일한 서버를 제공합니다. 하나는 테스트 용이고 다른 하나는 생산 용입니다.

런타임시 서버를 전환 할 수 있습니까?

내 단축 WSIT-client.xml :

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"> 
    <import location="mex.xml" namespace="http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice"/> 
    <import location="myservice.svc.xml" namespace="http://namespace.org/"/> 
</definitions> 

그리고 내 mex.xml의 중요한 부분 :

<wsdl:definitions name="SecurityTokenService" 
        targetNamespace="http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice" 
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
        xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
        xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
        xmlns:wsp1="http://www.w3.org/ns/ws-policy" 
        xmlns:tc="http://schemas.sun.com/ws/2006/05/trust/client"> 
    <wsdl:service name="SecurityTokenService"> 
     <wsdl:port name="IssuedTokenWSTrustBinding_IWSTrust13Async" binding="tns:IssuedTokenWSTrustBinding_IWSTrust13Async"> 
      <soap12:address location="http://login.test.miljoeportal.dk/adfs/services/trust/13/issuedtokensymmetricbasic256sha256"/> 
      <wsa10:EndpointReference> 
       <wsa10:Address>http://login.test.theserver.com/adfs/services/trust/13/issuedtokensymmetricbasic256sha256</wsa10:Address> 
       <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity"> 
        <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> 
         <X509Data> 
          <X509Certificate>THECERTIFICATE</X509Certificate> 
         </X509Data> 
        </KeyInfo> 
       </Identity> 
      </wsa10:EndpointReference> 
     </wsdl:port> 
    </wsdl:service> 
    <wsp1:Policy wsu:Id="IssuedTokenWSTrustBinding_IWSTrust13AsyncPolicy"> 
     <wsp1:ExactlyOne> 
      <wsp1:All> 
       <tc:PreconfiguredSTS wspp:visibility="private" 
            endpoint= "http://login.test.theserver.com/adfs/services/trust/13/username" 
            wsdlLocation="https://login.test.theserver.com/adfs/services/trust/mex" 
            metadata= "https://login.test.theserver.com/adfs/services/trust/mex" 
            serviceName="SecurityTokenService" 
            portName="UserNameWSTrustBinding_IWSTrust_13Async" 
            wstVersion="http://docs.oasis-open.org/ws-sx/ws-trust/200512"/> 
      </wsp1:All> 
     </wsp1:ExactlyOne> 
    </wsp1:Policy> 
</wsdl:definitions> 

는 런타임시 http://login.prod.theserver.comhttp://login.test.theserver.com URL을 변경할 수 있습니까?

+0

서비스의 끝점을 쉽게 변경할 수 있습니다. https://metro.java.net/guide/ch02.html#how-to-invoke-and-endpoint-by-overriding-endpoint-address-in- the-wsdl하지만 sts 변경에 대한 정보를 찾을 수 없습니다. – Jan

답변

1

는 다음과 같이 이러한 매개 변수를 설정할 수 있습니다 :

MyServices s = new MyService(); 
myserviceinterface = s.getMyService(); 

Map<String, Object> context = ((BindingProvider) myserviceinterface).getRequestContext(); 
context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://service.theserver.com/wsdl"); 

String stsEndpoint  = "http://login.theserver.com/adfs/services/trust/13/username"; 
String stsWSDLLocation = "https://login.theserver.com/adfs/services/trust/mex"; 
String stsServiceName = "SecurityTokenService"; 
String stsPortName  = "UserNameWSTrustBinding_IWSTrust13Async"; 
String stsNamespace = "http://schemas.microsoft.com/ws/2008/06/identity/securitytokenservice"; 

context.put(STSIssuedTokenConfiguration.STS_ENDPOINT, stsEndpoint); 
context.put(STSIssuedTokenConfiguration.STS_NAMESPACE, stsNamespace); 
context.put(STSIssuedTokenConfiguration.STS_WSDL_LOCATION, stsWSDLLocation); 
context.put(STSIssuedTokenConfiguration.STS_SERVICE_NAME, stsServiceName); 
context.put(STSIssuedTokenConfiguration.STS_PORT_NAME, stsPortName); 

나는 런타임에서 키 스토어 설정을 변경하는 방법을 발견하지 않았습니다.

관련 문제