diff --git a/internal/osbuild2/authconfig_stage.go b/internal/osbuild2/authconfig_stage.go new file mode 100644 index 000000000..0be838610 --- /dev/null +++ b/internal/osbuild2/authconfig_stage.go @@ -0,0 +1,13 @@ +package osbuild2 + +type AuthconfigStageOptions struct { +} + +func (AuthconfigStageOptions) isStageOptions() {} + +func NewAuthconfigStage(options *AuthconfigStageOptions) *Stage { + return &Stage{ + Type: "org.osbuild.authconfig", + Options: options, + } +} diff --git a/internal/osbuild2/authconfig_stage_test.go b/internal/osbuild2/authconfig_stage_test.go new file mode 100644 index 000000000..c069e545f --- /dev/null +++ b/internal/osbuild2/authconfig_stage_test.go @@ -0,0 +1,16 @@ +package osbuild2 + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestNewAuthconfigStage(t *testing.T) { + expectedStage := &Stage{ + Type: "org.osbuild.authconfig", + Options: &AuthconfigStageOptions{}, + } + actualStage := NewAuthconfigStage(&AuthconfigStageOptions{}) + assert.Equal(t, expectedStage, actualStage) +} diff --git a/internal/osbuild2/stage.go b/internal/osbuild2/stage.go index 6e6fc4bc0..81bc806d5 100644 --- a/internal/osbuild2/stage.go +++ b/internal/osbuild2/stage.go @@ -148,6 +148,8 @@ func (stage *Stage) UnmarshalJSON(data []byte) error { inputs = new(FilesInputs) case "org.osbuild.sshd.config": options = new(SshdConfigStageOptions) + case "org.osbuild.authconfig": + options = new(AuthconfigStageOptions) default: return fmt.Errorf("unexpected stage type: %s", rawStage.Type) } diff --git a/internal/osbuild2/stage_test.go b/internal/osbuild2/stage_test.go index bd318921c..7b518fee9 100644 --- a/internal/osbuild2/stage_test.go +++ b/internal/osbuild2/stage_test.go @@ -647,6 +647,16 @@ func TestStage_UnmarshalJSON(t *testing.T) { data: []byte(`{"type":"org.osbuild.sshd.config","options":{"config":{}}}`), }, }, + { + name: "authconfig", + fields: fields{ + Type: "org.osbuild.authconfig", + Options: &AuthconfigStageOptions{}, + }, + args: args{ + data: []byte(`{"type":"org.osbuild.authconfig","options":{}}`), + }, + }, } for idx, tt := range tests { t.Run(tt.name, func(t *testing.T) {