forked from remote/oauth2
google/externalaccount: moves externalaccount package out of internal and exports it
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>
This commit is contained in:
21
google/externalaccount/programmaticrefreshcredsource.go
Normal file
21
google/externalaccount/programmaticrefreshcredsource.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// 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)
|
||||
}
|
||||
Reference in New Issue
Block a user