openai/openai-go

Public

mirrored from https://github.com/openai/openai-goAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
main

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

auth/types.go

37lines · modecode

1package auth
2
3import (
4 "context"
5 "net/http"
6)
7
8type HTTPDoer interface {
9 Do(*http.Request) (*http.Response, error)
10}
11
12type SubjectTokenType string
13
14const (
15 SubjectTokenTypeJWT SubjectTokenType = "jwt"
16 SubjectTokenTypeID SubjectTokenType = "id"
17)
18
19type SubjectTokenProvider interface {
20 TokenType() SubjectTokenType
21 GetToken(ctx context.Context, httpClient HTTPDoer) (string, error)
22}
23
24type WorkloadIdentity struct {
25 ClientID string
26 IdentityProviderID string
27 ServiceAccountID string
28 Provider SubjectTokenProvider
29 RefreshBufferSeconds int
30}
31
32type TokenExchangeResponse struct {
33 AccessToken string `json:"access_token"`
34 IssuedTokenType string `json:"issued_token_type"`
35 TokenType string `json:"token_type"`
36 ExpiresIn *int `json:"expires_in,omitempty"`
37}
38