hygieia / api

Hygieia api layer (pre Spring 5)
https://github.com/Hygieia/api
Apache License 2.0
19 stars 180 forks source link

/encrypt api is not working #24

Closed saurabhvaj closed 5 years ago

saurabhvaj commented 5 years ago
Screenshot 2019-08-28 at 4 04 55 PM

Not really a java person but, the above /encrypt is not working for me. Only an ERROR msg comes as a response. In order, I'm not able to add my bitbucket repo in the widget, because it saves passwords in an encrypted format.

My api.properties file is:

dbname=dashboard
server.contextPath=/api 
server.port=8080 
auth.expirationTime=10000
key=8jh6HIBi7AHav/5u+zjLDhZKC4/QMurx

Also when I dig a bit in code the below code from ./java/com/capitalone/dashboard/service/EncryptionServiceImpl.java is responsible for encryption.

public String encrypt(String message) {
        String key = apiSettings.getKey();
        String returnString = "ERROR";
        if (!"".equals(key)) {
            try {
                returnString = Encryption.encryptString(message, key);
            } catch (EncryptionException ignored) {
                LOGGER.debug("Caught encryption exception", ignored);
            }
        }
        return returnString;

which imports packages. import com.capitalone.dashboard.util.Encryption; import com.capitalone.dashboard.util.EncryptionException;

I'm not able to find these. Let me know if I'm running in the wrong direction. Trying to integrate bitbucket cloud with hygieia.

saurabhvaj commented 5 years ago

I'm able to resolve this, and found that api code is not able to get properties from an external file. Once I embedded the properties inside the jar, this starts working. But I think error msg should be more informative in this case.