1
mirror of https://github.com/rclone/rclone synced 2024-11-29 07:55:12 +01:00
rclone/swift/auth.go
2016-02-09 22:17:13 +00:00

31 lines
702 B
Go

package swift
import "github.com/ncw/swift"
// auth is an authenticator for swift
type auth struct {
swift.Authenticator
storageURL string
}
// newAuth creates a swift authenticator wrapper to override the
// StorageUrl method.
func newAuth(Authenticator swift.Authenticator, storageURL string) *auth {
return &auth{
Authenticator: Authenticator,
storageURL: storageURL,
}
}
// The public storage URL - set Internal to true to read
// internal/service net URL
func (a *auth) StorageUrl(Internal bool) string {
if a.storageURL != "" {
return a.storageURL
}
return a.Authenticator.StorageUrl(Internal)
}
// Check the interfaces are satisfied
var _ swift.Authenticator = (*auth)(nil)