From 9137eb2885c6a3778769cf1acabb78fb73ad7062 Mon Sep 17 00:00:00 2001 From: Cuong Nguyen Date: Wed, 31 Jul 2024 12:14:58 +0200 Subject: [PATCH 1/2] add attributes to LocalUser model. Add DisableRdpCertAuth to ManagedAccount model --- api/secretsmanager/model.go | 71 +++++++++++++++++++------------------ api/userstore/model.go | 41 ++++++++++++--------- 2 files changed, 61 insertions(+), 51 deletions(-) diff --git a/api/secretsmanager/model.go b/api/secretsmanager/model.go index fe2d505..07cc5a5 100644 --- a/api/secretsmanager/model.go +++ b/api/secretsmanager/model.go @@ -148,29 +148,30 @@ type ScannedAccountEditBatch struct { } type ManagedAccount struct { - ID string `json:"id"` - Username string `json:"username"` - Email string `json:"email,omitempty"` - FullName string `json:"full_name,omitempty"` - SourceID string `json:"source_id,omitempty"` - SecurityID string `json:"security_id,omitempty"` - AdditionalData map[string]string `json:"additional_data,omitempty"` - TargetDomain TargetDomainHandle `json:"target_domain"` - PasswordPolicy *PasswordPolicyHandle `json:"password_policy,omitempty"` - Enabled bool `json:"enabled"` - RotationEnabled bool `json:"rotation_enabled"` - ExplicitCheckout bool `json:"explicit_checkout"` - State string `json:"state"` - Comment string `json:"comment,omitempty"` - SecretName string `json:"secret_name,omitempty"` - Locked bool `json:"locked"` - LockedTimestamp *time.Time `json:"locked_timestamp,omitempty"` - RotationHistory []SecretRotationEvent `json:"rotation_history,omitempty"` - SecretCheckouts []SecretCheckout `json:"checkouts,omitempty"` - Created time.Time `json:"created,omitempty"` - Author string `json:"author,omitempty"` - Updated *time.Time `json:"updated,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` + ID string `json:"id"` + Username string `json:"username"` + Email string `json:"email,omitempty"` + FullName string `json:"full_name,omitempty"` + SourceID string `json:"source_id,omitempty"` + SecurityID string `json:"security_id,omitempty"` + AdditionalData map[string]string `json:"additional_data,omitempty"` + TargetDomain TargetDomainHandle `json:"target_domain"` + PasswordPolicy *PasswordPolicyHandle `json:"password_policy,omitempty"` + Enabled bool `json:"enabled"` + RotationEnabled bool `json:"rotation_enabled"` + ExplicitCheckout bool `json:"explicit_checkout"` + State string `json:"state"` + Comment string `json:"comment,omitempty"` + SecretName string `json:"secret_name,omitempty"` + Locked bool `json:"locked"` + LockedTimestamp *time.Time `json:"locked_timestamp,omitempty"` + RotationHistory []SecretRotationEvent `json:"rotation_history,omitempty"` + SecretCheckouts []SecretCheckout `json:"checkouts,omitempty"` + Created time.Time `json:"created,omitempty"` + Author string `json:"author,omitempty"` + Updated *time.Time `json:"updated,omitempty"` + UpdatedBy string `json:"updated_by,omitempty"` + DisableRdpCertAuth bool `json:"disable_rdp_cert_auth"` } type SecretRotationEvent struct { @@ -226,12 +227,13 @@ type ManagedAccountCreateBatch struct { } type ManagedAccountCreateData struct { - Enabled bool `json:"enabled"` - RotationEnabled bool `json:"rotation_enabled"` - Rotate bool `json:"rotate"` - ExplicitCheckout bool `json:"explicit_checkout"` - PasswordPolicy PasswordPolicyHandle `json:"password_policy,omitempty"` - Comment string `json:"comment,omitempty"` + Enabled bool `json:"enabled"` + RotationEnabled bool `json:"rotation_enabled"` + Rotate bool `json:"rotate"` + ExplicitCheckout bool `json:"explicit_checkout"` + DisableRdpCertAuth bool `json:"disable_rdp_cert_auth"` + PasswordPolicy PasswordPolicyHandle `json:"password_policy,omitempty"` + Comment string `json:"comment,omitempty"` } type ManagedAccountEditBatch struct { @@ -240,11 +242,12 @@ type ManagedAccountEditBatch struct { } type ManagedAccountChangeSet struct { - Enabled *bool `json:"enabled"` - RotationEnabled *bool `json:"rotation_enabled"` - ExplicitCheckout *bool `json:"explicit_checkout"` - PasswordPolicy *PasswordPolicyHandle `json:"password_policy,omitempty"` - Comment *string `json:"comment,omitempty"` + Enabled *bool `json:"enabled"` + RotationEnabled *bool `json:"rotation_enabled"` + ExplicitCheckout *bool `json:"explicit_checkout"` + DisableRdpCertAuth *bool `json:"disable_rdp_cert_auth"` + PasswordPolicy *PasswordPolicyHandle `json:"password_policy,omitempty"` + Comment *string `json:"comment,omitempty"` } type ManagedAccountBatch struct { diff --git a/api/userstore/model.go b/api/userstore/model.go index 723a27c..b1960da 100644 --- a/api/userstore/model.go +++ b/api/userstore/model.go @@ -90,23 +90,30 @@ type APIClient struct { // LocalUser definition type LocalUser struct { - ID string `json:"id,omitempty"` - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - Author string `json:"author,omitempty"` - Comment string `json:"comment,omitempty"` - Tags []string `json:"tags,omitempty"` - Username string `json:"username,omitempty"` - GivenName string `json:"given_name,omitempty"` - FullName string `json:"full_name,omitempty"` - JobTitle string `json:"job_title,omitempty"` - Company string `json:"company,omitempty"` - Department string `json:"department,omitempty"` - Email string `json:"email,omitempty"` - Telephone string `json:"telephone,omitempty"` - Locale string `json:"locale,omitempty"` - Password Password `json:"password,omitempty"` + ID string `json:"id,omitempty"` + Created string `json:"created,omitempty"` + Updated string `json:"updated,omitempty"` + UpdatedBy string `json:"updated_by,omitempty"` + Author string `json:"author,omitempty"` + Comment string `json:"comment,omitempty"` + Tags []string `json:"tags,omitempty"` + Username string `json:"username,omitempty"` + GivenName string `json:"given_name,omitempty"` + FullName string `json:"full_name,omitempty"` + JobTitle string `json:"job_title,omitempty"` + Company string `json:"company,omitempty"` + Department string `json:"department,omitempty"` + Email string `json:"email,omitempty"` + Telephone string `json:"telephone,omitempty"` + Locale string `json:"locale,omitempty"` + Password Password `json:"password,omitempty"` + Attributes []Attribute `json:"attributes,omitempty"` +} + +// User attribute +type Attribute struct { + Key string `json:"key"` + Value string `json:"value"` } // Password definition From d2bbbc56a19775ffccfe21572a65f8171fda132c Mon Sep 17 00:00:00 2001 From: Ilja <47740286+iljaSL@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:25:59 +0300 Subject: [PATCH 2/2] fix: add missing fields to structs (#157) * fix: add missing fields to structs * fix: github workflow --- .github/workflows/go.yml | 24 +++++++++++------------- api/secretsmanager/model.go | 4 +++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index b15b435..6002498 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,12 +17,12 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: golang + - name: Setup Go uses: actions/setup-go@v2 with: - go-version: '1.20' + go-version: '1.21' - - name: checkout + - name: Checkout code uses: actions/checkout@v2 with: path: src/github.com/SSHcom/privx-sdk-go @@ -31,30 +31,28 @@ jobs: run: | go mod download -json - - name: go get CI tools + - name: Install CI tools run: | - go get github.com/mattn/goveralls - go get github.com/lawrencewoodman/roveralls - env: - GO111MODULE: off + go install github.com/mattn/goveralls@latest + go install github.com/lawrencewoodman/roveralls@latest - - name: go install staticcheck + - name: Install staticcheck run: | go install honnef.co/go/tools/cmd/staticcheck@latest - - name: go vet + - name: Run go vet run: | go vet ./... - - name: staticcheck + - name: Run staticcheck run: | staticcheck ./... - - name: go test + - name: Run go test run: | go test ./... - - name: coverage + - name: Run coverage env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | diff --git a/api/secretsmanager/model.go b/api/secretsmanager/model.go index 07cc5a5..78188af 100644 --- a/api/secretsmanager/model.go +++ b/api/secretsmanager/model.go @@ -51,9 +51,10 @@ type CompileScriptRequest struct { type TargetDomain struct { ID string `json:"id"` Name string `json:"name"` + DomainName string `json:"domain_name"` Enabled bool `json:"enabled"` PeriodicScan bool `json:"periodic_scan"` - PeriodicScanInterval int `json:"periodic_scan_interval,omitempty"` + PeriodicScanInterval int `json:"periodic_scan_interval"` ScanStatus string `json:"scan_status,omitempty"` ScanMessage string `json:"scan_message,omitempty"` LastScanned *time.Time `json:"last_scanned,omitempty"` @@ -152,6 +153,7 @@ type ManagedAccount struct { Username string `json:"username"` Email string `json:"email,omitempty"` FullName string `json:"full_name,omitempty"` + SamAccountName string `json:"sam_account_name,omitempty"` SourceID string `json:"source_id,omitempty"` SecurityID string `json:"security_id,omitempty"` AdditionalData map[string]string `json:"additional_data,omitempty"`