Documentation ¶
Overview ¶
Package IAP provides an oauth2 token source for authenticating with Google Identity Aware Proxy.
Index ¶
Examples ¶
Constants ¶
View Source
const (
// TokenURI is the base uri of google oauth API
TokenURI = "https://www.googleapis.com/oauth2/v4/token"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IAP ¶
type IAP struct {
// contains filtered or unexported fields
}
IAP is an Oauth2 token source for using a Google service account to access services protected by Identity Aware Proxy
func New ¶
New creates an IAP token source. If filename is empty, then attempt to read from environment varible, then wellknown file, then from compute metadata
Example ¶
audience := os.Getenv("AUDIENCE") t, err := New(context.Background(), audience, "") if err != nil { log.Fatalf("failed to create token source: %v", err) } c := oauth2.NewClient(context.Background(), t) _, _ = c.Get("https://my-iap.protected.service")
Output:
type PostFormer ¶
type PostFormer interface {
PostForm(url string, data url.Values) (resp *http.Response, err error)
}
PostFormer issues a POST to the specified URL, with data's keys and values URL-encoded as the request body. See https://golang.org/pkg/net/http/#Client.PostForm
Click to show internal directories.
Click to hide internal directories.