diff --git a/api/auth/center.go b/api/auth/center.go index f9099517..3dccb295 100644 --- a/api/auth/center.go +++ b/api/auth/center.go @@ -20,7 +20,8 @@ import ( "go.uber.org/zap" ) -var authorizationFieldRegexp = regexp.MustCompile(`AWS4-HMAC-SHA256 Credential=(?P[^/]+)_(?P[^/]+)/(?P[^/]+)/(?P[^/]*)/(?P[^/]+)/aws4_request,\s*SignedHeaders=(?P.+),\s*Signature=(?P.+)`) +// authorizationFieldRegexp -- is regexp for credentials with Base58 encoded cid and oid and '0' (zero) as delimiter. +var authorizationFieldRegexp = regexp.MustCompile(`AWS4-HMAC-SHA256 Credential=(?P[^/]+)0(?P[^/]+)/(?P[^/]+)/(?P[^/]*)/(?P[^/]+)/aws4_request,\s*SignedHeaders=(?P.+),\s*Signature=(?P.+)`) type ( // Center is a user authentication interface. @@ -89,7 +90,7 @@ func (c *center) Authenticate(r *http.Request) (*accessbox.GateData, error) { return nil, fmt.Errorf("failed to parse x-amz-date header field: %w", err) } - accessKeyID := fmt.Sprintf("%s_%s", sms1["access_key_id_cid"], sms1["access_key_id_oid"]) + accessKeyID := fmt.Sprintf("%s0%s", sms1["access_key_id_cid"], sms1["access_key_id_oid"]) accessKeyAddress := fmt.Sprintf("%s/%s", sms1["access_key_id_cid"], sms1["access_key_id_oid"]) address := object.NewAddress() diff --git a/authmate/authmate.go b/authmate/authmate.go index 58ab058f..510caacd 100644 --- a/authmate/authmate.go +++ b/authmate/authmate.go @@ -179,7 +179,7 @@ func (a *Agent) IssueSecret(ctx context.Context, w io.Writer, options *IssueSecr return fmt.Errorf("failed to put bearer token: %w", err) } - accessKeyID := address.ContainerID().String() + "_" + address.ObjectID().String() + accessKeyID := address.ContainerID().String() + "0" + address.ObjectID().String() ir := &issuingResult{ AccessKeyID: accessKeyID,