class SpringSecurityPasswordValidationCallbackHandler extends AbstractWsPasswordCallbackHandler implements InitializingBean {

	@Override
	protected void handleUsernameTokenPrincipal(UsernameTokenPrincipalCallback callback)
			throws IOException, UnsupportedCallbackException {
		UserDetails user = loadUserDetails(callback.getPrincipal().getName());
		WSUsernameTokenPrincipalImpl principal = callback.getPrincipal();
		UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(principal,
				principal.getPassword(), user.getAuthorities());
		if (logger.isDebugEnabled()) {
			logger.debug("Authentication success: " + authRequest.toString());
		}
		SecurityContextHolder.getContext().setAuthentication(authRequest);
	}

}