Author: coheigea
Date: Fri Jan 11 10:47:07 2013
New Revision: 1431983
URL: http://svn.apache.org/viewvc?rev=1431983&view=rev
Log:
[FEDIZ-35] - Allow to use a custom CXF bus for IdpSTSClient
Modified:
cxf/fediz/branches/1.0.x-fixes/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/IdpServlet.java
Modified:
cxf/fediz/branches/1.0.x-fixes/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/IdpServlet.java
URL:
http://svn.apache.org/viewvc/cxf/fediz/branches/1.0.x-fixes/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/IdpServlet.java?rev=1431983&r1=1431982&r2=1431983&view=diff
==============================================================================
---
cxf/fediz/branches/1.0.x-fixes/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/IdpServlet.java
(original)
+++
cxf/fediz/branches/1.0.x-fixes/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/IdpServlet.java
Fri Jan 11 10:47:07 2013
@@ -96,6 +96,8 @@ public class IdpServlet extends HttpServ
private String tokenType;
+ private Bus bus;
+
@Override
public void init() throws ServletException {
if (getInitParameter(S_PARAM_STS_WSDL_URL) == null) {
@@ -294,9 +296,9 @@ public class IdpServlet extends HttpServ
}
private SecurityToken requestSecurityTokenForIDP(String username, String
password, String appliesTo) throws Exception {
- Bus bus = BusFactory.getDefaultBus();
+ Bus cxfBus = getBus();
- IdpSTSClient sts = new IdpSTSClient(bus);
+ IdpSTSClient sts = new IdpSTSClient(cxfBus);
sts.setAddressingNamespace("http://www.w3.org/2005/08/addressing");
if (tokenType != null && tokenType.length() > 0) {
sts.setTokenType(tokenType);
@@ -327,9 +329,9 @@ public class IdpServlet extends HttpServ
private String requestSecurityTokenForRP(SecurityToken onbehalfof,
String appliesTo) throws Exception {
try {
- Bus bus = BusFactory.getDefaultBus();
+ Bus cxfBus = getBus();
List<String> realmClaims = null;
- ApplicationContext ctx = (ApplicationContext) bus
+ ApplicationContext ctx = (ApplicationContext) cxfBus
.getExtension(ApplicationContext.class);
try {
@SuppressWarnings("unchecked")
@@ -346,7 +348,7 @@ public class IdpServlet extends HttpServ
LOG.error("Failed to read bean 'realm2ClaimsMap'", ex);
}
- IdpSTSClient sts = new IdpSTSClient(bus);
+ IdpSTSClient sts = new IdpSTSClient(cxfBus);
sts.setAddressingNamespace("http://www.w3.org/2005/08/addressing");
if (tokenType != null && tokenType.length() > 0) {
sts.setTokenType(tokenType);
@@ -411,4 +413,11 @@ public class IdpServlet extends HttpServ
return writer.getDocument().getDocumentElement();
}
+ public void setBus(Bus bus) {
+ this.bus = bus;
+ }
+
+ public Bus getBus() {
+ return (bus != null) ? bus : BusFactory.getDefaultBus();
+ }
}