feat: add gitlab provider templates (#5405)

* feat(api): add google provider template

* refactor reduce functions

* handle removed event

* linting

* fix projection

* feat(api): add generic oauth provider template

* feat(api): add github provider templates

* feat(api): add github provider templates

* fixes

* proto comment

* fix filtering

* requested changes

* feat(api): add generic oauth provider template

* remove wrongly committed message

* increase budget for angular build

* fix linting

* fixes

* fix merge

* fix merge

* fix projection

* fix merge

* updates from previous PRs

* enable github providers in login

* fix merge

* fix test and add github styling in login

* cleanup

* feat(api): add gitlab provider templates

* fix: merge

* fix display of providers in login

* implement gitlab in login and make prompt `select_account` optional since gitlab can't handle it

* fix merge

* fix merge and add tests for command side

* requested changes

* requested changes

* Update internal/query/idp_template.go

Co-authored-by: Silvan <silvan.reusser@gmail.com>

* fix merge

* requested changes

---------

Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
Livio Spring
2023-03-13 17:34:29 +01:00
committed by GitHub
parent f55877eb70
commit c0843e6b4c
41 changed files with 5617 additions and 227 deletions

View File

@@ -36,12 +36,22 @@ const (
)
func (t IDPType) GetCSSClass() string {
switch t { //nolint:exhaustive
switch t {
case IDPTypeGoogle:
return "google"
case IDPTypeGitHub,
IDPTypeGitHubEnterprise:
return "github"
case IDPTypeGitLab,
IDPTypeGitLabSelfHosted:
return "gitlab"
case IDPTypeUnspecified,
IDPTypeOIDC,
IDPTypeJWT,
IDPTypeOAuth,
IDPTypeLDAP,
IDPTypeAzureAD:
fallthrough
default:
return ""
}

View File

@@ -4,6 +4,8 @@ import (
"net/url"
"time"
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
)
@@ -65,6 +67,35 @@ func (p IDPProvider) IsValid() bool {
return p.IDPConfigID != ""
}
// DisplayName returns the name or a default
// to be used when always a name must be displayed (e.g. login)
func (p IDPProvider) DisplayName() string {
if p.Name != "" {
return p.Name
}
switch p.IDPType {
case IDPTypeGitHub:
return "GitHub"
case IDPTypeGitLab:
return "GitLab"
case IDPTypeGoogle:
return "Google"
case IDPTypeUnspecified,
IDPTypeOIDC,
IDPTypeJWT,
IDPTypeOAuth,
IDPTypeLDAP,
IDPTypeAzureAD,
IDPTypeGitHubEnterprise,
IDPTypeGitLabSelfHosted:
fallthrough
default:
// we should never get here, so log it
logging.Errorf("name of provider (type %d) is empty - id: %s", p.IDPType, p.IDPConfigID)
return ""
}
}
type PasswordlessType int32
const (