forked from TrueCloudLab/rclone
vendor: update github.com/ncw/swift to bring in Expires changes
This commit is contained in:
parent
bb80586473
commit
595fea757d
9 changed files with 55 additions and 13 deletions
15
vendor/github.com/ncw/swift/auth.go
generated
vendored
15
vendor/github.com/ncw/swift/auth.go
generated
vendored
|
@ -6,6 +6,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Auth defines the operations needed to authenticate with swift
|
||||
|
@ -25,6 +26,11 @@ type Authenticator interface {
|
|||
CdnUrl() string
|
||||
}
|
||||
|
||||
// Expireser is an optional interface to read the expiration time of the token
|
||||
type Expireser interface {
|
||||
Expires() time.Time
|
||||
}
|
||||
|
||||
type CustomEndpointAuthenticator interface {
|
||||
StorageUrlForEndpoint(endpointType EndpointType) string
|
||||
}
|
||||
|
@ -240,6 +246,15 @@ func (auth *v2Auth) Token() string {
|
|||
return auth.Auth.Access.Token.Id
|
||||
}
|
||||
|
||||
// v2 Authentication - read expires
|
||||
func (auth *v2Auth) Expires() time.Time {
|
||||
t, err := time.Parse(time.RFC3339, auth.Auth.Access.Token.Expires)
|
||||
if err != nil {
|
||||
return time.Time{} // return Zero if not parsed
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
// v2 Authentication - read cdn url
|
||||
func (auth *v2Auth) CdnUrl() string {
|
||||
return auth.endpointUrl("rax:object-cdn", EndpointTypePublic)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue