mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
47ffa52f0f
* feat(instance): implement create instance with direct machine user and credentials
* fix: deprecated add endpoint and variable declaration
* fix(instance): update logic for pats and machinekeys
* fix(instance): unit test corrections and additional unit test for pats and machinekeys
* fix(instance-create): include review changes
* fix(instance-create): linter fixes
* move iframe usage to solution scenarios configurations
* Revert "move iframe usage to solution scenarios configurations"
This reverts commit 9db31f3808
.
* fix merge
* fix: add review suggestions
Co-authored-by: Livio Spring <livio.a@gmail.com>
* fix: add review changes
* fix: add review changes for default definitions
* fix: add review changes for machinekey details
* fix: add machinekey output when setup with machineuser
* fix: add changes from review
* fix instance converter for machine and allow overwriting of further machine fields
Co-authored-by: Livio Spring <livio.a@gmail.com>
37 lines
806 B
Go
37 lines
806 B
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/zitadel/zitadel/internal/errors"
|
|
)
|
|
|
|
var (
|
|
//most of us won't survive until 12-31-9999 23:59:59, maybe ZITADEL does
|
|
defaultExpDate = time.Date(9999, time.December, 31, 23, 59, 59, 0, time.UTC)
|
|
)
|
|
|
|
type expiration interface {
|
|
GetExpirationDate() time.Time
|
|
SetExpirationDate(time.Time)
|
|
}
|
|
|
|
func EnsureValidExpirationDate(key expiration) error {
|
|
date, err := ValidateExpirationDate(key.GetExpirationDate())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
key.SetExpirationDate(date)
|
|
return nil
|
|
}
|
|
|
|
func ValidateExpirationDate(date time.Time) (time.Time, error) {
|
|
if date.IsZero() {
|
|
return defaultExpDate, nil
|
|
}
|
|
if date.Before(time.Now()) {
|
|
return time.Time{}, errors.ThrowInvalidArgument(nil, "DOMAIN-dv3t5", "Errors.AuthNKey.ExpireBeforeNow")
|
|
}
|
|
return date, nil
|
|
}
|