2020-08-18 10:04:56 +02:00
|
|
|
package setup
|
2020-05-18 11:32:16 +02:00
|
|
|
|
2020-09-24 11:38:28 +02:00
|
|
|
import (
|
|
|
|
"github.com/caos/zitadel/internal/errors"
|
|
|
|
iam_model "github.com/caos/zitadel/internal/iam/model"
|
|
|
|
)
|
|
|
|
|
2020-05-18 11:32:16 +02:00
|
|
|
type IAMSetUp struct {
|
2020-09-24 11:38:28 +02:00
|
|
|
Step1 *Step1
|
2021-01-04 14:52:13 +01:00
|
|
|
//Step2 *Step2
|
|
|
|
//Step3 *Step3
|
|
|
|
//Step4 *Step4
|
|
|
|
//Step5 *Step5
|
|
|
|
//Step6 *Step6
|
|
|
|
//Step7 *Step7
|
|
|
|
//Step8 *Step8
|
2021-01-05 09:27:42 +01:00
|
|
|
//Step9 *Step9
|
2020-09-24 11:38:28 +02:00
|
|
|
}
|
|
|
|
|
2021-01-04 14:52:13 +01:00
|
|
|
func (setup *IAMSetUp) steps(currentDone iam_model.Step) ([]stepV2, error) {
|
|
|
|
steps := make([]stepV2, 0)
|
2020-09-24 11:38:28 +02:00
|
|
|
missingSteps := make([]iam_model.Step, 0)
|
|
|
|
|
2021-01-04 14:52:13 +01:00
|
|
|
for _, step := range []stepV2{
|
2020-09-24 11:38:28 +02:00
|
|
|
setup.Step1,
|
2021-01-04 14:52:13 +01:00
|
|
|
//setup.Step2,
|
|
|
|
//setup.Step3,
|
|
|
|
//setup.Step4,
|
|
|
|
//setup.Step5,
|
|
|
|
//setup.Step6,
|
|
|
|
//setup.Step7,
|
|
|
|
//setup.Step8,
|
2021-01-05 09:27:42 +01:00
|
|
|
//setup.Step9,
|
2020-09-24 11:38:28 +02:00
|
|
|
} {
|
|
|
|
if step.step() <= currentDone {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
if step.isNil() {
|
|
|
|
missingSteps = append(missingSteps, step.step())
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
steps = append(steps, step)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(missingSteps) > 0 {
|
|
|
|
return nil, errors.ThrowPreconditionFailedf(nil, "SETUP-1nk49", "steps %v not configured", missingSteps)
|
|
|
|
}
|
|
|
|
|
|
|
|
return steps, nil
|
2020-08-26 09:56:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type LoginPolicy struct {
|
|
|
|
AllowRegister bool
|
|
|
|
AllowUsernamePassword bool
|
|
|
|
AllowExternalIdp bool
|
2020-05-18 11:32:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type User struct {
|
|
|
|
FirstName string
|
|
|
|
LastName string
|
|
|
|
UserName string
|
|
|
|
Email string
|
|
|
|
Password string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Org struct {
|
2020-06-16 11:40:18 +02:00
|
|
|
Name string
|
|
|
|
Domain string
|
|
|
|
OrgIamPolicy bool
|
|
|
|
Users []User
|
|
|
|
Owners []string
|
|
|
|
Projects []Project
|
2020-05-18 11:32:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type Project struct {
|
|
|
|
Name string
|
|
|
|
Users []User
|
|
|
|
Members []string
|
|
|
|
OIDCApps []OIDCApp
|
|
|
|
}
|
|
|
|
|
|
|
|
type OIDCApp struct {
|
|
|
|
Name string
|
|
|
|
RedirectUris []string
|
|
|
|
ResponseTypes []string
|
|
|
|
GrantTypes []string
|
|
|
|
ApplicationType string
|
|
|
|
AuthMethodType string
|
|
|
|
PostLogoutRedirectUris []string
|
2020-08-18 10:04:56 +02:00
|
|
|
DevMode bool
|
2020-05-18 11:32:16 +02:00
|
|
|
}
|