Update dependencies

This commit is contained in:
Alexander Neumann committed 2019-04-24 15:17:48 +02:00
1 parent c7762453cf
commit ca8c3b4fd5
286 files changed
+28157 -15885

No files matched your search

+15
View File
@@ -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)