mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
2ba56595b1
* feat: add apis and application keys * VerifyOIDCClientSecret * Update internal/v2/repository/project/api_config.go Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> * Update internal/v2/repository/project/key.go Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> * fix append ApplicationKeyWriteModel Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
48 lines
867 B
Go
48 lines
867 B
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore/models"
|
|
)
|
|
|
|
type MachineKey struct {
|
|
models.ObjectRoot
|
|
|
|
KeyID string
|
|
Type AuthNKeyType
|
|
ExpirationDate time.Time
|
|
PrivateKey []byte
|
|
PublicKey []byte
|
|
}
|
|
|
|
func (key *MachineKey) setPublicKey(publicKey []byte) {
|
|
key.PublicKey = publicKey
|
|
}
|
|
|
|
func (key *MachineKey) setPrivateKey(privateKey []byte) {
|
|
key.PrivateKey = privateKey
|
|
}
|
|
|
|
func (key *MachineKey) expirationDate() time.Time {
|
|
return key.ExpirationDate
|
|
}
|
|
|
|
func (key *MachineKey) setExpirationDate(expiration time.Time) {
|
|
key.ExpirationDate = expiration
|
|
}
|
|
|
|
type MachineKeyState int32
|
|
|
|
const (
|
|
MachineKeyStateUnspecified MachineKeyState = iota
|
|
MachineKeyStateActive
|
|
MachineKeyStateRemoved
|
|
|
|
machineKeyStateCount
|
|
)
|
|
|
|
func (f MachineKeyState) Valid() bool {
|
|
return f >= 0 && f < machineKeyStateCount
|
|
}
|