Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use seconds as unit for transfer token ttl #1924

Merged
merged 1 commit into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/grpc/services/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ func (c *config) init() {
// use shared secret if not set
c.TransferSharedSecret = sharedconf.GetJWTSecret(c.TransferSharedSecret)

// if the transfer does not start in the next 10 seconds the session is expired.
// lifetime for the transfer token (TUS upload)
if c.TransferExpires == 0 {
c.TransferExpires = 10
c.TransferExpires = 100 * 60 // seconds
}
}

Expand Down
3 changes: 1 addition & 2 deletions internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ type transferClaims struct {
func (s *svc) sign(_ context.Context, target string) (string, error) {
// Tus sends a separate request to the datagateway service for every chunk.
// For large files, this can take a long time, so we extend the expiration
// for 10 minutes. TODO: Make this configurable.
ttl := time.Duration(s.c.TransferExpires) * 10 * time.Minute
ttl := time.Duration(s.c.TransferExpires) * time.Second
claims := transferClaims{
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(ttl).Unix(),
Expand Down