2020-08-26 07:56:23 +00:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/crypto"
|
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
caos_errors "github.com/zitadel/zitadel/internal/errors"
|
2021-04-06 14:03:07 +00:00
|
|
|
|
2020-08-26 07:56:23 +00:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type IDPConfigView struct {
|
|
|
|
AggregateID string
|
|
|
|
IDPConfigID string
|
|
|
|
Name string
|
2020-10-19 15:10:02 +00:00
|
|
|
StylingType IDPStylingType
|
2021-09-10 07:49:49 +00:00
|
|
|
AutoRegister bool
|
2020-08-26 07:56:23 +00:00
|
|
|
State IDPConfigState
|
|
|
|
CreationDate time.Time
|
|
|
|
ChangeDate time.Time
|
|
|
|
Sequence uint64
|
|
|
|
IDPProviderType IDPProviderType
|
|
|
|
|
2021-07-06 14:39:48 +00:00
|
|
|
IsOIDC bool
|
|
|
|
OIDCClientID string
|
|
|
|
OIDCClientSecret *crypto.CryptoValue
|
|
|
|
OIDCIssuer string
|
|
|
|
OIDCScopes []string
|
|
|
|
OIDCIDPDisplayNameMapping OIDCMappingField
|
|
|
|
OIDCUsernameMapping OIDCMappingField
|
|
|
|
OAuthAuthorizationEndpoint string
|
|
|
|
OAuthTokenEndpoint string
|
2021-09-14 13:15:01 +00:00
|
|
|
JWTEndpoint string
|
|
|
|
JWTIssuer string
|
|
|
|
JWTKeysEndpoint string
|
|
|
|
JWTHeaderName string
|
2020-08-26 07:56:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type IDPConfigSearchRequest struct {
|
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
|
|
|
SortingColumn IDPConfigSearchKey
|
|
|
|
Asc bool
|
|
|
|
Queries []*IDPConfigSearchQuery
|
|
|
|
}
|
|
|
|
|
|
|
|
type IDPConfigSearchKey int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
IDPConfigSearchKeyUnspecified IDPConfigSearchKey = iota
|
|
|
|
IDPConfigSearchKeyName
|
|
|
|
IDPConfigSearchKeyAggregateID
|
|
|
|
IDPConfigSearchKeyIdpConfigID
|
|
|
|
IDPConfigSearchKeyIdpProviderType
|
2022-03-23 08:02:39 +00:00
|
|
|
IDPConfigSearchKeyInstanceID
|
2022-11-30 16:01:17 +00:00
|
|
|
IDPConfigSearchKeyOwnerRemoved
|
2020-08-26 07:56:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type IDPConfigSearchQuery struct {
|
|
|
|
Key IDPConfigSearchKey
|
2021-03-01 07:48:50 +00:00
|
|
|
Method domain.SearchMethod
|
2020-08-26 07:56:23 +00:00
|
|
|
Value interface{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type IDPConfigSearchResponse struct {
|
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
|
|
|
TotalResult uint64
|
|
|
|
Result []*IDPConfigView
|
|
|
|
Sequence uint64
|
|
|
|
Timestamp time.Time
|
|
|
|
}
|
|
|
|
|
2021-04-06 14:03:07 +00:00
|
|
|
func (r *IDPConfigSearchRequest) EnsureLimit(limit uint64) error {
|
|
|
|
if r.Limit > limit {
|
|
|
|
return caos_errors.ThrowInvalidArgument(nil, "SEARCH-Mv9sd", "Errors.Limit.ExceedsDefault")
|
|
|
|
}
|
|
|
|
if r.Limit == 0 {
|
2020-08-26 07:56:23 +00:00
|
|
|
r.Limit = limit
|
|
|
|
}
|
2021-04-06 14:03:07 +00:00
|
|
|
return nil
|
2020-08-26 07:56:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *IDPConfigSearchRequest) AppendMyOrgQuery(orgID, iamID string) {
|
2021-03-01 07:48:50 +00:00
|
|
|
r.Queries = append(r.Queries, &IDPConfigSearchQuery{Key: IDPConfigSearchKeyAggregateID, Method: domain.SearchMethodIsOneOf, Value: []string{orgID, iamID}})
|
2020-08-26 07:56:23 +00:00
|
|
|
}
|