test_class.declarator: namespaceSecurityHelper
test_class.modifier: private
test_class.original_string: private NamespaceSecurityHelper namespaceSecurityHelper;
test_class.type: NamespaceSecurityHelper
test_class.var_name: namespaceSecurityHelper
test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/helper/NamespaceSecurityHelperTest.java
test_class.identifier: NamespaceSecurityHelperTest
test_case.body: @Test
      public void getAuthorizedNamespacesWhenUserHasPermissionAssertReturnNamespace()
      {
          ApplicationUser applicationUser = new ApplicationUser(getClass());
          applicationUser
              .setNamespaceAuthorizations(new HashSet<>(Arrays.asList(new NamespaceAuthorization("namespace", Arrays.asList(NamespacePermissionEnum.READ)))));
          SecurityContextHolder.getContext().setAuthentication(
              new TestingAuthenticationToken(new SecurityUserWrapper("username", "", true, true, true, true, Collections.emptyList(), applicationUser), null));
  
          Set<String> authorizedNamespaces = namespaceSecurityHelper.getAuthorizedNamespaces(NamespacePermissionEnum.READ);
          assertEquals(1, authorizedNamespaces.size());
          assertTrue(authorizedNamespaces.contains("namespace"));
      }
test_case.class_method_signature: NamespaceSecurityHelperTest.getAuthorizedNamespacesWhenUserHasPermissionAssertReturnNamespace()
test_case.full_signature: @Test public void getAuthorizedNamespacesWhenUserHasPermissionAssertReturnNamespace()
test_case.identifier: getAuthorizedNamespacesWhenUserHasPermissionAssertReturnNamespace
test_case.invocations: getClass setNamespaceAuthorizations asList asList setAuthentication getContext emptyList getAuthorizedNamespaces assertEquals size assertTrue contains
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getAuthorizedNamespacesWhenUserHasPermissionAssertReturnNamespace()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(NamespaceSecurityHelper.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(NamespaceSecurityHelper.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/helper/NamespaceSecurityHelper.java
focal_class.identifier: NamespaceSecurityHelper
focal_class.class_method_signature: NamespaceSecurityHelper.checkPermission(Object object, NamespacePermissionEnum[] permissions)
focal_class.full_signature: public void checkPermission(Object object, NamespacePermissionEnum[] permissions)
focal_class.identifier: checkPermission
focal_class.modifiers: public
focal_class.parameters: (Object object, NamespacePermissionEnum[] permissions)
focal_class.return: void
focal_class.signature: void checkPermission(Object object, NamespacePermissionEnum[] permissions)
focal_class.class_method_signature: NamespaceSecurityHelper.checkPermission(String namespace, NamespacePermissionEnum[] permissions)
focal_class.full_signature: public void checkPermission(String namespace, NamespacePermissionEnum[] permissions)
focal_class.identifier: checkPermission
focal_class.modifiers: public
focal_class.parameters: (String namespace, NamespacePermissionEnum[] permissions)
focal_class.return: void
focal_class.signature: void checkPermission(String namespace, NamespacePermissionEnum[] permissions)
focal_class.class_method_signature: NamespaceSecurityHelper.getAccessDeniedException(List<AccessDeniedException> accessDeniedExceptions)
focal_class.full_signature: public AccessDeniedException getAccessDeniedException(List<AccessDeniedException> accessDeniedExceptions)
focal_class.identifier: getAccessDeniedException
focal_class.modifiers: public
focal_class.parameters: (List<AccessDeniedException> accessDeniedExceptions)
focal_class.return: AccessDeniedException
focal_class.signature: AccessDeniedException getAccessDeniedException(List<AccessDeniedException> accessDeniedExceptions)
focal_class.class_method_signature: NamespaceSecurityHelper.getAuthorizedNamespaces(NamespacePermissionEnum... permissions)
focal_class.full_signature: public Set<String> getAuthorizedNamespaces(NamespacePermissionEnum... permissions)
focal_class.identifier: getAuthorizedNamespaces
focal_class.modifiers: public
focal_class.parameters: (NamespacePermissionEnum... permissions)
focal_class.return: Set<String>
focal_class.signature: Set<String> getAuthorizedNamespaces(NamespacePermissionEnum... permissions)
focal_class.class_method_signature: NamespaceSecurityHelper.isAuthorized(ApplicationUser applicationUser, String namespace, NamespacePermissionEnum... permissions)
focal_class.full_signature: private boolean isAuthorized(ApplicationUser applicationUser, String namespace, NamespacePermissionEnum... permissions)
focal_class.identifier: isAuthorized
focal_class.modifiers: private
focal_class.parameters: (ApplicationUser applicationUser, String namespace, NamespacePermissionEnum... permissions)
focal_class.return: boolean
focal_class.signature: boolean isAuthorized(ApplicationUser applicationUser, String namespace, NamespacePermissionEnum... permissions)
focal_class.class_method_signature: NamespaceSecurityHelper.checkPermission(Object object, NamespacePermissionEnum[] permissions, List<AccessDeniedException> accessDeniedExceptions)
focal_class.full_signature: private void checkPermission(Object object, NamespacePermissionEnum[] permissions, List<AccessDeniedException> accessDeniedExceptions)
focal_class.identifier: checkPermission
focal_class.modifiers: private
focal_class.parameters: (Object object, NamespacePermissionEnum[] permissions, List<AccessDeniedException> accessDeniedExceptions)
focal_class.return: void
focal_class.signature: void checkPermission(Object object, NamespacePermissionEnum[] permissions, List<AccessDeniedException> accessDeniedExceptions)
focal_class.class_method_signature: NamespaceSecurityHelper.getApplicationUser()
focal_class.full_signature: private ApplicationUser getApplicationUser()
focal_class.identifier: getApplicationUser
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: ApplicationUser
focal_class.signature: ApplicationUser getApplicationUser()
focal_class.class_method_signature: NamespaceSecurityHelper.isAuthenticated()
focal_class.full_signature: private boolean isAuthenticated()
focal_class.identifier: isAuthenticated
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isAuthenticated()
focal_method.body: public Set<String> getAuthorizedNamespaces(NamespacePermissionEnum... permissions)
      {
          Set<String> namespaces = new HashSet<>();
          if (SecurityContextHolder.getContext().getAuthentication() != null)
          {
              ApplicationUser applicationUser = getApplicationUser();
              if (applicationUser != null)
              {
                  for (NamespaceAuthorization namespaceAuthorization : applicationUser.getNamespaceAuthorizations())
                  {
                      if (namespaceAuthorization.getNamespacePermissions().containsAll(Arrays.asList(permissions)))
                      {
                          namespaces.add(namespaceAuthorization.getNamespace());
                      }
                  }
              }
          }
          return namespaces;
      }
focal_method.class_method_signature: NamespaceSecurityHelper.getAuthorizedNamespaces(NamespacePermissionEnum... permissions)
focal_method.full_signature: public Set<String> getAuthorizedNamespaces(NamespacePermissionEnum... permissions)
focal_method.identifier: getAuthorizedNamespaces
focal_method.invocations: getAuthentication getContext getApplicationUser getNamespaceAuthorizations containsAll getNamespacePermissions asList add getNamespace
focal_method.modifiers: public
focal_method.parameters: (NamespacePermissionEnum... permissions)
focal_method.return: Set<String>
focal_method.signature: Set<String> getAuthorizedNamespaces(NamespacePermissionEnum... permissions)