Soap picketlink sts ws-trust mustunderstand标头
有没有办法将picketLink sts配置为接受带有mustUnderstand头的soap请求 我正在使用: 我发送的请求是:Soap picketlink sts ws-trust mustunderstand标头,soap,cxf,jboss7.x,ws-trust,picketlink,Soap,Cxf,Jboss7.x,Ws Trust,Picketlink,有没有办法将picketLink sts配置为接受带有mustUnderstand头的soap请求 我正在使用: 我发送的请求是: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="urn:picketlink:identity-federation:sts" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/v1.4/cd
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="urn:picketlink:identity-federation:sts" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/v1.4/cd/ws-trust.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<Action xmlns="http://www.w3.org/2005/08/addressing">http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Renew</Action>
<MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:9cfedcee-2ebf-47e0-a24a-45281d785136</MessageID>
<To xmlns="http://www.w3.org/2005/08/addressing">https://namsb.blr.novell.com:443/nidp/wstrust/sts</To>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>
<wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Timestamp wsu:Id="TS-1">
<wsu:Created>2014-02-10T23:36:42Z</wsu:Created>
<wsu:Expires>2014-02-10T24:36:42Z</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken wsu:Id="UsernameToken-2">
<wsse:Username>admin</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">novell</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<wst:RequestSecurityToken Context="context">
<wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</wst:TokenType>
<wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
</wst:RequestSecurityToken>
</soap:Body>
</soap:Envelope>
我找到了答案,我把它贴在这里,它可以帮助别人
package org.picketlink.identity.federation.app.sts;
/**
* imports...
*/
@WebServiceProvider(serviceName = "PicketLinkSTS", portName = "PicketLinkSTSPort", targetNamespace = "urn:picketlink:identity-federation:sts", wsdlLocation = "WEB-INF/wsdl/PicketLinkSTS.wsdl")
@ServiceMode(value = Service.Mode.MESSAGE)
@Addressing(enabled = true, required = true)
@HandlerChain(file = "soap-handler.xml")
public class PicketLinkSTService extends PicketLinkSTS {
private static Logger log = Logger.getLogger(PicketLinkSTService.class);
@Resource
public void setWSC(WebServiceContext wctx) {
log.info("Setting WebServiceContext = " + wctx);
this.context = wctx;
}
}
@覆盖
公共集getHeaders(){
final HashSet headers=new HashSet();
add(getWssSecurityHeader());
//通知运行时已处理此问题
返回标题;
}
私有QName getWssSecurityHeader(){
返回新的QName(“http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",
“担保”、“wsse”);
}
@凌驾
公共布尔handleMessage(SOAPMessageContext上下文){
返回true;
}
@凌驾
公共布尔handleFault(SOAPMessageContext上下文){
返回false;
}
@凌驾
公共无效关闭(MessageContext上下文){
}
}<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<javaee:handler-chains
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
<javaee:handler-chain>
<javaee:handler>
<javaee:handler-class>org.picketlink.identity.federation.app.sts.SOAPHandlerMustUnderstand
</javaee:handler-class>
</javaee:handler>
</javaee:handler-chain>
</javaee:handler-chains>
org.picketlink.identity.federation.app.sts.SOAPHandlerMustUnderstand
Soap-handler.xml定义处理程序链调用的类
package org.picketlink.identity.federation.app.sts;
/**
* imports...
*/
@WebServiceProvider(serviceName = "PicketLinkSTS", portName = "PicketLinkSTSPort", targetNamespace = "urn:picketlink:identity-federation:sts", wsdlLocation = "WEB-INF/wsdl/PicketLinkSTS.wsdl")
@ServiceMode(value = Service.Mode.MESSAGE)
@Addressing(enabled = true, required = true)
@HandlerChain(file = "soap-handler.xml")
public class PicketLinkSTService extends PicketLinkSTS {
private static Logger log = Logger.getLogger(PicketLinkSTService.class);
@Resource
public void setWSC(WebServiceContext wctx) {
log.info("Setting WebServiceContext = " + wctx);
this.context = wctx;
}
}
@Override
public Set<QName> getHeaders() {
final HashSet<QName> headers = new HashSet<QName>();
headers.add(getWssSecurityHeader());
// notify the runtime that this is handled
return headers;
}
private QName getWssSecurityHeader() {
return new QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",
"Security", "wsse");
}
@Override
public boolean handleMessage(SOAPMessageContext context) {
return true;
}
@Override
public boolean handleFault(SOAPMessageContext context) {
return false;
}
@Override
public void close(MessageContext context) {
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<javaee:handler-chains
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
<javaee:handler-chain>
<javaee:handler>
<javaee:handler-class>org.picketlink.identity.federation.app.sts.SOAPHandlerMustUnderstand
</javaee:handler-class>
</javaee:handler>
</javaee:handler-chain>
</javaee:handler-chains>