Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/endpoint/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ type Connector interface {
RetrieveCertificateMetaData(dn string) (*certificate.CertificateMetaData, error)
RetrieveSystemVersion() (string, error)
WriteLog(req *LogRequest) error
RefreshAccessTokenValidity(auth *Authentication) (RefreshTokenResponse, error)
}

// RefreshTokenResponse provides the information of refreshed token
type RefreshTokenResponse interface {
GetRefreshedAccessTokenInfo() (string, int)
GetRefreshTokenInfo() (string, int)
}

type Filter struct {
Expand Down
5 changes: 5 additions & 0 deletions pkg/venafi/cloud/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -1889,3 +1889,8 @@ func getCertificateAuthorityInfoFromCloud(caName, caAccountId, caProductOptionId

return &info, nil
}

// RefreshAccessTokenValidity is a wrapper over RefreshAccessToken which refreshes OAuth access token
func (c *Connector) RefreshAccessTokenValidity(auth *endpoint.Authentication) (endpoint.RefreshTokenResponse, error) {
return nil, fmt.Errorf("RefreshAccessTokenValidity is not implemented for venafi cloud")
}
5 changes: 5 additions & 0 deletions pkg/venafi/fake/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,8 @@ func (c *Connector) ListCertificates(filter endpoint.Filter) ([]certificate.Cert
func (c *Connector) WriteLog(logReq *endpoint.LogRequest) (err error) {
return fmt.Errorf("Logging is not supported in -test-mode")
}

// RefreshAccessTokenValidity is a wrapper over RefreshAccessToken which refreshes OAuth access token
func (c *Connector) RefreshAccessTokenValidity(auth *endpoint.Authentication) (endpoint.RefreshTokenResponse, error) {
return nil, fmt.Errorf("RefreshAccessTokenValidity is not implemented for fake")
}
5 changes: 5 additions & 0 deletions pkg/venafi/firefly/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,8 @@ func (c *Connector) RetrieveCertificateMetaData(_ string) (*certificate.Certific
func (c *Connector) RetireCertificate(_ *certificate.RetireRequest) error {
panic("operation is not supported yet")
}

// RefreshAccessTokenValidity is a wrapper over RefreshAccessToken which refreshes OAuth access token
func (c *Connector) RefreshAccessTokenValidity(auth *endpoint.Authentication) (endpoint.RefreshTokenResponse, error) {
return nil, fmt.Errorf("RefreshAccessTokenValidity is not implemented for fake")
}
21 changes: 21 additions & 0 deletions pkg/venafi/tpp/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,27 @@ func (c *Connector) RefreshAccessToken(auth *endpoint.Authentication) (resp Oaut
}
}

// RefreshAccessTokenValidity is a wrapper over RefreshAccessToken which refreshes OAuth access token
func (c *Connector) RefreshAccessTokenValidity(auth *endpoint.Authentication) (endpoint.RefreshTokenResponse, error) {
var resp endpoint.RefreshTokenResponse
var err error
resp, err = c.RefreshAccessToken(auth)
if err != nil {
return nil, err
}
return resp, nil
}

// GetRefreshedAccessTokenInfo returns refreshed access token and its validity
func (o OauthRefreshAccessTokenResponse) GetRefreshedAccessTokenInfo() (string, int) {
return o.Access_token, o.Expires
}

// GetRefreshTokenInfo returns refresh token and its validity
func (o OauthRefreshAccessTokenResponse) GetRefreshTokenInfo() (string, int) {
return o.Refresh_token, o.Refresh_until
}

// VerifyAccessToken - call to check whether token is valid and, if so, return its properties
func (c *Connector) VerifyAccessToken(auth *endpoint.Authentication) (resp OauthVerifyTokenResponse, err error) {

Expand Down