Skip to content

Commit

Permalink
Merge pull request #1357 from gibmat/client-add-getoidctokens
Browse files Browse the repository at this point in the history
Add a GetOIDCTokens() method
  • Loading branch information
stgraber authored Nov 6, 2024
2 parents 8082084 + c636e56 commit 40d3bfa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/incus_oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ func (r *ProtocolIncus) setupOIDCClient(token *oidc.Tokens[*oidc.IDTokenClaims])
r.oidcClient.httpClient = r.http
}

// GetOIDCTokens returns the current OIDC tokens (if any) from the OIDC client.
//
// This should only be used by internal Incus tools when it's not possible to get the tokens from a Config struct.
func (r *ProtocolIncus) GetOIDCTokens() *oidc.Tokens[*oidc.IDTokenClaims] {
if r.oidcClient == nil {
return nil
}

return r.oidcClient.tokens
}

// Custom transport that modifies requests to inject the audience field.
type oidcTransport struct {
deviceAuthorizationEndpoint string
Expand Down

0 comments on commit 40d3bfa

Please sign in to comment.