feat(protocol): include Apollo client identity in session work
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const SchemaSHA256 = "c075c6fc472ce858337c3ad6c4b2f4dcfa88446d5471afb46c2f6931cbcf1b1d"
|
||||
const SchemaSHA256 = "792abfb9cfe70e79911d499d76c009ab848713278bc240b88576df520580e480"
|
||||
const ProtocolVersion = "1.0.0"
|
||||
const CurrentWireVersion = "1"
|
||||
const NMinus1WireVersion = "0"
|
||||
@@ -250,6 +250,7 @@ type ProviderSessionWork struct {
|
||||
ProviderIdentity string `json:"provider_identity"`
|
||||
PolicyVersionID string `json:"policy_version_id"`
|
||||
ApplicationID string `json:"application_id"`
|
||||
ClientID string `json:"client_id"`
|
||||
ManagementHost string `json:"management_host"`
|
||||
ManagementPort int64 `json:"management_port"`
|
||||
StreamHost string `json:"stream_host"`
|
||||
@@ -3009,6 +3010,15 @@ func (v ProviderSessionWork) Validate() error {
|
||||
if len(v.ApplicationID) > 128 {
|
||||
violations = append(violations, FieldViolation{Field: "application_id", Code: "max_length"})
|
||||
}
|
||||
if v.ClientID == "" {
|
||||
violations = append(violations, FieldViolation{Field: "client_id", Code: "required"})
|
||||
}
|
||||
if len(v.ClientID) < 1 && v.ClientID != "" {
|
||||
violations = append(violations, FieldViolation{Field: "client_id", Code: "min_length"})
|
||||
}
|
||||
if len(v.ClientID) > 128 {
|
||||
violations = append(violations, FieldViolation{Field: "client_id", Code: "max_length"})
|
||||
}
|
||||
if v.ManagementHost == "" {
|
||||
violations = append(violations, FieldViolation{Field: "management_host", Code: "required"})
|
||||
}
|
||||
@@ -3093,6 +3103,9 @@ func DecodeProviderSessionWork(data []byte) (ProviderSessionWork, error) {
|
||||
if raw, ok := fields["client_certificate_pem"]; !ok || bytes.Equal(bytes.TrimSpace(raw), []byte("null")) {
|
||||
return value, ValidationError{Violations: []FieldViolation{{Field: "client_certificate_pem", Code: "required"}}}
|
||||
}
|
||||
if raw, ok := fields["client_id"]; !ok || bytes.Equal(bytes.TrimSpace(raw), []byte("null")) {
|
||||
return value, ValidationError{Violations: []FieldViolation{{Field: "client_id", Code: "required"}}}
|
||||
}
|
||||
if raw, ok := fields["client_private_key_pem"]; !ok || bytes.Equal(bytes.TrimSpace(raw), []byte("null")) {
|
||||
return value, ValidationError{Violations: []FieldViolation{{Field: "client_private_key_pem", Code: "required"}}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user