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

feat: add "X-Gnfd-Expires" header #34

Merged
merged 3 commits into from
Jul 24, 2023
Merged

feat: add "X-Gnfd-Expires" header #34

merged 3 commits into from
Jul 24, 2023

Conversation

ruojunm
Copy link
Collaborator

@ruojunm ruojunm commented Jul 24, 2023

Description

feat: add "X-Gnfd-Expires" header and simplify GetMsgToSign

Rationale

Changes

Notable changes:

  • feat: add "X-Gnfd-Expires" header
  • simplify GetMsgToSign
  • add a GetMsgToSignForPreSignedURL method for presignedURL, which will be used for SP getObject API

go/http/const.go Outdated Show resolved Hide resolved
go/http/gen_sign_str.go Outdated Show resolved Hide resolved
@ruojunm ruojunm marked this pull request as ready for review July 24, 2023 11:58
go/http/gen_sign_str.go Outdated Show resolved Hide resolved

// GetMsgToSignForPreSignedURL is only used in SP get Object API. This util method can be used in by SP side and client side to construct the MsgToSign
func GetMsgToSignForPreSignedURL(req *http.Request) []byte {
queryValues := req.URL.Query()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if len(queryValues) == 0 {
	return nil
}

// HTTPHeaderExpiryTimestamp defines the expiry timestamp, which is the ISO 8601 datetime string (e.g. 2021-09-30T16:25:24Z), and the maximum Timestamp since the request sent must be less than MaxExpiryAgeInSec (seven days).
HTTPHeaderExpiryTimestamp = "X-Gnfd-Expiry-Timestamp"
// MaxExpiryAgeInSec
MaxExpiryAgeInSec = 3600 * 24 * 7 // 7 days

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MaxExpiryAgeInSec seems not proper to define here. It is application level param, not suitable on a common lib.

@ruojunm ruojunm merged commit 5a0334d into develop Jul 24, 2023
ruojunm pushed a commit that referenced this pull request Jul 28, 2023
ruojunm pushed a commit that referenced this pull request Jul 28, 2023
ruojunm added a commit that referenced this pull request Aug 30, 2023
* feat: add "X-Gnfd-Expires" header (#34)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants