diff --git a/controller/internal/routes/identity_api_model.go b/controller/internal/routes/identity_api_model.go index be528eda1..9214c2ea8 100644 --- a/controller/internal/routes/identity_api_model.go +++ b/controller/internal/routes/identity_api_model.go @@ -224,6 +224,7 @@ func MapIdentityToRestModel(ae *env.AppEnv, identity *model.Identity) (*rest_mod CaID: ca.Id, Jwt: entity.Jwt, Token: entity.Token, + ExpiresAt: expiresAt, } } diff --git a/rest_model/identity_enrollments.go b/rest_model/identity_enrollments.go index 35c303c92..f031a3e5a 100644 --- a/rest_model/identity_enrollments.go +++ b/rest_model/identity_enrollments.go @@ -217,6 +217,10 @@ type IdentityEnrollmentsOttca struct { // ca Id CaID string `json:"caId,omitempty"` + // expires at + // Format: date-time + ExpiresAt strfmt.DateTime `json:"expiresAt,omitempty"` + // jwt Jwt string `json:"jwt,omitempty"` @@ -232,6 +236,10 @@ func (m *IdentityEnrollmentsOttca) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateExpiresAt(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -256,6 +264,19 @@ func (m *IdentityEnrollmentsOttca) validateCa(formats strfmt.Registry) error { return nil } +func (m *IdentityEnrollmentsOttca) validateExpiresAt(formats strfmt.Registry) error { + + if swag.IsZero(m.ExpiresAt) { // not required + return nil + } + + if err := validate.FormatOf("ottca"+"."+"expiresAt", "body", "date-time", m.ExpiresAt.String(), formats); err != nil { + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *IdentityEnrollmentsOttca) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/rest_server/embedded_spec.go b/rest_server/embedded_spec.go index 71295ba6d..944e739a6 100644 --- a/rest_server/embedded_spec.go +++ b/rest_server/embedded_spec.go @@ -6248,6 +6248,10 @@ func init() { "caId": { "type": "string" }, + "expiresAt": { + "type": "string", + "format": "date-time" + }, "jwt": { "type": "string" }, @@ -20135,6 +20139,10 @@ func init() { "caId": { "type": "string" }, + "expiresAt": { + "type": "string", + "format": "date-time" + }, "jwt": { "type": "string" }, @@ -21885,6 +21893,10 @@ func init() { "caId": { "type": "string" }, + "expiresAt": { + "type": "string", + "format": "date-time" + }, "jwt": { "type": "string" }, diff --git a/specs/swagger.yml b/specs/swagger.yml index 1eeec2e62..b94e2869e 100644 --- a/specs/swagger.yml +++ b/specs/swagger.yml @@ -3782,6 +3782,9 @@ definitions: type: string ca: $ref: '#/definitions/entityRef' + expiresAt: + type: string + format: date-time ################################################################### # Authenticator ##################################################################