Skip to content

Commit

Permalink
Merge pull request 99designs#283 from amitsaha/iam_info_handler
Browse files Browse the repository at this point in the history
Add handler for iam/info
  • Loading branch information
mtibben authored Sep 2, 2018
2 parents 77088c6 + 3e646ab commit 8d5e891
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ func StartMetadataServer() error {
router.HandleFunc("/latest/meta-data/iam/security-credentials/local-credentials", credentialsHandler)
// The AWS Go SDK checks the instance-id endpoint to validate the existence of EC2 Metadata
router.HandleFunc("/latest/meta-data/instance-id/", instanceIdHandler)
// The AWS .NET SDK checks this endpoint during obtaining credentials/refreshing them
router.HandleFunc("/latest/meta-data/iam/info/", infoHandlerStub)

l, err := net.Listen("tcp", metadataBind)
if err != nil {
Expand All @@ -47,6 +49,10 @@ type metadataHandler struct {
http.Handler
}

func infoHandlerStub(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, `{"Code" : "Success"}`)
}

func indexHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "local-credentials")
}
Expand Down

0 comments on commit 8d5e891

Please sign in to comment.