Security fix for UI auto refresh (#885)

Signed-off-by: Anand Kumar <anand.kumar@bosch-si.com>
This commit is contained in:
Anand Kumar
2019-08-21 11:05:36 +02:00
committed by Dominic Schabel
parent d40b11d2ab
commit e841dc6a8a

View File

@@ -20,6 +20,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.ActionCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.ActionUpdatedEvent;
@@ -183,6 +184,10 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
return ((TenantAwareAuthenticationDetails) tenantAuthenticationDetails).getTenant()
.equalsIgnoreCase(event.getTenant());
}
final Object userPrincipalDetails = userContext.getAuthentication().getPrincipal();
if (userPrincipalDetails instanceof UserPrincipal) {
return ((UserPrincipal) userPrincipalDetails).getTenant().equalsIgnoreCase(event.getTenant());
}
return false;
}