test_class.file: dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/AccessKeyAuthenticatorTest.java
test_class.identifier: AccessKeyAuthenticatorTest
test_case.body: @Test
      void testAuthenticateRequestNoSignature() {
          URL url = URL.valueOf("dubbo://10.10.10.10:2181")
                  .addParameter(Constants.ACCESS_KEY_ID_KEY, "ak")
                  .addParameter(CommonConstants.APPLICATION_KEY, "test")
                  .addParameter(Constants.SECRET_ACCESS_KEY_KEY, "sk");
          Invocation invocation = new RpcInvocation();
          AccessKeyAuthenticator helper = new AccessKeyAuthenticator();
          assertThrows(RpcAuthenticationException.class, () -> helper.authenticate(invocation, url));
      }
test_case.class_method_signature: AccessKeyAuthenticatorTest.testAuthenticateRequestNoSignature()
test_case.full_signature: @Test void testAuthenticateRequestNoSignature()
test_case.identifier: testAuthenticateRequestNoSignature
test_case.invocations: addParameter addParameter addParameter valueOf assertThrows authenticate
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAuthenticateRequestNoSignature()
focal_class.file: dubbo-plugin/dubbo-auth/src/main/java/org/apache/dubbo/auth/AccessKeyAuthenticator.java
focal_class.identifier: AccessKeyAuthenticator
focal_class.interfaces: implements Authenticator
focal_class.class_method_signature: AccessKeyAuthenticator.sign(Invocation invocation, URL url)
focal_class.full_signature: @Override public void sign(Invocation invocation, URL url)
focal_class.identifier: sign
focal_class.modifiers: @Override public
focal_class.parameters: (Invocation invocation, URL url)
focal_class.return: void
focal_class.signature: void sign(Invocation invocation, URL url)
focal_class.class_method_signature: AccessKeyAuthenticator.authenticate(Invocation invocation, URL url)
focal_class.full_signature: @Override public void authenticate(Invocation invocation, URL url)
focal_class.identifier: authenticate
focal_class.modifiers: @Override public
focal_class.parameters: (Invocation invocation, URL url)
focal_class.return: void
focal_class.signature: void authenticate(Invocation invocation, URL url)
focal_class.class_method_signature: AccessKeyAuthenticator.getAccessKeyPair(Invocation invocation, URL url)
focal_class.full_signature:  AccessKeyPair getAccessKeyPair(Invocation invocation, URL url)
focal_class.identifier: getAccessKeyPair
focal_class.parameters: (Invocation invocation, URL url)
focal_class.return: AccessKeyPair
focal_class.signature: AccessKeyPair getAccessKeyPair(Invocation invocation, URL url)
focal_class.class_method_signature: AccessKeyAuthenticator.getSignature(URL url, Invocation invocation, String secretKey, String time)
focal_class.full_signature:  String getSignature(URL url, Invocation invocation, String secretKey, String time)
focal_class.identifier: getSignature
focal_class.parameters: (URL url, Invocation invocation, String secretKey, String time)
focal_class.return: String
focal_class.signature: String getSignature(URL url, Invocation invocation, String secretKey, String time)
focal_method.body: @Override
      public void authenticate(Invocation invocation, URL url) throws RpcAuthenticationException {
          String accessKeyId = String.valueOf(invocation.getAttachment(Constants.AK_KEY));
          String requestTimestamp = String.valueOf(invocation.getAttachment(Constants.REQUEST_TIMESTAMP_KEY));
          String originSignature = String.valueOf(invocation.getAttachment(Constants.REQUEST_SIGNATURE_KEY));
          String consumer = String.valueOf(invocation.getAttachment(CommonConstants.CONSUMER));
  
          if (StringUtils.isEmpty(accessKeyId) || StringUtils.isEmpty(consumer)
                  || StringUtils.isEmpty(requestTimestamp) || StringUtils.isEmpty(originSignature)) {
              throw new RpcAuthenticationException("Failed to authenticate, maybe consumer not enable the auth");
          }
          AccessKeyPair accessKeyPair = null;
          try {
              accessKeyPair = getAccessKeyPair(invocation, url);
          } catch (Exception e) {
              throw new RpcAuthenticationException("Failed to authenticate , can't load the accessKeyPair", e);
          }
  
          String computeSignature = getSignature(url, invocation, accessKeyPair.getSecretKey(), requestTimestamp);
          boolean success = computeSignature.equals(originSignature);
          if (!success) {
              throw new RpcAuthenticationException("Failed to authenticate, signature is not correct");
          }
      }
focal_method.class_method_signature: AccessKeyAuthenticator.authenticate(Invocation invocation, URL url)
focal_method.full_signature: @Override public void authenticate(Invocation invocation, URL url)
focal_method.identifier: authenticate
focal_method.invocations: valueOf getAttachment valueOf getAttachment valueOf getAttachment valueOf getAttachment isEmpty isEmpty isEmpty isEmpty getAccessKeyPair getSignature getSecretKey equals
focal_method.modifiers: @Override public
focal_method.parameters: (Invocation invocation, URL url)
focal_method.return: void
focal_method.signature: void authenticate(Invocation invocation, URL url)