Documentation
¶
Index ¶
- type StringSlice
- type Time
- type TokenContext
- func (t TokenContext) GetAudience() (jwt.ClaimStrings, error)
- func (t TokenContext) GetExpirationTime() (*jwt.NumericDate, error)
- func (t TokenContext) GetIssuedAt() (*jwt.NumericDate, error)
- func (t TokenContext) GetIssuer() (string, error)
- func (t TokenContext) GetNotBefore() (*jwt.NumericDate, error)
- func (t TokenContext) GetSubject() (string, error)
- type TokenService
- func (t *TokenService) AuthenticateRequest(req *http.Request) (*authenticator.Response, bool, error)
- func (t *TokenService) DecodeToken(ctx context.Context, token string) (*TokenContext, error)
- func (t *TokenService) EnsureJWK(ctx context.Context) error
- func (t *TokenService) NewToken(ctx context.Context, context TokenContext) (*jwt.Token, string, error)
- func (t *TokenService) ReplaceJWK(req api.Context) error
- func (t *TokenService) ServeJWKS(api api.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StringSlice ¶ added in v0.24.0
type StringSlice []string
func (StringSlice) MarshalJSON ¶ added in v0.24.0
func (s StringSlice) MarshalJSON() ([]byte, error)
func (*StringSlice) UnmarshalJSON ¶ added in v0.24.0
func (s *StringSlice) UnmarshalJSON(data []byte) error
type Time ¶ added in v0.24.0
func (Time) MarshalJSON ¶ added in v0.24.0
func (*Time) UnmarshalJSON ¶ added in v0.24.0
type TokenContext ¶
type TokenContext struct {
Issuer string `json:"iss"`
Audience string `json:"aud"`
IssuedAt Time `json:"iat"`
ExpiresAt Time `json:"exp"`
UserID string `json:"sub"`
UserName string `json:"name"`
UserEmail string `json:"email"`
OAuthScope string `json:"scope"`
Picture string `json:"picture"`
UserGroups StringSlice
AuthProviderName string
AuthProviderNamespace string
AuthProviderUserID string
MCPID string
// This is used for requesting community license
InstallationID string `json:"installation_id,omitempty"`
// The following fields are for runs
Namespace string
ModelProvider string
Model string
}
func (TokenContext) GetAudience ¶ added in v0.24.0
func (t TokenContext) GetAudience() (jwt.ClaimStrings, error)
func (TokenContext) GetExpirationTime ¶ added in v0.24.0
func (t TokenContext) GetExpirationTime() (*jwt.NumericDate, error)
GetExpirationTime implements the Claims interface.
func (TokenContext) GetIssuedAt ¶ added in v0.24.0
func (t TokenContext) GetIssuedAt() (*jwt.NumericDate, error)
GetIssuedAt implements the Claims interface.
func (TokenContext) GetIssuer ¶ added in v0.24.0
func (t TokenContext) GetIssuer() (string, error)
GetIssuer implements the Claims interface.
func (TokenContext) GetNotBefore ¶ added in v0.24.0
func (t TokenContext) GetNotBefore() (*jwt.NumericDate, error)
GetNotBefore implements the Claims interface.
func (TokenContext) GetSubject ¶ added in v0.24.0
func (t TokenContext) GetSubject() (string, error)
GetSubject implements the Claims interface.
type TokenService ¶
type TokenService struct {
// contains filtered or unexported fields
}
func NewTokenService ¶
func NewTokenService(serverURL string, gatewayClient *client.Client) (*TokenService, error)
func (*TokenService) AuthenticateRequest ¶
func (t *TokenService) AuthenticateRequest(req *http.Request) (*authenticator.Response, bool, error)
func (*TokenService) DecodeToken ¶ added in v0.15.0
func (t *TokenService) DecodeToken(ctx context.Context, token string) (*TokenContext, error)
func (*TokenService) EnsureJWK ¶ added in v0.15.0
func (t *TokenService) EnsureJWK(ctx context.Context) error
EnsureJWK ensures that the JWK is created and stored. It should only be called in a controller post-start hook which only allows one to be run at a time.
func (*TokenService) NewToken ¶
func (t *TokenService) NewToken(ctx context.Context, context TokenContext) (*jwt.Token, string, error)
func (*TokenService) ReplaceJWK ¶
func (t *TokenService) ReplaceJWK(req api.Context) error
Click to show internal directories.
Click to hide internal directories.