Documentation
¶
Overview ¶
Package deviceflow implements the OAuth 2.0 Device Authorization Grant (RFC 8628) for obtaining OIDC identity tokens in headless or constrained-input environments.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TokenGetter ¶
type TokenGetter struct {
// contains filtered or unexported fields
}
TokenGetter fetches an OIDC Identity token using the Device Code Grant flow as specified in RFC8628
func NewTokenGetter ¶
func NewTokenGetter(issuer string, opts ...Option) *TokenGetter
NewTokenGetter creates a new TokenGetter that retrieves an OIDC Identity Token using a Device Code Grant
Example ¶
ExampleNewTokenGetter demonstrates creating a TokenGetter for a given issuer.
package main
import (
"fmt"
"chainguard.dev/sdk/auth/deviceflow"
)
func main() {
tg := deviceflow.NewTokenGetter("https://issuer.enforce.dev")
fmt.Println(tg != nil)
}
Output: true
func (*TokenGetter) CodeURL ¶
func (d *TokenGetter) CodeURL() (string, error)
CodeURL fetches the device authorization endpoint URL from the provider's well-known configuration endpoint
func (*TokenGetter) GetIDToken ¶
func (d *TokenGetter) GetIDToken(p *oidc.Provider, cfg oauth2.Config) (*oauthflow.OIDCIDToken, error)
GetIDToken gets an OIDC ID Token from the specified provider using the device code grant flow