MCPcopy
hub / github.com/smallstep/cli / parseResponse

Function parseResponse

token/parse.go:168–189  ·  view source on GitHub ↗
(jwt *jose.JSONWebToken, p Payload)

Source from the content-addressed store, hash-verified

166}
167
168func parseResponse(jwt *jose.JSONWebToken, p Payload) (*JSONWebToken, error) {
169 switch {
170 case p.Type() == AWS:
171 if err := json.Unmarshal(p.Amazon.Document, &p.Amazon.InstanceIdentityDocument); err != nil {
172 return nil, errors.Wrap(err, "error unmarshaling instance identity document")
173 }
174 case isAzurePayload(p):
175 if re := azureXMSMirIDRegExp.FindStringSubmatch(p.XMSMirID); len(re) > 0 {
176 p.Azure = &AzurePayload{
177 SubscriptionID: re[1],
178 ResourceGroup: re[2],
179 ResourceType: strings.Split(re[3], "/")[1],
180 ResourceName: re[4],
181 }
182 }
183 }
184
185 return &JSONWebToken{
186 JSONWebToken: jwt,
187 Payload: p,
188 }, nil
189}
190
191func isAzurePayload(p Payload) bool {
192 azureTokenIssuerPrefixes := []string{

Callers 2

ParseFunction · 0.85
ParseInsecureFunction · 0.85

Calls 2

isAzurePayloadFunction · 0.85
TypeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…