NoSprawl / Dashboard

NoSprawl Web Application
0 stars 0 forks source link

AWS addon is designed to be used with only one secret key/access code combo #13

Open mkeen opened 9 years ago

mkeen commented 9 years ago

We need a clean way of having each Integration have its own key info. The same problem will present itself with the rackspace API. All of these systems are designed to hold credential info for a single API user, not many.

nicdev commented 9 years ago

I can implement this, or you can look how I solved a similar issue here. Import Guzzle (already installed in our app), instantiate it in __construct(), then create a connect() method.

Use setters and getters in your model to keep the credentials encrypted and stored in DB.

public function getAwsKeyAttribute($value) {
        return $value ? Crypt::decrypt($value) : null;
    }

    public function getAwsSecretAttribute($value) {
        return $value ? Crypt::decrypt($value) : null;
    }

    public function setKeyAttribute($value) {
        $this->attributes['key'] = Crypt::encrypt($value);
    }

    public function setSecretAttribute($value) {
        $this->attributes['secret'] = Crypt::encrypt($value);
    }