I'm getting ApexSuggestUsingNamedCred
**Suggest named credentials for authentication**
in Below Code.
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
system.debug('Encoder Value' + EncodingUtil.base64Encode(headerValue));
http http = new http();
httpRequest request = new httpRequest();
request.setMethod('POST');
request.setEndpoint(endpoint);
request.setHeader('Content-Type', 'application/x-www-form-urlencoded');
request.setHeader('Authorization', authorizationHeader);
There is no hard Coded value in My code, username
and password
is the input parameter for this method.
request.setHeader('Authorization', authorizationHeader);
--> In Apex PMD report, Secutiry issue showing in this line.
Gone through this link, still can't able to find the cause. https://pmd.github.io/latest/pmd_rules_apex_security.html#apexsuggestusingnamedcred