mirror of
https://github.com/zitadel/zitadel.git
synced 2025-10-26 11:21:06 +00:00
feat: display login succeeded page only for native apps (#2839)
This commit is contained in:
@@ -46,6 +46,7 @@ type AuthRequestRepo struct {
|
||||
IDPProviderViewProvider idpProviderViewProvider
|
||||
UserGrantProvider userGrantProvider
|
||||
ProjectProvider projectProvider
|
||||
ApplicationProvider applicationProvider
|
||||
|
||||
IdGenerator id.Generator
|
||||
|
||||
@@ -111,6 +112,10 @@ type projectProvider interface {
|
||||
OrgProjectMappingByIDs(orgID, projectID string) (*project_view_model.OrgProjectMapping, error)
|
||||
}
|
||||
|
||||
type applicationProvider interface {
|
||||
AppByOIDCClientID(context.Context, string) (*query.App, error)
|
||||
}
|
||||
|
||||
func (repo *AuthRequestRepo) Health(ctx context.Context) error {
|
||||
return repo.AuthRequests.Health(ctx)
|
||||
}
|
||||
@@ -798,6 +803,13 @@ func (repo *AuthRequestRepo) nextSteps(ctx context.Context, request *domain.Auth
|
||||
return append(steps, &domain.GrantRequiredStep{}), nil
|
||||
}
|
||||
|
||||
ok, err = repo.hasSucceededPage(ctx, request, repo.ApplicationProvider)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ok {
|
||||
steps = append(steps, &domain.LoginSucceededStep{})
|
||||
}
|
||||
return append(steps, &domain.RedirectToCallbackStep{}), nil
|
||||
}
|
||||
|
||||
@@ -986,6 +998,14 @@ func (repo *AuthRequestRepo) getLoginTexts(ctx context.Context, aggregateID stri
|
||||
return iam_view_model.CustomTextViewsToDomain(loginTexts), err
|
||||
}
|
||||
|
||||
func (repo *AuthRequestRepo) hasSucceededPage(ctx context.Context, request *domain.AuthRequest, provider applicationProvider) (bool, error) {
|
||||
app, err := provider.AppByOIDCClientID(ctx, request.ApplicationID)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return app.OIDCConfig.AppType == domain.OIDCApplicationTypeNative, nil
|
||||
}
|
||||
|
||||
func setOrgID(orgViewProvider orgViewProvider, request *domain.AuthRequest) error {
|
||||
primaryDomain := request.GetScopeOrgPrimaryDomain()
|
||||
if primaryDomain == "" {
|
||||
|
||||
Reference in New Issue
Block a user