mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-10-19 05:39:51 +00:00
d68769f39d
Bumps the github-dependencies group with 3 updates: [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go), [github.com/aws/aws-sdk-go-v2/service/sts](https://github.com/aws/aws-sdk-go-v2) and [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo). Updates `github.com/aws/aws-sdk-go` from 1.48.5 to 1.48.12 - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.48.5...v1.48.12) Updates `github.com/aws/aws-sdk-go-v2/service/sts` from 1.25.4 to 1.26.2 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/config/v1.25.4...service/s3/v1.26.2) Updates `github.com/onsi/ginkgo/v2` from 2.13.1 to 2.13.2 - [Release notes](https://github.com/onsi/ginkgo/releases) - [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/ginkgo/compare/v2.13.1...v2.13.2) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-dependencies - dependency-name: github.com/aws/aws-sdk-go-v2/service/sts dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-dependencies - dependency-name: github.com/onsi/ginkgo/v2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package smithy
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/aws/smithy-go"
|
|
"github.com/aws/smithy-go/auth"
|
|
"github.com/aws/smithy-go/auth/bearer"
|
|
)
|
|
|
|
// BearerTokenAdapter adapts smithy bearer.Token to smithy auth.Identity.
|
|
type BearerTokenAdapter struct {
|
|
Token bearer.Token
|
|
}
|
|
|
|
var _ auth.Identity = (*BearerTokenAdapter)(nil)
|
|
|
|
// Expiration returns the time of expiration for the token.
|
|
func (v *BearerTokenAdapter) Expiration() time.Time {
|
|
return v.Token.Expires
|
|
}
|
|
|
|
// BearerTokenProviderAdapter adapts smithy bearer.TokenProvider to smithy
|
|
// auth.IdentityResolver.
|
|
type BearerTokenProviderAdapter struct {
|
|
Provider bearer.TokenProvider
|
|
}
|
|
|
|
var _ (auth.IdentityResolver) = (*BearerTokenProviderAdapter)(nil)
|
|
|
|
// GetIdentity retrieves a bearer token using the underlying provider.
|
|
func (v *BearerTokenProviderAdapter) GetIdentity(ctx context.Context, _ smithy.Properties) (
|
|
auth.Identity, error,
|
|
) {
|
|
token, err := v.Provider.RetrieveBearerToken(ctx)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("get token: %w", err)
|
|
}
|
|
|
|
return &BearerTokenAdapter{Token: token}, nil
|
|
}
|