You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by conficio <Ka...@Conficio.com> on 2009/02/03 16:45:57 UTC
WS-I Security sample with error handling?
I'm looking to handle errors in the SecurityCallbackMethods, what is the best
way to do that?
In the samples http://cwiki.apache.org/CXF20DOC/ws-security.html
we have
<code>
public class ServerPasswordCallback implements CallbackHandler {
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
if (pc.getIdentifer().equals("joe") {
// set the password on the callback. This will be compared to
the
// password which was sent from the client.
pc.setPassword("password");
}
}
}
</code>
Lets assume I need to retrieve the password from a file or database and how
would I react if anything with that goes wrong (file not found, database
down, etc.)?
Also, would this be an improvement?
<code>
try {
WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
} catch (ClassCastException e) {
throw new UnsupportedCallbackException("call back needs to be of
type "+WSPasswordCallback.class.getName(), e);
}
</code>
Does anybody know of a sample that is a bit more complex?
Thanks
--
View this message in context: http://www.nabble.com/WS-I-Security-sample-with-error-handling--tp21812493p21812493.html
Sent from the cxf-user mailing list archive at Nabble.com.