public SecurityTokenServiceClient buildClientForRelyingPartyTokenResponses ( final SecurityToken securityToken , final WSFederationRegisteredService service ) { val cxfBus = BusFactory . getDefaultBus ( ) ; val sts = new SecurityTokenServiceClient ( cxfBus ) ; sts . setAddressingNamespace ( StringUtils . defaultIfBlank ( service . getAddressingNamespace ( ) , WSFederationConstants . HTTP_WWW_W3_ORG_2005_08_ADDRESSING ) ) ; sts . setWsdlLocation ( prepareWsdlLocation ( service ) ) ; val namespace = StringUtils . defaultIfBlank ( service . getNamespace ( ) , WSFederationConstants . HTTP_DOCS_OASIS_OPEN_ORG_WS_SX_WS_TRUST_200512 ) ; sts . setServiceQName ( new QName ( namespace , service . getWsdlService ( ) ) ) ; sts . setEndpointQName ( new QName ( namespace , service . getWsdlEndpoint ( ) ) ) ; sts . setEnableAppliesTo ( StringUtils . isNotBlank ( service . getAppliesTo ( ) ) ) ; sts . setOnBehalfOf ( securityToken . getToken ( ) ) ; sts . setKeyType ( WSFederationConstants . HTTP_DOCS_OASIS_OPEN_ORG_WS_SX_WS_TRUST_200512_BEARER ) ; sts . setTokenType ( StringUtils . defaultIfBlank ( service . getTokenType ( ) , WSConstants . WSS_SAML2_TOKEN_TYPE ) ) ; if ( StringUtils . isNotBlank ( service . getPolicyNamespace ( ) ) ) { sts . setWspNamespace ( service . getPolicyNamespace ( ) ) ; } return sts ; }
Build client for relying party token responses .