From ac74cd0f2f7e4b28340dd6d726c8b7aa509960ad Mon Sep 17 00:00:00 2001 From: hoken Date: Tue, 1 Mar 2022 15:30:13 +0200 Subject: [PATCH] sync the correct response from api for host credentials --- api/authorizer/client.go | 4 ++-- api/authorizer/model.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/api/authorizer/client.go b/api/authorizer/client.go index 25673e0..5b1ce26 100644 --- a/api/authorizer/client.go +++ b/api/authorizer/client.go @@ -71,8 +71,8 @@ func (auth *Client) CertificateRevocationList(caID, filename string) error { } // TargetHostCredentials get target host credentials for the user -func (auth *Client) TargetHostCredentials(authorizer *AuthorizationRequest) (*Principal, error) { - principal := &Principal{} +func (auth *Client) TargetHostCredentials(authorizer *AuthorizationRequest) (*ApiIdentitiesResponse, error) { + principal := &ApiIdentitiesResponse{} _, err := auth.api. URL("/authorizer/api/v1/ca/authorize"). diff --git a/api/authorizer/model.go b/api/authorizer/model.go index a7a87d9..b9dc136 100644 --- a/api/authorizer/model.go +++ b/api/authorizer/model.go @@ -116,6 +116,20 @@ type Principal struct { Size int `json:"size,omitempty"` } +type ApiSshCertificate struct { + Type string `json:"type"` + Data string `json:"data"` + DataString string `json:"data_string"` + Chain []string `json:"chain"` +} +type ApiIdentitiesResponse struct { + Certificates []ApiSshCertificate `json:"certificates"` + PrincipalKeys []Principal `json:"principal_keys"` + Passphrase string `json:"passphrase,omitempty"` + ResponseCode int `json:"response_code"` + Message string `json:"message"` +} + // CA is root certificate representation type CA struct { ID string `json:"id"`