fix: primary domain scope (handle context correctly) (#3872)

This commit is contained in:
Livio Spring
2022-06-27 09:24:23 +02:00
committed by GitHub
parent 02d49cdc88
commit 1b4740c78f
5 changed files with 11 additions and 15 deletions

View File

@@ -137,7 +137,7 @@ func (repo *AuthRequestRepo) CreateAuthRequest(ctx context.Context, request *dom
request.AppendAudIfNotExisting(project.ID)
request.ApplicationResourceOwner = project.ResourceOwner
request.PrivateLabelingSetting = project.PrivateLabelingSetting
if err := setOrgID(repo.OrgViewProvider, request); err != nil {
if err := setOrgID(ctx, repo.OrgViewProvider, request); err != nil {
return nil, err
}
if request.LoginHint != "" {
@@ -1053,13 +1053,13 @@ func (repo *AuthRequestRepo) hasSucceededPage(ctx context.Context, request *doma
return app.OIDCConfig.AppType == domain.OIDCApplicationTypeNative, nil
}
func setOrgID(orgViewProvider orgViewProvider, request *domain.AuthRequest) error {
func setOrgID(ctx context.Context, orgViewProvider orgViewProvider, request *domain.AuthRequest) error {
primaryDomain := request.GetScopeOrgPrimaryDomain()
if primaryDomain == "" {
return nil
}
org, err := orgViewProvider.OrgByDomainGlobal(context.TODO(), primaryDomain)
org, err := orgViewProvider.OrgByDomainGlobal(ctx, primaryDomain)
if err != nil {
return err
}