test_class.declarator: vaultSecurityManager
test_class.modifier: private
test_class.original_string: private VaultSecurityManager vaultSecurityManager;
test_class.type: VaultSecurityManager
test_class.var_name: vaultSecurityManager
test_class.declarator: vaultTemplate
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private VaultTemplate vaultTemplate;
test_class.type: VaultTemplate
test_class.var_name: vaultTemplate
test_class.file: gemfire-utils/gemfire-security/src/test/java/io/pivotal/bds/gemfire/security/VaultSecurityManagerTest.java
test_class.identifier: VaultSecurityManagerTest
test_case.body: @Test
      void authenticate_missingPassword() {
          String username = "some-user";
          String password = "some-password";
  
          VaultResponse vaultResponse = mock(VaultResponse.class);
          Map<String, Object> data = new HashMap<>();
          data.put("password", password);
          when(vaultResponse.getData()).thenReturn(data);
          when(vaultTemplate.read(anyString())).thenReturn(vaultResponse);
  
          Properties props = new Properties();
          props.setProperty("security-username", username);
          Throwable throwable = catchThrowable(() -> vaultSecurityManager.authenticate(props));
          assertThat(throwable).isInstanceOf(IllegalArgumentException.class);
      }
test_case.class_method_signature: VaultSecurityManagerTest.authenticate_missingPassword()
test_case.full_signature: @Test void authenticate_missingPassword()
test_case.identifier: authenticate_missingPassword
test_case.invocations: mock put thenReturn when getData thenReturn when read anyString setProperty catchThrowable authenticate isInstanceOf assertThat
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void authenticate_missingPassword()
focal_class.declarator: vaultTemplate
focal_class.modifier: private
focal_class.original_string: private VaultTemplate vaultTemplate;
focal_class.type: VaultTemplate
focal_class.var_name: vaultTemplate
focal_class.declarator: readPath = "secret/"
focal_class.modifier: private
focal_class.original_string: private String readPath = "secret/";
focal_class.type: String
focal_class.var_name: readPath
focal_class.declarator: LOG = LoggerFactory.getLogger(VaultSecurityManager.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(VaultSecurityManager.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.file: gemfire-utils/gemfire-security/src/main/java/io/pivotal/bds/gemfire/security/VaultSecurityManager.java
focal_class.identifier: VaultSecurityManager
focal_class.interfaces: implements SecurityManager
focal_class.class_method_signature: VaultSecurityManager.VaultSecurityManager()
focal_class.full_signature: public  VaultSecurityManager()
focal_class.identifier: VaultSecurityManager
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  VaultSecurityManager()
focal_class.class_method_signature: VaultSecurityManager.VaultSecurityManager(VaultTemplate vaultTemplate, String readPath)
focal_class.full_signature: public  VaultSecurityManager(VaultTemplate vaultTemplate, String readPath)
focal_class.identifier: VaultSecurityManager
focal_class.modifiers: public
focal_class.parameters: (VaultTemplate vaultTemplate, String readPath)
focal_class.signature:  VaultSecurityManager(VaultTemplate vaultTemplate, String readPath)
focal_class.class_method_signature: VaultSecurityManager.authenticate(Properties properties)
focal_class.full_signature: @Override public Object authenticate(Properties properties)
focal_class.identifier: authenticate
focal_class.modifiers: @Override public
focal_class.parameters: (Properties properties)
focal_class.return: Object
focal_class.signature: Object authenticate(Properties properties)
focal_class.class_method_signature: VaultSecurityManager.init(Properties securityProps)
focal_class.full_signature: @Override public void init(Properties securityProps)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (Properties securityProps)
focal_class.return: void
focal_class.signature: void init(Properties securityProps)
focal_class.class_method_signature: VaultSecurityManager.authorize(Object principal, ResourcePermission permission)
focal_class.full_signature: @Override public boolean authorize(Object principal, ResourcePermission permission)
focal_class.identifier: authorize
focal_class.modifiers: @Override public
focal_class.parameters: (Object principal, ResourcePermission permission)
focal_class.return: boolean
focal_class.signature: boolean authorize(Object principal, ResourcePermission permission)
focal_class.class_method_signature: VaultSecurityManager.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_method.body: @Override
      public Object authenticate(Properties properties) throws AuthenticationFailedException {
          String username = properties.getProperty("security-username");
          Assert.hasText(username, "Missing username");
          LOG.info("authenticate: username={}", username);
  
          String password = properties.getProperty("security-password");
          Assert.hasText(password, "Missing password");
          LOG.trace("authenticate: username={}, password={}", username, password);
  
          VaultResponse vaultResponse = vaultTemplate.read(readPath + username);
  
          if (vaultResponse == null) {
              throw new AuthenticationFailedException(username);
          }
  
          String actualPassword = (String) vaultResponse.getData().get("password");
          LOG.trace("authenticate: username={}, password={}, actualPassword={}", username, password, actualPassword);
  
          if (!password.equals(actualPassword)) {
              throw new AuthenticationFailedException(username);
          }
  
          return new UsernamePrincipal(username);
      }
focal_method.class_method_signature: VaultSecurityManager.authenticate(Properties properties)
focal_method.full_signature: @Override public Object authenticate(Properties properties)
focal_method.identifier: authenticate
focal_method.invocations: getProperty hasText info getProperty hasText trace read get getData trace equals
focal_method.modifiers: @Override public
focal_method.parameters: (Properties properties)
focal_method.return: Object
focal_method.signature: Object authenticate(Properties properties)