model

package
v0.116.8 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRedirectUrisCode added in v0.70.0

func CheckRedirectUrisCode(compliance *Compliance, appType OIDCApplicationType, redirectUris []string)

func CheckRedirectUrisImplicit added in v0.70.0

func CheckRedirectUrisImplicit(compliance *Compliance, appType OIDCApplicationType, redirectUris []string)

func CheckRedirectUrisImplicitAndCode added in v0.70.0

func CheckRedirectUrisImplicitAndCode(compliance *Compliance, appType OIDCApplicationType, redirectUris []string)

func GetOIDCV1NativeApplicationCompliance added in v0.70.0

func GetOIDCV1NativeApplicationCompliance(compliance *Compliance, authMethod OIDCAuthMethodType)

func GetOIDCV1UserAgentApplicationCompliance added in v0.70.0

func GetOIDCV1UserAgentApplicationCompliance(compliance *Compliance, authMethod OIDCAuthMethodType)

Types

type APIAuthMethodType added in v0.115.0

type APIAuthMethodType int32
const (
	APIAuthMethodTypeBasic APIAuthMethodType = iota
	APIAuthMethodTypePrivateKeyJWT
)

type APIConfig added in v0.115.0

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

func (*APIConfig) GenerateClientSecretIfNeeded added in v0.115.0

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

func (*APIConfig) GenerateNewClientID added in v0.115.0

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

ClientID random_number@projectname (eg. 495894098234@zitadel)

func (*APIConfig) GenerateNewClientSecret added in v0.115.0

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

func (*APIConfig) IsValid added in v0.115.0

func (c *APIConfig) IsValid() bool

type AppSearchKey added in v0.33.5

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

type AppState added in v0.6.0

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

type AppType added in v0.6.0

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

type Application added in v0.6.0

type Application struct {
	es_models.ObjectRoot

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

func NewApplication added in v0.6.0

func NewApplication(projectID, appID string) *Application

func (*Application) GetKey added in v0.115.0

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

func (*Application) IsValid added in v0.6.0

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

type ApplicationChange added in v0.25.1

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:"-"`
	Data         interface{}          `json:"data,omitempty"`
}

type ApplicationChanges added in v0.25.1

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

type ApplicationSearchQuery added in v0.11.0

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

type ApplicationSearchRequest added in v0.11.0

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

func (*ApplicationSearchRequest) EnsureLimit added in v0.11.0

func (r *ApplicationSearchRequest) EnsureLimit(limit uint64)

type ApplicationSearchResponse added in v0.11.0

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

type ApplicationView added in v0.11.0

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

	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
	AccessTokenType            OIDCTokenType
	IDTokenRoleAssertion       bool
	AccessTokenRoleAssertion   bool
	IDTokenUserinfoAssertion   bool
	ClockSkew                  time.Duration

	Sequence uint64
}

type ClientKey added in v0.115.0

type ClientKey struct {
	es_models.ObjectRoot

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

type Compliance added in v0.70.0

type Compliance struct {
	NoneCompliant bool
	Problems      []string
}

func GetOIDCCompliance added in v0.70.0

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

func GetOIDCV1Compliance added in v0.70.0

func GetOIDCV1Compliance(appType OIDCApplicationType, grantTypes []OIDCGrantType, authMethod OIDCAuthMethodType, redirectUris []string) *Compliance

type OIDCApplicationType added in v0.6.0

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

type OIDCAuthMethodType added in v0.6.0

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

type OIDCConfig added in v0.6.0

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 added in v0.70.0

func (c *OIDCConfig) FillCompliance()

func (*OIDCConfig) GenerateClientSecretIfNeeded added in v0.69.1

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

func (*OIDCConfig) GenerateNewClientID added in v0.69.1

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

ClientID random_number@projectname (eg. 495894098234@zitadel)

func (*OIDCConfig) GenerateNewClientSecret added in v0.69.1

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

func (*OIDCConfig) IsValid added in v0.6.0

func (c *OIDCConfig) IsValid() bool

type OIDCGrantType added in v0.6.0

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

type OIDCResponseType added in v0.6.0

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

type OIDCTokenType added in v0.94.0

type OIDCTokenType int32
const (
	OIDCTokenTypeBearer OIDCTokenType = iota
	OIDCTokenTypeJWT
)

type OIDCVersion added in v0.70.0

type OIDCVersion int32
const (
	OIDCVersionV1 OIDCVersion = iota
)

type Project

type Project struct {
	es_models.ObjectRoot

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

func NewProject

func NewProject(id string) *Project

func (*Project) ContainsGrantForOrg added in v0.7.0

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

func (*Project) ContainsGrantMember added in v0.7.0

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

func (*Project) ContainsRole added in v0.6.0

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

func (*Project) ContainsRoles added in v0.7.0

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

func (*Project) GetApp added in v0.7.0

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

func (*Project) GetGrant added in v0.7.0

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

func (*Project) GetMember added in v0.7.0

func (p *Project) GetMember(userID string) (int, *ProjectMember)

func (*Project) IsActive

func (p *Project) IsActive() bool

func (*Project) IsValid

func (p *Project) IsValid() bool

type ProjectChange added in v0.25.1

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:"-"`
	Data         interface{}          `json:"data,omitempty"`
}

type ProjectChanges added in v0.25.1

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

type ProjectGrant added in v0.7.0

type ProjectGrant struct {
	es_models.ObjectRoot

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

func NewProjectGrant added in v0.7.0

func NewProjectGrant(projectID, grantID string) *ProjectGrant

func (*ProjectGrant) GetMember added in v0.7.0

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

func (*ProjectGrant) GetRemovedRoles added in v0.32.0

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

func (*ProjectGrant) IsActive added in v0.7.0

func (p *ProjectGrant) IsActive() bool

func (*ProjectGrant) IsValid added in v0.7.0

func (p *ProjectGrant) IsValid() bool

type ProjectGrantIDs added in v0.32.0

type ProjectGrantIDs struct {
	ProjectID string
	GrantID   string
}

type ProjectGrantMember added in v0.7.0

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

func NewProjectGrantMember added in v0.7.0

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

func (*ProjectGrantMember) IsValid added in v0.7.0

func (p *ProjectGrantMember) IsValid() bool

type ProjectGrantMemberSearchKey added in v0.11.0

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

type ProjectGrantMemberSearchQuery added in v0.11.0

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

type ProjectGrantMemberSearchRequest added in v0.11.0

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

func (*ProjectGrantMemberSearchRequest) EnsureLimit added in v0.11.0

func (r *ProjectGrantMemberSearchRequest) EnsureLimit(limit uint64)

type ProjectGrantMemberSearchResponse added in v0.11.0

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

type ProjectGrantMemberView added in v0.11.0

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

type ProjectGrantState added in v0.7.0

type ProjectGrantState int32
const (
	ProjectGrantStateActive ProjectGrantState = iota
	ProjectGrantStateInactive
)

type ProjectGrantView added in v0.25.0

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 added in v0.25.0

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

type ProjectGrantViewSearchQuery added in v0.25.0

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

type ProjectGrantViewSearchRequest added in v0.25.0

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

func (*ProjectGrantViewSearchRequest) AppendMyOrgQuery added in v0.25.0

func (r *ProjectGrantViewSearchRequest) AppendMyOrgQuery(orgID string)

func (*ProjectGrantViewSearchRequest) AppendMyResourceOwnerQuery added in v0.25.0

func (r *ProjectGrantViewSearchRequest) AppendMyResourceOwnerQuery(orgID string)

func (*ProjectGrantViewSearchRequest) AppendNotMyOrgQuery added in v0.25.0

func (r *ProjectGrantViewSearchRequest) AppendNotMyOrgQuery(orgID string)

func (*ProjectGrantViewSearchRequest) EnsureLimit added in v0.25.0

func (r *ProjectGrantViewSearchRequest) EnsureLimit(limit uint64)

func (*ProjectGrantViewSearchRequest) GetSearchQuery added in v0.62.0

type ProjectGrantViewSearchResponse added in v0.25.0

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

type ProjectMember added in v0.4.0

type ProjectMember struct {
	es_models.ObjectRoot

	UserID string
	Roles  []string
}

func NewProjectMember added in v0.4.0

func NewProjectMember(projectID, userID string) *ProjectMember

func (*ProjectMember) IsValid added in v0.4.0

func (p *ProjectMember) IsValid() bool

type ProjectMemberSearchKey added in v0.11.0

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

type ProjectMemberSearchQuery added in v0.11.0

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

type ProjectMemberSearchRequest added in v0.11.0

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

func (*ProjectMemberSearchRequest) AppendProjectQuery added in v0.24.0

func (r *ProjectMemberSearchRequest) AppendProjectQuery(projectID string)

func (*ProjectMemberSearchRequest) EnsureLimit added in v0.11.0

func (r *ProjectMemberSearchRequest) EnsureLimit(limit uint64)

type ProjectMemberSearchResponse added in v0.11.0

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

type ProjectMemberView added in v0.11.0

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

type ProjectRole added in v0.6.0

type ProjectRole struct {
	es_models.ObjectRoot

	Key         string
	DisplayName string
	Group       string
}

func NewProjectRole added in v0.6.0

func NewProjectRole(projectID, key string) *ProjectRole

func (*ProjectRole) IsValid added in v0.6.0

func (p *ProjectRole) IsValid() bool

type ProjectRoleSearchKey added in v0.11.0

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

type ProjectRoleSearchQuery added in v0.11.0

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

type ProjectRoleSearchRequest added in v0.11.0

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

func (*ProjectRoleSearchRequest) AppendMyOrgQuery added in v0.11.0

func (r *ProjectRoleSearchRequest) AppendMyOrgQuery(orgID string)

func (*ProjectRoleSearchRequest) AppendProjectQuery added in v0.24.0

func (r *ProjectRoleSearchRequest) AppendProjectQuery(projectID string)

func (*ProjectRoleSearchRequest) EnsureLimit added in v0.11.0

func (r *ProjectRoleSearchRequest) EnsureLimit(limit uint64)

type ProjectRoleSearchResponse added in v0.11.0

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

type ProjectRoleView added in v0.11.0

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 added in v0.25.0

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

type ProjectViewSearchKey added in v0.25.0

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

type ProjectViewSearchQuery added in v0.25.0

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

type ProjectViewSearchRequest added in v0.25.0

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

func (*ProjectViewSearchRequest) AppendMyResourceOwnerQuery added in v0.25.0

func (r *ProjectViewSearchRequest) AppendMyResourceOwnerQuery(orgID string)

func (*ProjectViewSearchRequest) EnsureLimit added in v0.25.0

func (r *ProjectViewSearchRequest) EnsureLimit(limit uint64)

func (*ProjectViewSearchRequest) GetSearchQuery added in v0.62.0

type ProjectViewSearchResponse added in v0.25.0

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

type Token added in v0.115.0

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