Details
-
Improvement
-
Resolution: Fixed
-
Medium
-
0.33
-
None
-
true
Description
A common pattern in trusted app clients is:
EncryptedCertificate cert = trustedApplicationsManager.getCurrentApplication().encode(user.getName()); request.addRequestHeader(CurrentApplication.HEADER_TRUSTED_APP_ID, cert.getID()); request.addRequestHeader(CurrentApplication.HEADER_TRUSTED_APP_CERT, cert.getCertificate()); request.addRequestHeader(CurrentApplication.HEADER_TRUSTED_APP_SECRET_KEY, cert.getSecretKey());
while we don't want to make Seraph depend on HttpClient, there's no need for clients to know this many details of the headers. We should have:
Map<String,String> trustHeaders = <something>.getHttpHeaders(cert);
// add the headers in whatever manner your HTTP client requires...
We could add this method to CurrentApplication and just pass the user, although that clutters the interface with HTTP specific assumptions....