Target securityToken and address fully manageable through MGMT API.
Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository.jpa;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
||||
@@ -87,6 +88,14 @@ public class JpaEntityFactory implements EntityFactory {
|
||||
return new JpaTarget(controllerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Target generateTarget(final String controllerId, final String securityToken) {
|
||||
if (StringUtils.isEmpty(securityToken)) {
|
||||
return new JpaTarget(controllerId);
|
||||
}
|
||||
return new JpaTarget(controllerId, securityToken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetTag generateTargetTag() {
|
||||
return new JpaTargetTag();
|
||||
|
||||
@@ -115,9 +115,21 @@ public class JpaTarget extends AbstractJpaNamedEntity implements Persistable<Lon
|
||||
* controller ID of the {@link Target}
|
||||
*/
|
||||
public JpaTarget(final String controllerId) {
|
||||
this(controllerId, SecurityTokenGeneratorHolder.getInstance().generateToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param controllerId
|
||||
* controller ID of the {@link Target}
|
||||
* @param securityToken
|
||||
* for target authentication if enabled
|
||||
*/
|
||||
public JpaTarget(final String controllerId, final String securityToken) {
|
||||
this.controllerId = controllerId;
|
||||
setName(controllerId);
|
||||
securityToken = SecurityTokenGeneratorHolder.getInstance().generateToken();
|
||||
this.securityToken = securityToken;
|
||||
targetInfo = new JpaTargetInfo(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user