fix: IDP login button styles (#869)

* fix: styling type on idp

* fix: google styling

* fix: google styling

* fix: google styling

* fix: remove logo src from angular

* fix: pr requests

* fix drop column migration

* fix: drop column migration

* fix: grant id
This commit is contained in:
Fabi
2020-10-19 17:10:02 +02:00
committed by GitHub
parent bb9747923c
commit 4eb380a825
43 changed files with 19230 additions and 10514 deletions

View File

@@ -10,7 +10,7 @@ type IDPConfig struct {
IDPConfigID string
Type IdpConfigType
Name string
LogoSrc []byte
StylingType IDPStylingType
State IDPConfigState
OIDCConfig *OIDCIDPConfig
}
@@ -42,6 +42,13 @@ const (
IDPConfigStateRemoved
)
type IDPStylingType int32
const (
IDPStylingTypeUnspecified IDPStylingType = iota
IDPStylingTypeGoogle
)
type OIDCMappingField int32
const (
@@ -82,3 +89,12 @@ func (oi *OIDCIDPConfig) CryptSecret(crypt crypto.Crypto) error {
oi.ClientSecret = cryptedSecret
return nil
}
func (st IDPStylingType) GetCSSClass() string {
switch st {
case IDPStylingTypeGoogle:
return "google"
default:
return ""
}
}

View File

@@ -10,7 +10,7 @@ type IDPConfigView struct {
AggregateID string
IDPConfigID string
Name string
LogoSrc []byte
StylingType IDPStylingType
State IDPConfigState
CreationDate time.Time
ChangeDate time.Time

View File

@@ -10,6 +10,7 @@ type IDPProviderView struct {
IDPConfigID string
IDPProviderType IDPProviderType
Name string
StylingType IDPStylingType
IDPConfigType IdpConfigType
IDPState IDPConfigState

View File

@@ -1,7 +1,6 @@
package model
import (
"bytes"
"encoding/json"
"github.com/caos/logging"
es_models "github.com/caos/zitadel/internal/eventstore/models"
@@ -14,7 +13,7 @@ type IDPConfig struct {
State int32 `json:"-"`
Name string `json:"name,omitempty"`
Type int32 `json:"idpType,omitempty"`
LogoSrc []byte `json:"logoSrc,omitempty"`
StylingType int32 `json:"stylingType,omitempty"`
OIDCIDPConfig *OIDCIDPConfig `json:"-"`
}
@@ -39,8 +38,8 @@ func (c *IDPConfig) Changes(changed *IDPConfig) map[string]interface{} {
if changed.Name != "" && c.Name != changed.Name {
changes["name"] = changed.Name
}
if changed.LogoSrc != nil && bytes.Equal(c.LogoSrc, changed.LogoSrc) {
changes["logoSrc"] = changed.LogoSrc
if changed.StylingType != changed.StylingType {
changes["stylingType"] = changed.StylingType
}
return changes
}
@@ -68,7 +67,7 @@ func IDPConfigFromModel(idp *model.IDPConfig) *IDPConfig {
Name: idp.Name,
State: int32(idp.State),
Type: int32(idp.Type),
LogoSrc: idp.LogoSrc,
StylingType: int32(idp.StylingType),
}
if idp.OIDCConfig != nil {
converted.OIDCIDPConfig = OIDCIDPConfigFromModel(idp.OIDCConfig)
@@ -81,7 +80,7 @@ func IDPConfigToModel(idp *IDPConfig) *model.IDPConfig {
ObjectRoot: idp.ObjectRoot,
IDPConfigID: idp.IDPConfigID,
Name: idp.Name,
LogoSrc: idp.LogoSrc,
StylingType: model.IDPStylingType(idp.StylingType),
State: model.IDPConfigState(idp.State),
Type: model.IdpConfigType(idp.Type),
}

View File

@@ -26,7 +26,7 @@ type IDPConfigView struct {
IDPConfigID string `json:"idpConfigId" gorm:"column:idp_config_id;primary_key"`
AggregateID string `json:"-" gorm:"column:aggregate_id"`
Name string `json:"name" gorm:"column:name"`
LogoSrc []byte `json:"logoSrc" gorm:"column:logo_src"`
StylingType int32 `json:"stylingType" gorm:"column:styling_type"`
CreationDate time.Time `json:"-" gorm:"column:creation_date"`
ChangeDate time.Time `json:"-" gorm:"column:change_date"`
IDPState int32 `json:"-" gorm:"column:idp_state"`
@@ -49,7 +49,7 @@ func IDPConfigViewFromModel(idp *model.IDPConfigView) *IDPConfigView {
AggregateID: idp.AggregateID,
IDPState: int32(idp.State),
Name: idp.Name,
LogoSrc: idp.LogoSrc,
StylingType: int32(idp.StylingType),
Sequence: idp.Sequence,
CreationDate: idp.CreationDate,
ChangeDate: idp.ChangeDate,
@@ -70,7 +70,7 @@ func IDPConfigViewToModel(idp *IDPConfigView) *model.IDPConfigView {
AggregateID: idp.AggregateID,
State: model.IDPConfigState(idp.IDPState),
Name: idp.Name,
LogoSrc: idp.LogoSrc,
StylingType: model.IDPStylingType(idp.StylingType),
Sequence: idp.Sequence,
CreationDate: idp.CreationDate,
ChangeDate: idp.ChangeDate,

View File

@@ -27,6 +27,7 @@ type IDPProviderView struct {
ChangeDate time.Time `json:"-" gorm:"column:change_date"`
Name string `json:"-" gorm:"column:name"`
StylingType int32 `json:"-" gorm:"column:styling_type"`
IDPConfigType int32 `json:"-" gorm:"column:idp_config_type"`
IDPProviderType int32 `json:"idpProviderType" gorm:"column:idp_provider_type"`
IDPState int32 `json:"-" gorm:"column:idp_state"`
@@ -41,6 +42,7 @@ func IDPProviderViewFromModel(provider *model.IDPProviderView) *IDPProviderView
CreationDate: provider.CreationDate,
ChangeDate: provider.ChangeDate,
Name: provider.Name,
StylingType: int32(provider.StylingType),
IDPConfigID: provider.IDPConfigID,
IDPConfigType: int32(provider.IDPConfigType),
IDPProviderType: int32(provider.IDPProviderType),
@@ -55,6 +57,7 @@ func IDPProviderViewToModel(provider *IDPProviderView) *model.IDPProviderView {
CreationDate: provider.CreationDate,
ChangeDate: provider.ChangeDate,
Name: provider.Name,
StylingType: model.IDPStylingType(provider.StylingType),
IDPConfigID: provider.IDPConfigID,
IDPConfigType: model.IdpConfigType(provider.IDPConfigType),
IDPProviderType: model.IDPProviderType(provider.IDPProviderType),