Fix load of gcp and aws provisioner by certificate.

This commit is contained in:
Mariano Cano 2019-04-24 14:49:28 -07:00
parent da93e40f90
commit a7f06c765d

View file

@ -93,8 +93,13 @@ func (c *Collection) LoadByCertificate(cert *x509.Certificate) (Interface, bool)
if _, err := asn1.Unmarshal(e.Value, &provisioner); err != nil {
return nil, false
}
if provisioner.Type == int(TypeJWK) {
switch Type(provisioner.Type) {
case TypeJWK:
return c.Load(string(provisioner.Name) + ":" + string(provisioner.CredentialID))
case TypeAWS:
return c.Load("aws:" + string(provisioner.Name))
case TypeGCP:
return c.Load("gcp:" + string(provisioner.Name))
}
return c.Load(string(provisioner.CredentialID))
}