Created
May 25, 2017 16:25
-
-
Save jam01/b3571460098a343a9da0cb0895e8d240 to your computer and use it in GitHub Desktop.
This bean will allow cxf:proxy-clients to use the same outInterceptor. Useful when multiple clients need to use the same request auth.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PasswordCallback implements CallbackHandler { | |
private Map<String, String> passwords; | |
public PasswordCallback(String username, String password) { | |
password.put(username, password); | |
} | |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallBackException { | |
for (int = 0; i < callbacks.length; i++) { | |
WSPasswordCallback pc = (WSPasswordCallback) callbacks[i]; | |
pc.setPassword(passwords.get(pc.getIdentifier())); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<spring:bean id="reqInterceptor" name="reqInterceptor" class="org.apache.cxf.ws.secuirty.wss4j.WSS4JOutInterceptor"> | |
<spring:constructor-arg> | |
<spring:map> | |
<spring:entry key="action" value="UsernameToke"/> | |
<spring:entry key="passwordType" value="PasswordText"/> | |
<spring:entry key="user" value="${server.username}"/> | |
<spring:entry key="passwordCallbackRef"> | |
<spring:bean class="com.example.PasswordCallBack"> | |
<spring:constructor-arg value="${server.username}"/> | |
<spring:constructor-arg value="${server.password}"/> | |
</spring:bean> | |
</spring:entry> | |
</spring:map> | |
</spring:constructor-arg> | |
</spring:bean> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment