model

package
v1.87.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIAuthMethodType

type APIAuthMethodType int32
const (
	APIAuthMethodTypeBasic APIAuthMethodType = iota
	APIAuthMethodTypePrivateKeyJWT
)

type APIConfig

type APIConfig struct {
	es_models.ObjectRoot
	AppID              string
	ClientID           string
	ClientSecret       *crypto.CryptoValue
	ClientSecretString string
	AuthMethodType     APIAuthMethodType
	ClientKeys         []*ClientKey
}

func (*APIConfig) GenerateClientSecretIfNeeded

func (c *APIConfig) GenerateClientSecretIfNeeded(generator crypto.Generator) (string, error)

func (*APIConfig) GenerateNewClientID

func (c *APIConfig) GenerateNewClientID(idGenerator id.Generator, project *Project) error

ClientID random_number@projectname (eg. 495894098234@zitadel)

func (*APIConfig) GenerateNewClientSecret

func (c *APIConfig) GenerateNewClientSecret(generator crypto.Generator) (string, error)

func (*APIConfig) IsValid

func (c *APIConfig) IsValid() bool

type AppSearchKey

type AppSearchKey int32
const (
	AppSearchKeyUnspecified AppSearchKey = iota
	AppSearchKeyName
	AppSearchKeyOIDCClientID
	AppSearchKeyProjectID
	AppSearchKeyAppID
)

type AppState

type AppState int32
const (
	AppStateActive AppState = iota
	AppStateInactive
	AppStateRemoved
)

type AppType

type AppType int32
const (
	AppTypeUnspecified AppType = iota
	AppTypeOIDC
	AppTypeSAML
	AppTypeAPI
)

type Application

type Application struct {
	es_models.ObjectRoot

	AppID      string
	State      AppState
	Name       string
	Type       AppType
	OIDCConfig *OIDCConfig
	APIConfig  *APIConfig
}

func NewApplication

func NewApplication(projectID, appID string) *Application

func (*Application) GetKey

func (a *Application) GetKey(keyID string) (int, *ClientKey)

func (*Application) IsValid

func (a *Application) IsValid(includeConfig bool) bool

type ApplicationChange

type ApplicationChange struct {
	ChangeDate        *timestamp.Timestamp `json:"changeDate,omitempty"`
	EventType         string               `json:"eventType,omitempty"`
	Sequence          uint64               `json:"sequence,omitempty"`
	ModifierId        string               `json:"modifierUser,omitempty"`
	ModifierName      string               `json:"-"`
	ModifierLoginName string               `json:"-"`
	ModifierAvatarURL string               `json:"-"`
	Data              interface{}          `json:"data,omitempty"`
}

type ApplicationChanges

type ApplicationChanges struct {
	Changes      []*ApplicationChange
	LastSequence uint64
}

type ApplicationSearchQuery

type ApplicationSearchQuery struct {
	Key    AppSearchKey
	Method domain.SearchMethod
	Value  interface{}
}

type ApplicationSearchRequest

type ApplicationSearchRequest struct {
	Offset        uint64
	Limit         uint64
	SortingColumn AppSearchKey
	Asc           bool
	Queries       []*ApplicationSearchQuery
}

func (*ApplicationSearchRequest) EnsureLimit

func (r *ApplicationSearchRequest) EnsureLimit(limit uint64) error

type ApplicationSearchResponse

type ApplicationSearchResponse struct {
	Offset      uint64
	Limit       uint64
	TotalResult uint64
	Result      []*ApplicationView
	Sequence    uint64
	Timestamp   time.Time
}

type ApplicationView

type ApplicationView struct {
	ID                     string
	ProjectID              string
	Name                   string
	CreationDate           time.Time
	ChangeDate             time.Time
	ResourceOwner          string
	State                  AppState
	ProjectRoleAssertion   bool
	ProjectRoleCheck       bool
	HasProjectCheck        bool
	PrivateLabelingSetting domain.PrivateLabelingSetting

	IsOIDC                     bool
	OIDCVersion                OIDCVersion
	OIDCClientID               string
	OIDCRedirectUris           []string
	OIDCResponseTypes          []OIDCResponseType
	OIDCGrantTypes             []OIDCGrantType
	OIDCApplicationType        OIDCApplicationType
	OIDCAuthMethodType         OIDCAuthMethodType
	OIDCPostLogoutRedirectUris []string
	NoneCompliant              bool
	ComplianceProblems         []string
	DevMode                    bool
	OriginAllowList            []string
	AdditionalOrigins          []string
	AccessTokenType            OIDCTokenType
	IDTokenRoleAssertion       bool
	AccessTokenRoleAssertion   bool
	IDTokenUserinfoAssertion   bool
	ClockSkew                  time.Duration

	Sequence uint64
}

type ClientKey

type ClientKey struct {
	es_models.ObjectRoot

	ApplicationID  string
	ClientID       string
	KeyID          string
	Type           key_model.AuthNKeyType
	ExpirationDate time.Time
	PrivateKey     []byte
}

type Compliance

type Compliance struct {
	NoneCompliant bool
	Problems      []string
}

func GetOIDCCompliance

func GetOIDCCompliance(version OIDCVersion, appType OIDCApplicationType, grantTypes []OIDCGrantType, responseTypes []OIDCResponseType, authMethod OIDCAuthMethodType, redirectUris []string) *Compliance

type OIDCApplicationType

type OIDCApplicationType int32
const (
	OIDCApplicationTypeWeb OIDCApplicationType = iota
	OIDCApplicationTypeUserAgent
	OIDCApplicationTypeNative
)

type OIDCAuthMethodType

type OIDCAuthMethodType int32
const (
	OIDCAuthMethodTypeBasic OIDCAuthMethodType = iota
	OIDCAuthMethodTypePost
	OIDCAuthMethodTypeNone
	OIDCAuthMethodTypePrivateKeyJWT
)

type OIDCConfig

type OIDCConfig struct {
	es_models.ObjectRoot
	AppID                    string
	ClientID                 string
	ClientSecret             *crypto.CryptoValue
	ClientSecretString       string
	RedirectUris             []string
	ResponseTypes            []OIDCResponseType
	GrantTypes               []OIDCGrantType
	ApplicationType          OIDCApplicationType
	AuthMethodType           OIDCAuthMethodType
	PostLogoutRedirectUris   []string
	OIDCVersion              OIDCVersion
	Compliance               *Compliance
	DevMode                  bool
	AccessTokenType          OIDCTokenType
	AccessTokenRoleAssertion bool
	IDTokenRoleAssertion     bool
	IDTokenUserinfoAssertion bool
	ClockSkew                time.Duration
	ClientKeys               []*ClientKey
}

func (*OIDCConfig) FillCompliance

func (c *OIDCConfig) FillCompliance()

func (*OIDCConfig) GenerateClientSecretIfNeeded

func (c *OIDCConfig) GenerateClientSecretIfNeeded(generator crypto.Generator) (string, error)

func (*OIDCConfig) GenerateNewClientID

func (c *OIDCConfig) GenerateNewClientID(idGenerator id.Generator, project *Project) error

ClientID random_number@projectname (eg. 495894098234@zitadel)

func (*OIDCConfig) GenerateNewClientSecret

func (c *OIDCConfig) GenerateNewClientSecret(generator crypto.Generator) (string, error)

func (*OIDCConfig) IsValid

func (c *OIDCConfig) IsValid() bool

type OIDCGrantType

type OIDCGrantType int32
const (
	OIDCGrantTypeAuthorizationCode OIDCGrantType = iota
	OIDCGrantTypeImplicit
	OIDCGrantTypeRefreshToken
)

type OIDCResponseType

type OIDCResponseType int32
const (
	OIDCResponseTypeCode OIDCResponseType = iota
	OIDCResponseTypeIDToken
	OIDCResponseTypeIDTokenToken
)

type OIDCTokenType

type OIDCTokenType int32
const (
	OIDCTokenTypeBearer OIDCTokenType = iota
	OIDCTokenTypeJWT
)

type OIDCVersion

type OIDCVersion int32
const (
	OIDCVersionV1 OIDCVersion = iota
)

type OrgProjectMapping

type OrgProjectMapping struct {
	OrgID     string
	ProjectID string
}

type OrgProjectMappingViewSearchKey

type OrgProjectMappingViewSearchKey int32
const (
	OrgProjectMappingSearchKeyUnspecified OrgProjectMappingViewSearchKey = iota
	OrgProjectMappingSearchKeyProjectID
	OrgProjectMappingSearchKeyOrgID
	OrgProjectMappingSearchKeyProjectGrantID
)

type OrgProjectMappingViewSearchQuery

type OrgProjectMappingViewSearchQuery struct {
	Key    OrgProjectMappingViewSearchKey
	Method domain.SearchMethod
	Value  interface{}
}

type OrgProjectMappingViewSearchRequest

type OrgProjectMappingViewSearchRequest struct {
	Offset        uint64
	Limit         uint64
	SortingColumn OrgProjectMappingViewSearchKey
	Asc           bool
	Queries       []*OrgProjectMappingViewSearchQuery
}

func (*OrgProjectMappingViewSearchRequest) GetSearchQuery

type OrgProjectMappingViewSearchResponse

type OrgProjectMappingViewSearchResponse struct {
	Offset      uint64
	Limit       uint64
	TotalResult uint64
	Result      []*OrgProjectMapping
	Sequence    uint64
	Timestamp   time.Time
}

type Project

type Project struct {
	es_models.ObjectRoot

	State                  ProjectState
	Name                   string
	Members                []*ProjectMember
	Roles                  []*ProjectRole
	Applications           []*Application
	Grants                 []*ProjectGrant
	ProjectRoleAssertion   bool
	ProjectRoleCheck       bool
	HasProjectCheck        bool
	PrivateLabelingSetting domain.PrivateLabelingSetting
}

func NewProject

func NewProject(id string) *Project

func (*Project) ContainsGrantForOrg

func (p *Project) ContainsGrantForOrg(orgID string) bool

func (*Project) ContainsGrantMember

func (p *Project) ContainsGrantMember(member *ProjectGrantMember) bool

func (*Project) ContainsRole

func (p *Project) ContainsRole(role *ProjectRole) bool

func (*Project) ContainsRoles

func (p *Project) ContainsRoles(roleKeys []string) bool

func (*Project) GetApp

func (p *Project) GetApp(appID string) (int, *Application)

func (*Project) GetGrant

func (p *Project) GetGrant(grantID string) (int, *ProjectGrant)

func (*Project) IsActive

func (p *Project) IsActive() bool

func (*Project) IsValid

func (p *Project) IsValid() bool

type ProjectChange

type ProjectChange struct {
	ChangeDate        *timestamp.Timestamp `json:"changeDate,omitempty"`
	EventType         string               `json:"eventType,omitempty"`
	Sequence          uint64               `json:"sequence,omitempty"`
	ModifierId        string               `json:"modifierUser,omitempty"`
	ModifierName      string               `json:"-"`
	ModifierLoginName string               `json:"-"`
	ModifierAvatarURL string               `json:"-"`
	Data              interface{}          `json:"data,omitempty"`
}

type ProjectChanges

type ProjectChanges struct {
	Changes      []*ProjectChange
	LastSequence uint64
}

type ProjectGrant

type ProjectGrant struct {
	es_models.ObjectRoot

	GrantID      string
	GrantedOrgID string
	State        ProjectGrantState
	RoleKeys     []string
	Members      []*ProjectGrantMember
}

func NewProjectGrant

func NewProjectGrant(projectID, grantID string) *ProjectGrant

func (*ProjectGrant) GetMember

func (p *ProjectGrant) GetMember(userID string) (int, *ProjectGrantMember)

func (*ProjectGrant) GetRemovedRoles

func (p *ProjectGrant) GetRemovedRoles(roleKeys []string) []string

func (*ProjectGrant) IsActive

func (p *ProjectGrant) IsActive() bool

func (*ProjectGrant) IsValid

func (p *ProjectGrant) IsValid() bool

type ProjectGrantIDs

type ProjectGrantIDs struct {
	ProjectID string
	GrantID   string
}

type ProjectGrantMember

type ProjectGrantMember struct {
	es_models.ObjectRoot
	GrantID string
	UserID  string
	Roles   []string
}

func NewProjectGrantMember

func NewProjectGrantMember(projectID, grantID, userID string) *ProjectGrantMember

func (*ProjectGrantMember) IsValid

func (p *ProjectGrantMember) IsValid() bool

type ProjectGrantMemberSearchKey

type ProjectGrantMemberSearchKey int32
const (
	ProjectGrantMemberSearchKeyUnspecified ProjectGrantMemberSearchKey = iota
	ProjectGrantMemberSearchKeyUserName
	ProjectGrantMemberSearchKeyEmail
	ProjectGrantMemberSearchKeyFirstName
	ProjectGrantMemberSearchKeyLastName
	ProjectGrantMemberSearchKeyGrantID
	ProjectGrantMemberSearchKeyUserID
	ProjectGrantMemberSearchKeyProjectID
)

type ProjectGrantMemberSearchQuery

type ProjectGrantMemberSearchQuery struct {
	Key    ProjectGrantMemberSearchKey
	Method domain.SearchMethod
	Value  interface{}
}

type ProjectGrantMemberSearchRequest

type ProjectGrantMemberSearchRequest struct {
	Offset        uint64
	Limit         uint64
	SortingColumn ProjectGrantMemberSearchKey
	Asc           bool
	Queries       []*ProjectGrantMemberSearchQuery
}

func (*ProjectGrantMemberSearchRequest) EnsureLimit

func (r *ProjectGrantMemberSearchRequest) EnsureLimit(limit uint64) error

type ProjectGrantMemberSearchResponse

type ProjectGrantMemberSearchResponse struct {
	Offset      uint64
	Limit       uint64
	TotalResult uint64
	Result      []*ProjectGrantMemberView
	Sequence    uint64
	Timestamp   time.Time
}

type ProjectGrantMemberView

type ProjectGrantMemberView struct {
	UserID             string
	GrantID            string
	ProjectID          string
	UserName           string
	Email              string
	FirstName          string
	LastName           string
	DisplayName        string
	PreferredLoginName string
	AvatarURL          string
	UserResourceOwner  string
	Roles              []string
	CreationDate       time.Time
	ChangeDate         time.Time
	Sequence           uint64
}

type ProjectGrantState

type ProjectGrantState int32
const (
	ProjectGrantStateActive ProjectGrantState = iota
	ProjectGrantStateInactive
)

type ProjectGrantView

type ProjectGrantView struct {
	ProjectID         string
	Name              string
	CreationDate      time.Time
	ChangeDate        time.Time
	State             ProjectState
	ResourceOwner     string
	ResourceOwnerName string
	OrgID             string
	OrgName           string
	OrgDomain         string
	Sequence          uint64
	GrantID           string
	GrantedRoleKeys   []string
}

type ProjectGrantViewSearchKey

type ProjectGrantViewSearchKey int32
const (
	GrantedProjectSearchKeyUnspecified ProjectGrantViewSearchKey = iota
	GrantedProjectSearchKeyName
	GrantedProjectSearchKeyProjectID
	GrantedProjectSearchKeyGrantID
	GrantedProjectSearchKeyOrgID
	GrantedProjectSearchKeyResourceOwner
	GrantedProjectSearchKeyRoleKeys
)

type ProjectGrantViewSearchQuery

type ProjectGrantViewSearchQuery struct {
	Key    ProjectGrantViewSearchKey
	Method domain.SearchMethod
	Value  interface{}
}

type ProjectGrantViewSearchRequest

type ProjectGrantViewSearchRequest struct {
	Offset        uint64
	Limit         uint64
	SortingColumn ProjectGrantViewSearchKey
	Asc           bool
	Queries       []*ProjectGrantViewSearchQuery
}

func (*ProjectGrantViewSearchRequest) AppendMyOrgQuery

func (r *ProjectGrantViewSearchRequest) AppendMyOrgQuery(orgID string)

func (*ProjectGrantViewSearchRequest) AppendMyResourceOwnerQuery

func (r *ProjectGrantViewSearchRequest) AppendMyResourceOwnerQuery(orgID string)

func (*ProjectGrantViewSearchRequest) AppendNotMyOrgQuery

func (r *ProjectGrantViewSearchRequest) AppendNotMyOrgQuery(orgID string)

func (*ProjectGrantViewSearchRequest) EnsureLimit

func (r *ProjectGrantViewSearchRequest) EnsureLimit(limit uint64) error

func (*ProjectGrantViewSearchRequest) GetSearchQuery

type ProjectGrantViewSearchResponse

type ProjectGrantViewSearchResponse struct {
	Offset      uint64
	Limit       uint64
	TotalResult uint64
	Result      []*ProjectGrantView
	Sequence    uint64
	Timestamp   time.Time
}

type ProjectMember

type ProjectMember struct {
	es_models.ObjectRoot

	UserID string
	Roles  []string
}

func NewProjectMember

func NewProjectMember(projectID, userID string) *ProjectMember

func (*ProjectMember) IsValid

func (p *ProjectMember) IsValid() bool

type ProjectMemberSearchKey

type ProjectMemberSearchKey int32
const (
	ProjectMemberSearchKeyUnspecified ProjectMemberSearchKey = iota
	ProjectMemberSearchKeyUserName
	ProjectMemberSearchKeyEmail
	ProjectMemberSearchKeyFirstName
	ProjectMemberSearchKeyLastName
	ProjectMemberSearchKeyProjectID
	ProjectMemberSearchKeyUserID
)

type ProjectMemberSearchQuery

type ProjectMemberSearchQuery struct {
	Key    ProjectMemberSearchKey
	Method domain.SearchMethod
	Value  interface{}
}

type ProjectMemberSearchRequest

type ProjectMemberSearchRequest struct {
	Offset        uint64
	Limit         uint64
	SortingColumn ProjectMemberSearchKey
	Asc           bool
	Queries       []*ProjectMemberSearchQuery
}

func (*ProjectMemberSearchRequest) AppendProjectQuery

func (r *ProjectMemberSearchRequest) AppendProjectQuery(projectID string)

func (*ProjectMemberSearchRequest) EnsureLimit

func (r *ProjectMemberSearchRequest) EnsureLimit(limit uint64) error

type ProjectMemberSearchResponse

type ProjectMemberSearchResponse struct {
	Offset      uint64
	Limit       uint64
	TotalResult uint64
	Result      []*ProjectMemberView
	Sequence    uint64
	Timestamp   time.Time
}

type ProjectMemberView

type ProjectMemberView struct {
	UserID             string
	ProjectID          string
	UserName           string
	Email              string
	FirstName          string
	LastName           string
	DisplayName        string
	PreferredLoginName string
	AvatarURL          string
	UserResourceOwner  string
	Roles              []string
	CreationDate       time.Time
	ChangeDate         time.Time
	Sequence           uint64
}

type ProjectRole

type ProjectRole struct {
	es_models.ObjectRoot

	Key         string
	DisplayName string
	Group       string
}

func (*ProjectRole) IsValid

func (p *ProjectRole) IsValid() bool

type ProjectRoleSearchKey

type ProjectRoleSearchKey int32
const (
	ProjectRoleSearchKeyUnspecified ProjectRoleSearchKey = iota
	ProjectRoleSearchKeyKey
	ProjectRoleSearchKeyProjectID
	ProjectRoleSearchKeyOrgID
	ProjectRoleSearchKeyResourceOwner
	ProjectRoleSearchKeyDisplayName
)

type ProjectRoleSearchQuery

type ProjectRoleSearchQuery struct {
	Key    ProjectRoleSearchKey
	Method domain.SearchMethod
	Value  interface{}
}

type ProjectRoleSearchRequest

type ProjectRoleSearchRequest struct {
	Offset        uint64
	Limit         uint64
	SortingColumn ProjectRoleSearchKey
	Asc           bool
	Queries       []*ProjectRoleSearchQuery
}

func (*ProjectRoleSearchRequest) AppendMyOrgQuery

func (r *ProjectRoleSearchRequest) AppendMyOrgQuery(orgID string)

func (*ProjectRoleSearchRequest) AppendProjectQuery

func (r *ProjectRoleSearchRequest) AppendProjectQuery(projectID string)

func (*ProjectRoleSearchRequest) AppendRoleKeysQuery

func (r *ProjectRoleSearchRequest) AppendRoleKeysQuery(keys []string)

func (*ProjectRoleSearchRequest) EnsureLimit

func (r *ProjectRoleSearchRequest) EnsureLimit(limit uint64) error

type ProjectRoleSearchResponse

type ProjectRoleSearchResponse struct {
	Offset      uint64
	Limit       uint64
	TotalResult uint64
	Result      []*ProjectRoleView
	Sequence    uint64
	Timestamp   time.Time
}

type ProjectRoleView

type ProjectRoleView struct {
	ResourceOwner string
	OrgID         string
	ProjectID     string
	Key           string
	DisplayName   string
	Group         string
	CreationDate  time.Time
	ChangeDate    time.Time
	Sequence      uint64
}

type ProjectState

type ProjectState int32
const (
	ProjectStateActive ProjectState = iota
	ProjectStateInactive
	ProjectStateRemoved
)

type ProjectView

type ProjectView struct {
	ProjectID              string
	Name                   string
	CreationDate           time.Time
	ChangeDate             time.Time
	State                  ProjectState
	ResourceOwner          string
	ProjectRoleAssertion   bool
	ProjectRoleCheck       bool
	HasProjectCheck        bool
	PrivateLabelingSetting domain.PrivateLabelingSetting
	Sequence               uint64
}

type ProjectViewSearchKey

type ProjectViewSearchKey int32
const (
	ProjectViewSearchKeyUnspecified ProjectViewSearchKey = iota
	ProjectViewSearchKeyName
	ProjectViewSearchKeyProjectID
	ProjectViewSearchKeyResourceOwner
)

type ProjectViewSearchQuery

type ProjectViewSearchQuery struct {
	Key    ProjectViewSearchKey
	Method domain.SearchMethod
	Value  interface{}
}

type ProjectViewSearchRequest

type ProjectViewSearchRequest struct {
	Offset        uint64
	Limit         uint64
	SortingColumn ProjectViewSearchKey
	Asc           bool
	Queries       []*ProjectViewSearchQuery
}

func (*ProjectViewSearchRequest) AppendMyResourceOwnerQuery

func (r *ProjectViewSearchRequest) AppendMyResourceOwnerQuery(orgID string)

func (*ProjectViewSearchRequest) EnsureLimit

func (r *ProjectViewSearchRequest) EnsureLimit(limit uint64) error

func (*ProjectViewSearchRequest) GetSearchQuery

type ProjectViewSearchResponse

type ProjectViewSearchResponse struct {
	Offset      uint64
	Limit       uint64
	TotalResult uint64
	Result      []*ProjectView
	Sequence    uint64
	Timestamp   time.Time
}

type Token

type Token struct {
	es_models.ObjectRoot

	TokenID    string
	ClientID   string
	Audience   []string
	Expiration time.Time
	Scopes     []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL