mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 19:44:21 +00:00
e22689c125
* cleanup todo * pass id token details to oidc * feat(oidc): id token for device authorization This changes updates to the newest oidc version, so the Device Authorization grant can return ID tokens when the scope `openid` is set. There is also some refactoring done, so that the eventstore can be queried directly when polling for state. The projection is cleaned up to a minimum with only data required for the login UI. * try to be explicit wit hthe timezone to fix github * pin oidc v3.8.0 * remove TBD entry
41 lines
925 B
Go
41 lines
925 B
Go
package deviceauth
|
|
|
|
import (
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
)
|
|
|
|
const (
|
|
UniqueUserCode = "user_code"
|
|
UniqueDeviceCode = "device_code"
|
|
DuplicateUserCode = "Errors.DeviceUserCode.AlreadyExists"
|
|
DuplicateDeviceCode = "Errors.DeviceCode.AlreadyExists"
|
|
)
|
|
|
|
func NewAddUniqueConstraints(deviceCode, userCode string) []*eventstore.UniqueConstraint {
|
|
return []*eventstore.UniqueConstraint{
|
|
eventstore.NewAddEventUniqueConstraint(
|
|
UniqueDeviceCode,
|
|
deviceCode,
|
|
DuplicateDeviceCode,
|
|
),
|
|
eventstore.NewAddEventUniqueConstraint(
|
|
UniqueUserCode,
|
|
userCode,
|
|
DuplicateUserCode,
|
|
),
|
|
}
|
|
}
|
|
|
|
func NewRemoveUniqueConstraints(deviceCode, userCode string) []*eventstore.UniqueConstraint {
|
|
return []*eventstore.UniqueConstraint{
|
|
eventstore.NewRemoveUniqueConstraint(
|
|
UniqueDeviceCode,
|
|
deviceCode,
|
|
),
|
|
eventstore.NewRemoveUniqueConstraint(
|
|
UniqueUserCode,
|
|
userCode,
|
|
),
|
|
}
|
|
}
|