Issue 3373: JWTConfigFromJSON method with imersonate feature
Status:  Invalid
Owner: ----
Closed:  May 2015
Reported by mich...@soffex.co.za, May 16, 2015
Please consider adding this method to impersonate a user from a service account


// JWTConfigFromJSONWithImpersonate uses a Google Developers service account JSON key file to read
// the credentials that authorize and authenticate the requests with the ability to impersonate a user.
// Create a service account on "Credentials" page under "APIs & Auth" for your
// project at https://console.developers.google.com to download a JSON key file.
func JWTConfigFromJSONWithImpersonate(jsonKey []byte, usersEmail string, scope ...string) (*jwt.Config, error) {
	var key struct {
		Email      string `json:"client_email"`
		PrivateKey string `json:"private_key"`
	}
	if err := json.Unmarshal(jsonKey, &key); err != nil {
		return nil, err
	}
	return &jwt.Config{
		Email:      key.Email,
		PrivateKey: []byte(key.PrivateKey),
		Subject:    usersEmail,
		Scopes:     scope,
		TokenURL:   JWTTokenURL,
	}, nil
}
google.go
5.6 KB   Download
May 18, 2015
Project Member #1 david.pu...@sonymobile.com
*****************************************************************
*****                                                       *****
***** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!!  *****
*****                                                       *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, CYANOGENMOD,  *****
***** INTERNAL ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.*****
*****                                                       *****
*****   THOSE ISSUES BELONG IN DIFFERENT ISSUE TRACKERS     *****
*****                                                       *****
*****************************************************************
Status: Invalid