public Message invoke(Message msg) { SecuritySubject subject = msg.getWorkContext().getSubject(); Authentication old = SecurityContextHolder.getContext().getAuthentication(); try { if (subject != null) { Authentication authentication = subject.getDelegate(Authentication.class); SecurityContextHolder.getContext().setAuthentication(authentication); } return next.invoke(msg); } finally { SecurityContextHolder.getContext().setAuthentication(old); } }
public Message invoke(Message msg) { byte[] body = (byte[]) msg.getBody(); WorkContext workContext = msg.getWorkContext(); sender.send(body, index, workContext); return ONE_WAY_RESPONSE; }
public Message invoke(final Message msg) { WorkContext workContext = msg.getWorkContext(); List<CallbackReference> newStack = null; List<CallbackReference> stack = workContext.getCallbackReferences(); if (stack != null && !stack.isEmpty()) { // clone the callstack to avoid multiple threads seeing changes newStack = new ArrayList<CallbackReference>(stack); } Map<String, Object> newHeaders = null; Map<String, Object> headers = workContext.getHeaders(); if (headers != null && !headers.isEmpty()) { // clone the headers to avoid multiple threads seeing changes newHeaders = new HashMap<String, Object>(headers); } SecuritySubject subject = workContext.getSubject(); Object payload = msg.getBody(); AsyncRequest request = new AsyncRequest(next, payload, subject, newStack, newHeaders, monitor); executorService.execute(request); return RESPONSE; }
public Message invoke(Message msg) { byte[] body = (byte[]) msg.getBody(); WorkContext workContext = msg.getWorkContext(); byte[] value = sender.sendAndReply(body, index, workContext); msg.setBody(value); return msg; }
public Message invoke(Message msg) { UsernamePasswordToken token = new UsernamePasswordToken(username, password); try { SecuritySubject subject = authenticationService.authenticate(token); msg.getWorkContext().setSubject(subject); } catch (AuthenticationException e) { throw new ServiceUnavailableException("Error authenticating", e); } return next.invoke(msg); }
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); Subject subject = msg.getWorkContext().getSubject(); if (subject != null && !subject.getPrincipals().isEmpty()) { Principal primaryPrincipal = subject.getPrincipals().iterator().next();
public Message invoke(Message msg) { WorkContext workContext = msg.getWorkContext(); try { SecuritySubject subject = workContext.getSubject(); if (subject == null) { msg.setBodyWithFault(new ServiceRuntimeException("Subject not authenticated")); return msg; } authorizationService.checkRoles(subject, roles); return next.invoke(msg); } catch (AuthorizationException e) { msg.setBodyWithFault(new ServiceRuntimeException(e)); return msg; } }
ftpClient.connect(hostAddress, port); monitor.onResponse(ftpClient.getReplyString()); String type = msg.getWorkContext().getHeader(String.class, FtpConstants.HEADER_CONTENT_TYPE); if (type != null && type.equalsIgnoreCase(FtpConstants.BINARY_TYPE)) { monitor.onCommand("TYPE I");