Merge pull request #170 from bsinno/fix_remove_special_coap_auth_token
remove special coap-auth-token filter for coap-downloads
This commit is contained in:
@@ -17,7 +17,6 @@ import org.eclipse.hawkbit.dmf.json.model.TenantSecurityToken;
|
|||||||
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.security.CoapAnonymousPreAuthenticatedFilter;
|
|
||||||
import org.eclipse.hawkbit.security.ControllerPreAuthenticateSecurityTokenFilter;
|
import org.eclipse.hawkbit.security.ControllerPreAuthenticateSecurityTokenFilter;
|
||||||
import org.eclipse.hawkbit.security.ControllerPreAuthenticatedAnonymousDownload;
|
import org.eclipse.hawkbit.security.ControllerPreAuthenticatedAnonymousDownload;
|
||||||
import org.eclipse.hawkbit.security.ControllerPreAuthenticatedAnonymousFilter;
|
import org.eclipse.hawkbit.security.ControllerPreAuthenticatedAnonymousFilter;
|
||||||
@@ -97,7 +96,6 @@ public class AmqpControllerAuthentfication {
|
|||||||
filterChain.add(anonymousDownloadFilter);
|
filterChain.add(anonymousDownloadFilter);
|
||||||
|
|
||||||
filterChain.add(new ControllerPreAuthenticatedAnonymousFilter(ddiSecruityProperties));
|
filterChain.add(new ControllerPreAuthenticatedAnonymousFilter(ddiSecruityProperties));
|
||||||
filterChain.add(new CoapAnonymousPreAuthenticatedFilter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
public class TenantSecurityToken {
|
public class TenantSecurityToken {
|
||||||
|
|
||||||
public static final String AUTHORIZATION_HEADER = "Authorization";
|
public static final String AUTHORIZATION_HEADER = "Authorization";
|
||||||
public static final String COAP_AUTHORIZATION_HEADER = "Coap-Authorization";
|
|
||||||
public static final String COAP_TOKEN_VALUE = "CoapToken";
|
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private final String tenant;
|
private final String tenant;
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
|
||||||
*
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*/
|
|
||||||
package org.eclipse.hawkbit.security;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.dmf.json.model.TenantSecurityToken;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Filter for device which download via coap.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class CoapAnonymousPreAuthenticatedFilter implements PreAuthenficationFilter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HeaderAuthentication getPreAuthenticatedPrincipal(final TenantSecurityToken secruityToken) {
|
|
||||||
return new HeaderAuthentication(secruityToken.getControllerId(), TenantSecurityToken.COAP_TOKEN_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HeaderAuthentication getPreAuthenticatedCredentials(final TenantSecurityToken secruityToken) {
|
|
||||||
return new HeaderAuthentication(secruityToken.getControllerId(), TenantSecurityToken.COAP_TOKEN_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnable(final TenantSecurityToken secruityToken) {
|
|
||||||
final String authHeader = secruityToken.getHeader(TenantSecurityToken.COAP_AUTHORIZATION_HEADER);
|
|
||||||
return TenantSecurityToken.COAP_TOKEN_VALUE.equals(authHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user