mirror of
https://github.com/golang/oauth2.git
synced 2025-07-21 00:00:09 +08:00
go/programmable-auth-design for context. Adds support for user defined supplier methods to return subject tokens and AWS security credentials. Change-Id: I7bc41f8c5202ae933fce516632f5049bbeb3d378 GitHub-Last-Rev: ac519b242f8315df572f1b205b0670f139bfc6c3 GitHub-Pull-Request: golang/oauth2#690 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/550835 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Leo Siracusa <leosiracusa@google.com> Reviewed-by: Chris Smith <chrisdsmith@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cody Oss <codyoss@google.com>
22 lines
633 B
Go
22 lines
633 B
Go
// Copyright 2024 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package externalaccount
|
|
|
|
import "context"
|
|
|
|
type programmaticRefreshCredentialSource struct {
|
|
supplierOptions SupplierOptions
|
|
subjectTokenSupplier SubjectTokenSupplier
|
|
ctx context.Context
|
|
}
|
|
|
|
func (cs programmaticRefreshCredentialSource) credentialSourceType() string {
|
|
return "programmatic"
|
|
}
|
|
|
|
func (cs programmaticRefreshCredentialSource) subjectToken() (string, error) {
|
|
return cs.subjectTokenSupplier.SubjectToken(cs.ctx, cs.supplierOptions)
|
|
}
|