Feature hawkbit uaa extension (#317)

* use UserPrincipal to determine tenant at runtime

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>

* add hawkbit-uaa extension

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>

* adapt WithSpringAuthorityRule with UserPrincipal for determine tenant

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>

* fix String principal in DDI download resource

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>

* merge the email to the UserPrincipal from the master manually

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>

* Fixed some grammar issues and typos

Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-10-31 13:16:03 +01:00
committed by GitHub
parent b7f5bf3d79
commit 22272ba3c1
15 changed files with 654 additions and 59 deletions

View File

@@ -17,6 +17,7 @@ import java.util.concurrent.Callable;
import org.eclipse.hawkbit.im.authentication.SpPermission;
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
import org.eclipse.hawkbit.repository.jpa.model.helper.SystemManagementHolder;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
@@ -78,7 +79,9 @@ public class WithSpringAuthorityRule implements TestRule {
authorities = annotation.authorities();
}
final TestingAuthenticationToken testingAuthenticationToken = new TestingAuthenticationToken(
annotation.principal(), annotation.credentials(), authorities);
new UserPrincipal(annotation.principal(), annotation.principal(), annotation.principal(),
annotation.principal(), null, annotation.tenantId()),
annotation.credentials(), authorities);
testingAuthenticationToken
.setDetails(new TenantAwareAuthenticationDetails(annotation.tenantId(), false));
return testingAuthenticationToken;