Fix provisioner id in LoadByCertificate

This commit is contained in:
Mariano Cano 2019-06-06 15:24:15 -07:00
parent 37dff5124b
commit b88a2f1373

View file

@ -77,7 +77,7 @@ func (c *Collection) LoadByToken(token *jose.JSONWebToken, claims *jose.Claims)
// match with server audiences // match with server audiences
if matchesAudience(claims.Audience, audiences) { if matchesAudience(claims.Audience, audiences) {
// Use fragment to get audiences (GCP) // Use fragment to get audiences (GCP, AWS)
if fragment != "" { if fragment != "" {
return c.Load(fragment) return c.Load(fragment)
} }
@ -107,7 +107,7 @@ func (c *Collection) LoadByToken(token *jose.JSONWebToken, claims *jose.Claims)
return p, ok return p, ok
} }
} }
// Fallback to aud (GCP) // Fallback to aud
return c.Load(payload.Audience[0]) return c.Load(payload.Audience[0])
} }
@ -124,9 +124,9 @@ func (c *Collection) LoadByCertificate(cert *x509.Certificate) (Interface, bool)
case TypeJWK: case TypeJWK:
return c.Load(string(provisioner.Name) + ":" + string(provisioner.CredentialID)) return c.Load(string(provisioner.Name) + ":" + string(provisioner.CredentialID))
case TypeAWS: case TypeAWS:
return c.Load("aws:" + string(provisioner.Name)) return c.Load("aws/" + string(provisioner.Name))
case TypeGCP: case TypeGCP:
return c.Load("gcp:" + string(provisioner.Name)) return c.Load("gcp/" + string(provisioner.Name))
default: default:
return c.Load(string(provisioner.CredentialID)) return c.Load(string(provisioner.CredentialID))
} }