From 35a9debcc64b05163612165043690ddb128b1293 Mon Sep 17 00:00:00 2001 From: Alexey Sandler Date: Tue, 28 Jan 2020 16:57:39 +0200 Subject: create RoleValidatorFactory component. Issue-ID: VID-758 Signed-off-by: Alexey Sandler Change-Id: Id444ddbe74b6d28d697e130caa73bd7bfae9ce52 --- .../src/main/java/org/onap/vid/roles/RoleProvider.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java') diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java index 898db332c..d9f2fdedf 100644 --- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java +++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java @@ -58,16 +58,20 @@ public class RoleProvider { private Function getUserIdFunction; private Function getRolesFunction; + private final RoleValidatorFactory roleValidatorFactory; @Autowired - public RoleProvider(AaiService aaiService) { + public RoleProvider(AaiService aaiService, RoleValidatorFactory roleValidatorFactory) { this.aaiService=aaiService; + this.roleValidatorFactory = roleValidatorFactory; getUserIdFunction = UserUtils::getUserId; getRolesFunction = UserUtils::getRoles; } - RoleProvider(AaiService aaiService, Function getUserIdFunction, Function getRolesFunction) { + RoleProvider(AaiService aaiService, RoleValidatorFactory roleValidatorFactory, + Function getUserIdFunction, Function getRolesFunction) { this.aaiService = aaiService; + this.roleValidatorFactory = roleValidatorFactory; this.getRolesFunction = getRolesFunction; this.getUserIdFunction = getUserIdFunction; } @@ -162,7 +166,7 @@ public class RoleProvider { } public RoleValidator getUserRolesValidator(HttpServletRequest request) { - return RoleValidator.by(getUserRoles(request)); + return roleValidatorFactory.by(getUserRoles(request)); } } -- cgit 1.2.3-korg