2020-08-26 09:56:23 +02:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/caos/zitadel/internal/crypto"
|
2021-03-01 08:48:50 +01:00
|
|
|
"github.com/caos/zitadel/internal/domain"
|
2021-04-06 16:03:07 +02:00
|
|
|
caos_errors "github.com/caos/zitadel/internal/errors"
|
|
|
|
|
2020-08-26 09:56:23 +02:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type IDPConfigView struct {
|
|
|
|
AggregateID string
|
|
|
|
IDPConfigID string
|
|
|
|
Name string
|
2020-10-19 17:10:02 +02:00
|
|
|
StylingType IDPStylingType
|
2021-09-10 09:49:49 +02:00
|
|
|
AutoRegister bool
|
2020-08-26 09:56:23 +02:00
|
|
|
State IDPConfigState
|
|
|
|
CreationDate time.Time
|
|
|
|
ChangeDate time.Time
|
|
|
|
Sequence uint64
|
|
|
|
IDPProviderType IDPProviderType
|
|
|
|
|
2021-07-06 16:39:48 +02:00
|
|
|
IsOIDC bool
|
|
|
|
OIDCClientID string
|
|
|
|
OIDCClientSecret *crypto.CryptoValue
|
|
|
|
OIDCIssuer string
|
|
|
|
OIDCScopes []string
|
|
|
|
OIDCIDPDisplayNameMapping OIDCMappingField
|
|
|
|
OIDCUsernameMapping OIDCMappingField
|
|
|
|
OAuthAuthorizationEndpoint string
|
|
|
|
OAuthTokenEndpoint string
|
2021-09-14 15:15:01 +02:00
|
|
|
JWTEndpoint string
|
|
|
|
JWTIssuer string
|
|
|
|
JWTKeysEndpoint string
|
|
|
|
JWTHeaderName string
|
2020-08-26 09:56:23 +02: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
|
|
|
|
)
|
|
|
|
|
|
|
|
type IDPConfigSearchQuery struct {
|
|
|
|
Key IDPConfigSearchKey
|
2021-03-01 08:48:50 +01:00
|
|
|
Method domain.SearchMethod
|
2020-08-26 09:56:23 +02:00
|
|
|
Value interface{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type IDPConfigSearchResponse struct {
|
|
|
|
Offset uint64
|
|
|
|
Limit uint64
|
|
|
|
TotalResult uint64
|
|
|
|
Result []*IDPConfigView
|
|
|
|
Sequence uint64
|
|
|
|
Timestamp time.Time
|
|
|
|
}
|
|
|
|
|
2021-04-06 16:03:07 +02: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 09:56:23 +02:00
|
|
|
r.Limit = limit
|
|
|
|
}
|
2021-04-06 16:03:07 +02:00
|
|
|
return nil
|
2020-08-26 09:56:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *IDPConfigSearchRequest) AppendMyOrgQuery(orgID, iamID string) {
|
2021-03-01 08:48:50 +01:00
|
|
|
r.Queries = append(r.Queries, &IDPConfigSearchQuery{Key: IDPConfigSearchKeyAggregateID, Method: domain.SearchMethodIsOneOf, Value: []string{orgID, iamID}})
|
2020-08-26 09:56:23 +02:00
|
|
|
}
|