mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Simplify the steps to make changes to config.json (#5186)
This change introduces following simplified steps to follow during config migration. ``` // Steps to move from version N to version N+1 // 1. Add new struct serverConfigVN+1 in config-versions.go // 2. Set configCurrentVersion to "N+1" // 3. Set serverConfigCurrent to serverConfigVN+1 // 4. Add new migration function (ex. func migrateVNToVN+1()) in config-migrate.go // 5. Call migrateVNToVN+1() from migrateConfig() in config-migrate.go // 6. Make changes in config-current_test.go for any test change ```
This commit is contained in:
committed by
Harshavardhana
parent
98d07210e7
commit
14e6c5ec08
@@ -64,7 +64,7 @@ var resourceList = []string{
|
||||
}
|
||||
|
||||
func doesPolicySignatureV2Match(formValues http.Header) APIErrorCode {
|
||||
cred := serverConfig.GetCredential()
|
||||
cred := globalServerConfig.GetCredential()
|
||||
accessKey := formValues.Get("AWSAccessKeyId")
|
||||
if accessKey != cred.AccessKey {
|
||||
return ErrInvalidAccessKeyID
|
||||
@@ -96,7 +96,7 @@ func unescapeQueries(encodedQuery string) (unescapedQueries []string, err error)
|
||||
// returns ErrNone if matches. S3 errors otherwise.
|
||||
func doesPresignV2SignatureMatch(r *http.Request) APIErrorCode {
|
||||
// Access credentials.
|
||||
cred := serverConfig.GetCredential()
|
||||
cred := globalServerConfig.GetCredential()
|
||||
|
||||
// r.RequestURI will have raw encoded URI as sent by the client.
|
||||
tokens := strings.SplitN(r.RequestURI, "?", 2)
|
||||
@@ -213,7 +213,7 @@ func validateV2AuthHeader(v2Auth string) APIErrorCode {
|
||||
}
|
||||
|
||||
// Access credentials.
|
||||
cred := serverConfig.GetCredential()
|
||||
cred := globalServerConfig.GetCredential()
|
||||
if keySignFields[0] != cred.AccessKey {
|
||||
return ErrInvalidAccessKeyID
|
||||
}
|
||||
@@ -263,14 +263,14 @@ func calculateSignatureV2(stringToSign string, secret string) string {
|
||||
|
||||
// Return signature-v2 for the presigned request.
|
||||
func preSignatureV2(method string, encodedResource string, encodedQuery string, headers http.Header, expires string) string {
|
||||
cred := serverConfig.GetCredential()
|
||||
cred := globalServerConfig.GetCredential()
|
||||
stringToSign := getStringToSignV2(method, encodedResource, encodedQuery, headers, expires)
|
||||
return calculateSignatureV2(stringToSign, cred.SecretKey)
|
||||
}
|
||||
|
||||
// Return signature-v2 authrization header.
|
||||
func signatureV2(method string, encodedResource string, encodedQuery string, headers http.Header) string {
|
||||
cred := serverConfig.GetCredential()
|
||||
cred := globalServerConfig.GetCredential()
|
||||
stringToSign := getStringToSignV2(method, encodedResource, encodedQuery, headers, "")
|
||||
signature := calculateSignatureV2(stringToSign, cred.SecretKey)
|
||||
return fmt.Sprintf("%s %s:%s", signV2Algorithm, cred.AccessKey, signature)
|
||||
|
||||
Reference in New Issue
Block a user