Extract AlwaysValidRoleValidator from RoleValidator
[vid.git] / vid-app-common / src / main / java / org / onap / vid / roles / RoleProvider.java
index d3d2b80..6c0fd3f 100644 (file)
@@ -24,6 +24,14 @@ package org.onap.vid.roles;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import io.joshworks.restclient.http.HttpResponse;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletRequest;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.web.support.UserUtils;
 import org.onap.vid.aai.exceptions.RoleParsingException;
@@ -34,11 +42,6 @@ import org.onap.vid.services.AaiService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
 
 /**
  * Created by Oren on 7/1/17.
@@ -159,7 +162,7 @@ public class RoleProvider {
     }
 
     public RoleValidator getUserRolesValidator(HttpServletRequest request) {
-        return new RoleValidator(getUserRoles(request));
+        return RoleValidator.by(getUserRoles(request));
     }
 }