revert-70aa11f8
mharindu 9 years ago
commit 6418c55f4f

@ -77,14 +77,13 @@ public class MonitoringTask implements Task {
try { try {
DeviceManagementProviderService deviceManagementProviderService = DeviceManagementProviderService deviceManagementProviderService =
PolicyManagementDataHolder.getInstance().getDeviceManagementService(); PolicyManagementDataHolder.getInstance().getDeviceManagementService();
for (DeviceType deviceType : deviceTypes) { for (DeviceType deviceType : deviceTypes) {
if(log.isDebugEnabled()){ if (log.isDebugEnabled()) {
log.debug("Running task for device type : " + deviceType.getName() ); log.debug("Running task for device type : " + deviceType.getName());
} }
PolicyMonitoringService monitoringService = PolicyMonitoringService monitoringService =
@ -100,15 +99,21 @@ public class MonitoringTask implements Task {
deviceType.getName()); deviceType.getName());
} }
for (Device device : devices) { for (Device device : devices) {
if (device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.INACTIVE) || EnrolmentInfo.Status status = device.getEnrolmentInfo().getStatus();
device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.BLOCKED)) { if (status.equals(EnrolmentInfo.Status.INACTIVE) ||
status.equals(EnrolmentInfo.Status.BLOCKED) ||
status.equals(EnrolmentInfo.Status.REMOVED) ||
status.equals(EnrolmentInfo.Status.UNCLAIMED) ||
status.equals(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED) ||
status.equals(EnrolmentInfo.Status.SUSPENDED)) {
continue; continue;
} else { } else {
notifiableDevices.add(device); notifiableDevices.add(device);
} }
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Following devices selected to send the notification for " + deviceType.getName()); log.debug("Following devices selected to send the notification for " +
deviceType.getName());
for (Device device : notifiableDevices) { for (Device device : notifiableDevices) {
log.debug(device.getDeviceIdentifier()); log.debug(device.getDeviceIdentifier());
} }

@ -27,6 +27,7 @@ import org.wso2.carbon.tomcat.ext.valves.CompositeValve;
import org.wso2.carbon.webapp.authenticator.framework.authenticator.WebappAuthenticator; import org.wso2.carbon.webapp.authenticator.framework.authenticator.WebappAuthenticator;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.StringTokenizer;
public class WebappAuthenticationHandler extends CarbonTomcatValve { public class WebappAuthenticationHandler extends CarbonTomcatValve {
@ -34,7 +35,7 @@ public class WebappAuthenticationHandler extends CarbonTomcatValve {
@Override @Override
public void invoke(Request request, Response response, CompositeValve compositeValve) { public void invoke(Request request, Response response, CompositeValve compositeValve) {
if (this.isNonAdminService(request) || this.skipAuthentication(request) || this.isContextSkipped(request)) { if (this.isContextSkipped(request) || (this.isNonAdminService(request) && this.skipAuthentication(request))) {
this.getNext().invoke(request, response, compositeValve); this.getNext().invoke(request, response, compositeValve);
return; return;
} }
@ -60,13 +61,17 @@ public class WebappAuthenticationHandler extends CarbonTomcatValve {
private boolean isContextSkipped(Request request) { private boolean isContextSkipped(Request request) {
String ctx = request.getContext().getPath(); String ctx = request.getContext().getPath();
if (ctx == null) { if (ctx == null || "".equals(ctx)) {
ctx = request.getContextPath(); ctx = request.getContextPath();
if (ctx == null) { if (ctx == null || "".equals(ctx)) {
return false; StringTokenizer tokenizer = new StringTokenizer(request.getRequestURI(), "/");
ctx = tokenizer.nextToken();
if (ctx == null || "".equals(ctx)) {
return false;
}
} }
} }
return ctx.equals("/Carbon") || ctx.equals("/Services"); return ctx.equalsIgnoreCase("carbon") || ctx.equalsIgnoreCase("services");
} }
private void processResponse(Request request, Response response, CompositeValve compositeValve, private void processResponse(Request request, Response response, CompositeValve compositeValve,

@ -29,7 +29,6 @@ import org.wso2.carbon.webapp.authenticator.framework.Constants;
public class BasicAuthAuthenticator implements WebappAuthenticator { public class BasicAuthAuthenticator implements WebappAuthenticator {
private static final String BASIC_AUTH_AUTHENTICATOR = "BasicAuth"; private static final String BASIC_AUTH_AUTHENTICATOR = "BasicAuth";
private static final String HEADER_BASIC_AUTH = "authorization";
@Override @Override
public boolean canHandle(Request request) { public boolean canHandle(Request request) {

@ -50,7 +50,7 @@ public class OAuthAuthenticator implements WebappAuthenticator {
MessageBytes authorization = MessageBytes authorization =
request.getCoyoteRequest().getMimeHeaders(). request.getCoyoteRequest().getMimeHeaders().
getValue(Constants.HTTPHeaders.HEADER_HTTP_AUTHORIZATION); getValue(Constants.HTTPHeaders.HEADER_HTTP_AUTHORIZATION);
String tokenValue = null; String tokenValue;
if (authorization != null) { if (authorization != null) {
authorization.toBytes(); authorization.toBytes();
ByteChunk authBC = authorization.getByteChunk(); ByteChunk authBC = authorization.getByteChunk();

Loading…
Cancel
Save