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; }
/** * This will do a copy of the properties from this context object * to the properties of the specified context object. * * @param context The ServiceContext object to hold the merged properties * @param doParentProperties Indicates whether to go up the context hierachy * copy the properties at each level */ public void putContextProperties(ServiceContext context, boolean doParentProperties) { if (context != null) { // get the current properties on this context object Map<String, Object> props = getProperties(); // copy them to the specified context object context.mergeProperties(props); if (doParentProperties) { ServiceGroupContext mySGC = null; if (serviceGroupContext != null) { mySGC = serviceGroupContext; } else if (metaParent != null) { mySGC = metaParent; } if (mySGC != null) { ServiceGroupContext sgc = context.getServiceGroupContext(); mySGC.putContextProperties(sgc); } } } }
/** * This will do a copy of the properties from this context object * to the properties of the specified context object. * * @param context The ServiceContext object to hold the merged properties * @param doParentProperties Indicates whether to go up the context hierachy * copy the properties at each level */ public void putContextProperties(ServiceContext context, boolean doParentProperties) { if (context != null) { // get the current properties on this context object Map<String, Object> props = getProperties(); // copy them to the specified context object context.mergeProperties(props); if (doParentProperties) { ServiceGroupContext mySGC = null; if (serviceGroupContext != null) { mySGC = serviceGroupContext; } else if (metaParent != null) { mySGC = metaParent; } if (mySGC != null) { ServiceGroupContext sgc = context.getServiceGroupContext(); mySGC.putContextProperties(sgc); } } } }
serviceGroupCtx = serviceCtx.getServiceGroupContext(); axisSrv = serviceCtx.getAxisService();
serviceGroupCtx = serviceCtx.getServiceGroupContext(); axisSrv = serviceCtx.getAxisService();
/** * @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); } } }
/** * @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 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; }
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; }