test_class.file: dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/filter/ProviderAuthFilterTest.java
test_class.identifier: ProviderAuthFilterTest
test_case.body: @Test
      void testAuthFailedWhenParameterError() {
          String service = "org.apache.dubbo.DemoService";
          String method = "test";
          Object[] originalParams = new Object[]{"dubbo1", "dubbo2"};
          long currentTimeMillis = System.currentTimeMillis();
          URL url = URL.valueOf("dubbo://10.10.10.10:2181")
                  .setServiceInterface(service)
                  .addParameter(Constants.ACCESS_KEY_ID_KEY, "ak")
                  .addParameter(Constants.SECRET_ACCESS_KEY_KEY, "sk")
                  .addParameter(CommonConstants.APPLICATION_KEY, "test-provider")
                  .addParameter(Constants.PARAMETER_SIGNATURE_ENABLE_KEY, true)
                  .addParameter(Constants.SERVICE_AUTH, true);
  
          Invoker invoker = mock(Invoker.class);
          Invocation invocation = mock(Invocation.class);
          when(invocation.getObjectAttachment(Constants.AK_KEY)).thenReturn("ak");
          when(invocation.getObjectAttachment(CommonConstants.CONSUMER)).thenReturn("test-consumer");
          when(invocation.getObjectAttachment(Constants.REQUEST_TIMESTAMP_KEY)).thenReturn(currentTimeMillis);
          when(invocation.getMethodName()).thenReturn(method);
          Object[] fakeParams = new Object[]{"dubbo1", "dubbo3"};
          when(invocation.getArguments()).thenReturn(fakeParams);
          when(invoker.getUrl()).thenReturn(url);
  
  
          String requestString = String.format(Constants.SIGNATURE_STRING_FORMAT,
                  url.getColonSeparatedKey(), invocation.getMethodName(), "sk", currentTimeMillis);
          String sign = SignatureUtils.sign(originalParams, requestString, "sk");
          when(invocation.getObjectAttachment(Constants.REQUEST_SIGNATURE_KEY)).thenReturn(sign);
  
          ProviderAuthFilter providerAuthFilter = new ProviderAuthFilter();
          Result result = providerAuthFilter.invoke(invoker, invocation);
          assertTrue(result.hasException());
          assertTrue(result.getException() instanceof RpcAuthenticationException);
      }
test_case.class_method_signature: ProviderAuthFilterTest.testAuthFailedWhenParameterError()
test_case.full_signature: @Test void testAuthFailedWhenParameterError()
test_case.identifier: testAuthFailedWhenParameterError
test_case.invocations: currentTimeMillis addParameter addParameter addParameter addParameter addParameter setServiceInterface valueOf mock mock thenReturn when getObjectAttachment thenReturn when getObjectAttachment thenReturn when getObjectAttachment thenReturn when getMethodName thenReturn when getArguments thenReturn when getUrl format getColonSeparatedKey getMethodName sign thenReturn when getObjectAttachment invoke assertTrue hasException assertTrue getException
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAuthFailedWhenParameterError()
focal_class.file: dubbo-plugin/dubbo-auth/src/main/java/org/apache/dubbo/auth/filter/ProviderAuthFilter.java
focal_class.identifier: ProviderAuthFilter
focal_class.interfaces: implements Filter
focal_class.class_method_signature: ProviderAuthFilter.invoke(Invoker<?> invoker, Invocation invocation)
focal_class.full_signature: @Override public Result invoke(Invoker<?> invoker, Invocation invocation)
focal_class.identifier: invoke
focal_class.modifiers: @Override public
focal_class.parameters: (Invoker<?> invoker, Invocation invocation)
focal_class.return: Result
focal_class.signature: Result invoke(Invoker<?> invoker, Invocation invocation)
focal_method.body: @Override
      public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
          URL url = invoker.getUrl();
          boolean shouldAuth = url.getParameter(Constants.SERVICE_AUTH, false);
          if (shouldAuth) {
              Authenticator authenticator = ExtensionLoader.getExtensionLoader(Authenticator.class)
                      .getExtension(url.getParameter(Constants.AUTHENTICATOR, Constants.DEFAULT_AUTHENTICATOR));
              try {
                  authenticator.authenticate(invocation, url);
              } catch (Exception e) {
                  return AsyncRpcResult.newDefaultAsyncResult(e, invocation);
              }
          }
          return invoker.invoke(invocation);
      }
focal_method.class_method_signature: ProviderAuthFilter.invoke(Invoker<?> invoker, Invocation invocation)
focal_method.full_signature: @Override public Result invoke(Invoker<?> invoker, Invocation invocation)
focal_method.identifier: invoke
focal_method.invocations: getUrl getParameter getExtension getExtensionLoader getParameter authenticate newDefaultAsyncResult invoke
focal_method.modifiers: @Override public
focal_method.parameters: (Invoker<?> invoker, Invocation invocation)
focal_method.return: Result
focal_method.signature: Result invoke(Invoker<?> invoker, Invocation invocation)