@Override
    public void doInject(RequestResource resource, RamContext context, LoginIdentityContext result) {
        String accessKey = context.getAccessKey();
        String secretKey = context.getSecretKey();
        // STS 临时凭证鉴权的优先级高于 AK/SK 鉴权
        if (StsConfig.getInstance().isStsOn()) {
            StsCredential stsCredential = StsCredentialHolder.getInstance().getStsCredential();
            accessKey = stsCredential.getAccessKeyId();
            secretKey = stsCredential.getAccessKeySecret();
            result.setParameter(IdentifyConstants.SECURITY_TOKEN_HEADER, stsCredential.getSecurityToken());
        }
        
        if (StringUtils.isNotEmpty(accessKey) && StringUtils.isNotBlank(secretKey)) {
            result.setParameter(ACCESS_KEY_HEADER, accessKey);
        }
        String signatureKey = secretKey;
        if (StringUtils.isNotEmpty(context.getRegionId())) {
            signatureKey = CalculateV4SigningKeyUtil
                    .finalSigningKeyStringWithDefaultInfo(secretKey, context.getRegionId());
            result.setParameter(RamConstants.SIGNATURE_VERSION, RamConstants.V4);
        }
        Map<String, String> signHeaders = SpasAdapter
                .getSignHeaders(getResource(resource.getNamespace(), resource.getGroup()), signatureKey);
        result.setParameters(signHeaders);
    }
@Test
    void testDoInjectWithoutResource() throws Exception {
        resource = new RequestResource();
        LoginIdentityContext actual = new LoginIdentityContext();
        configResourceInjector.doInject(resource, ramContext, actual);
        assertEquals(3, actual.getAllKey().size());
        assertEquals(PropertyKeyConst.ACCESS_KEY, actual.getParameter("Spas-AccessKey"));
        assertTrue(actual.getAllKey().contains("Timestamp"));
        assertTrue(actual.getAllKey().contains("Spas-Signature"));
    }