Documentation ¶
Overview ¶
Package iapgo helps authenticating access to endpoints behind Google Cloud Identity-Aware Proxy (IAP). It provides a Transport which implements http.RoundTripper.
Example ¶
package main import ( "log" "net/http" "github.com/saifulwebid/iapgo" ) func main() { // Initialize Transport to be used. Define iapClientID with the OAuth Client // ID of the IAP that protects the endpoint. iapClientID := "12345678901-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com" // Upon Transport creation, the service account key will be searched using // Application Default Credentials (ADC) strategy described in // https://cloud.google.com/docs/authentication/production. transport, err := iapgo.NewTransport(iapClientID) if err != nil { log.Fatal(err) } // Pair Transport with an http.Client. client := &http.Client{ Transport: transport, } // Access endpoints behind IAP. client.Get("...") }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport implements http.RoundTripper that can be used to access endpoints behind Google Cloud Identity-Aware Proxy.
func NewTransport ¶
NewTransport returns an initialized Transport. It requires OAuth Client ID of the IAP resource target of the Transport. It finds the service account key using Application Default Credentials (ADC) strategy described in https://cloud.google.com/docs/authentication/production.
Click to show internal directories.
Click to hide internal directories.