private void setAdminCookie(boolean result) { if (result) { String cookie = (String) stub._getServiceClient().getServiceContext().getProperty( HTTPConstants.COOKIE_STRING); if (cookie == null) { // For local transport - the cookie will be null. // This generated cookie cannot be used for any form authentication with the backend. // This is done to be backward compatible. cookie = UUID.randomUUID().toString(); } session.setAttribute(ServerConstants.ADMIN_SERVICE_AUTH_TOKEN, cookie); } }
/** * Returns the EngineContext in which the parent ServiceContext lives. * * @return Returns parent ServiceContext's parent EngineContext. */ public ConfigurationContext getConfigurationContext() { if (parent != null) { return ((ServiceContext) parent).getConfigurationContext(); } else { return null; } }
/** * @param context */ public void setServiceContext(ServiceContext context) { // allow the service context to be set to null // this allows the message context object to be extraced from // the object graph serviceContext = context; if (serviceContext != null) { if ((operationContext != null) && (operationContext.getParent() != context)) { throw new AxisError("ServiceContext and OperationContext.parent do not match!"); } // setting configcontext using configuration context in service context if (configurationContext == null) { // setting configcontext configurationContext = context.getConfigurationContext(); } if (serviceGroupContext == null) { // setting service group context serviceGroupContext = context.getServiceGroupContext(); } AxisService axisService = context.getAxisService(); this.setAxisService(axisService); // Inform the listeners of an attach event if (axisService != null) { axisService.attachServiceContextEvent(serviceContext, this); } } }
private boolean isAuthenticated(String remoteIP) { OperationContext opCtx = msgContext.getOperationContext(); ServiceContext serviceCtx = opCtx.getServiceContext(); String opName = opCtx.getAxisOperation().getName().getLocalPart(); String serviceName = serviceCtx.getAxisService().getName(); if ((serviceName.equals(ServerConstants.GLOBAL_ADMIN_SERVICE) || serviceName.equals(ClusteringConstants.NODE_MANAGER_SERVICE)) && (opName.equals("login") || opName.equals("logout"))) { return true; } String loginStatus = (String) serviceCtx.getServiceGroupContext(). getPropertyNonReplicable(ServerConstants.ADMIN_LOGGED_IN); boolean authenticated = "true".equals(loginStatus); if(!authenticated){ SimpleDateFormat date = new SimpleDateFormat("'['yyyy-MM-dd HH:mm:ss,SSSS']'"); log.warn("Illegal access attempt at " + date.format(new Date()) + " from IP address " + remoteIP); } return authenticated; }
ServiceContext context = MessageContext.getCurrentMessageContext().getServiceContext(); if ((strTimestamp = (String) context.getProperty(OAUTH_LATEST_TIMESTAMP)) != null) { latestTimeStamp = Long.parseLong(strTimestamp); context.setProperty(OAUTH_LATEST_TIMESTAMP, String.valueOf(time)); if ((nonceStore = (List<String>) context.getProperty(OAUTH_NONCE_STORE)) != null) { if (nonceStore.contains(nonce)) { nonceStore = new ArrayList<String>(); nonceStore.add(nonce); context.setProperty(OAUTH_NONCE_STORE, nonceStore);
public AxisService getAxisService() { return serviceContext.getAxisService(); }
ConfigurationContext cfgCtx = sc.getConfigurationContext(); .getListenerManager().getEPRforService(sc.getAxisService().getName(), axisOp.getName().getLocalPart(), outMsgCtx.getTransportOut().getName());
AxisService axisService = (AxisService) serviceItr.next(); ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService); AxisService service = serviceContext.getAxisService(); ClassLoader classLoader = service.getClassLoader(); Parameter implInfoParam = service.getParameter(Constants.SERVICE_CLASS); ((String) implInfoParam.getValue()).trim()); Object serviceImpl = makeNewServiceObject(service); serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceImpl); initServiceObject(serviceImpl, serviceContext); restoreThreadContext(tc);
/** * Save the given object in the session with the given name. */ private static void setSessionObject(String name, Object obj) { MessageContext messageContext = MessageContext.getCurrentMessageContext(); if (messageContext != null) { ServiceContext serviceContext = messageContext.getServiceContext(); if (serviceContext != null) { serviceContext.setProperty(name, obj); } } else { threadLocalSession.get().put(name, obj); } }
msgctx.setServiceContext((ServiceContext) operationContext.getParent()); msgctx.setAxisService( ((ServiceContext) operationContext.getParent()).getAxisService()); ((ServiceGroupContext) msgctx.getServiceContext().getParent()).getId());
/** * Gets a service context. Creates a new one from AxisService. * There is no need to store service context inside serviceGroup * context as well. * * @param service the AxisService for which to get a context * @return Returns ServiceContext. * @throws AxisFault if something goes wrong */ public ServiceContext getServiceContext(AxisService service) throws AxisFault { AxisService axisService = axisServiceGroup.getService(service.getName()); if (axisService == null) { throw new AxisFault(Messages.getMessage("invalidserviceinagroup", service.getName(), axisServiceGroup.getServiceGroupName())); } if (serviceContextMap == null) { serviceContextMap = new HashMap<String, ServiceContext>(); } ServiceContext serviceContext = (ServiceContext) serviceContextMap.get(service.getName()); if (serviceContext == null) { serviceContext = new ServiceContext(service, this); getRootContext().contextCreated(serviceContext); serviceContextMap.put(service.getName(), serviceContext); } return serviceContext; }
ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService); OperationContext operationContext = serviceContext .createOperationContext(axis2Msg.getOperationName()); axis2Ctx.setServiceContext(serviceContext); axis2Ctx.setOperationContext(operationContext); axis2Ctx.setAxisOperation(axisOperation); } else if (axis2Ctx.getOperationContext() == null) { axis2Ctx.setOperationContext(new OperationContext(new InOutAxisOperation(), new ServiceContext()));
ServiceContext context = MessageContext.getCurrentMessageContext().getServiceContext(); if ((strTimestamp = (String) context.getProperty(OAUTH_LATEST_TIMESTAMP)) != null) { latestTimeStamp = Long.parseLong(strTimestamp); context.setProperty(OAUTH_LATEST_TIMESTAMP, String.valueOf(time)); if ((nonceStore = (List<String>) context.getProperty(OAUTH_NONCE_STORE)) != null) { if (nonceStore.contains(nonce)) { nonceStore = new ArrayList<String>(); nonceStore.add(nonce); context.setProperty(OAUTH_NONCE_STORE, nonceStore);
public void addServiceContext(ServiceContext serviceContext) { serviceContextMap.put(serviceContext.getAxisService().getName(), serviceContext); }
ConfigurationContext cfgCtx = sc.getConfigurationContext(); .getListenerManager().getEPRforService(sc.getAxisService().getName(), axisOp.getName().getLocalPart(), outMsgCtx.getTransportOut().getName());
private static UpdateStateCommand toUpdateContextCommand(AbstractContext context) { UpdateStateCommand cmd = null; if (context instanceof ConfigurationContext) { cmd = new UpdateConfigurationStateCommand(); } else if (context instanceof ServiceGroupContext) { ServiceGroupContext sgCtx = (ServiceGroupContext) context; cmd = new UpdateServiceGroupStateCommand(); UpdateServiceGroupStateCommand updateSgCmd = (UpdateServiceGroupStateCommand) cmd; updateSgCmd.setServiceGroupName(sgCtx.getDescription().getServiceGroupName()); updateSgCmd.setServiceGroupContextId(sgCtx.getId()); } else if (context instanceof ServiceContext) { ServiceContext serviceCtx = (ServiceContext) context; cmd = new UpdateServiceStateCommand(); UpdateServiceStateCommand updateServiceCmd = (UpdateServiceStateCommand) cmd; String sgName = serviceCtx.getServiceGroupContext().getDescription().getServiceGroupName(); updateServiceCmd.setServiceGroupName(sgName); updateServiceCmd.setServiceGroupContextId(serviceCtx.getServiceGroupContext().getId()); updateServiceCmd.setServiceName(serviceCtx.getAxisService().getName()); } return cmd; }
AxisService axisService = (AxisService) serviceItr.next(); ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService); AxisService service = serviceContext.getAxisService(); ClassLoader classLoader = service.getClassLoader(); Parameter implInfoParam = service.getParameter(Constants.SERVICE_CLASS); ((String) implInfoParam.getValue()).trim()); Object serviceImpl = makeNewServiceObject(service); serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceImpl); initServiceObject(serviceImpl, serviceContext); restoreThreadContext(tc);
client.getServiceContext().setProperty(RAMPART_POLICY, issuerPolicy); client.getOptions().setSoapVersionURI(this.soapVersion); if(this.addressingNs != null) {
msgctx.setServiceContext((ServiceContext) operationContext.getParent()); msgctx.setAxisService( ((ServiceContext) operationContext.getParent()).getAxisService()); ((ServiceGroupContext) msgctx.getServiceContext().getParent()).getId());
/** * Gets a service context. Creates a new one from AxisService. * There is no need to store service context inside serviceGroup * context as well. * * @param service the AxisService for which to get a context * @return Returns ServiceContext. * @throws AxisFault if something goes wrong */ public ServiceContext getServiceContext(AxisService service) throws AxisFault { AxisService axisService = axisServiceGroup.getService(service.getName()); if (axisService == null) { throw new AxisFault(Messages.getMessage("invalidserviceinagroup", service.getName(), axisServiceGroup.getServiceGroupName())); } if (serviceContextMap == null) { serviceContextMap = new HashMap<String, ServiceContext>(); } ServiceContext serviceContext = (ServiceContext) serviceContextMap.get(service.getName()); if (serviceContext == null) { serviceContext = new ServiceContext(service, this); getRootContext().contextCreated(serviceContext); serviceContextMap.put(service.getName(), serviceContext); } return serviceContext; }