mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
8dcbbc87ca
* fix: adaot config to commands (and queries) * remove dependency on vv2 in v1 * add queries user to operator * set password for queries on tests * set password for queries on tests * fix config
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package eventstore
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/zitadel/internal/auth/repository/eventsourcing/view"
|
|
"github.com/caos/zitadel/internal/command"
|
|
"github.com/caos/zitadel/internal/project/model"
|
|
proj_view_model "github.com/caos/zitadel/internal/project/repository/view/model"
|
|
"github.com/caos/zitadel/internal/telemetry/tracing"
|
|
)
|
|
|
|
type ApplicationRepo struct {
|
|
Commands *command.Commands
|
|
View *view.View
|
|
}
|
|
|
|
func (a *ApplicationRepo) ApplicationByClientID(ctx context.Context, clientID string) (*model.ApplicationView, error) {
|
|
app, err := a.View.ApplicationByClientID(ctx, clientID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return proj_view_model.ApplicationViewToModel(app), nil
|
|
}
|
|
|
|
func (a *ApplicationRepo) AuthorizeOIDCApplication(ctx context.Context, clientID, secret string) (err error) {
|
|
ctx, span := tracing.NewSpan(ctx)
|
|
defer func() { span.EndWithError(err) }()
|
|
|
|
app, err := a.View.ApplicationByClientID(ctx, clientID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return a.Commands.VerifyOIDCClientSecret(ctx, app.ProjectID, app.ID, secret)
|
|
}
|