mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
2f7d8ca557
* fix: client secret verification (for introspection) * revert change for ProjectIDAndOriginsByClientID
29 lines
731 B
Go
29 lines
731 B
Go
package eventstore
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/zitadel/internal/command"
|
|
"github.com/caos/zitadel/internal/query"
|
|
"github.com/caos/zitadel/internal/telemetry/tracing"
|
|
)
|
|
|
|
type ApplicationRepo struct {
|
|
Commands *command.Commands
|
|
Query *query.Queries
|
|
}
|
|
|
|
func (a *ApplicationRepo) AuthorizeClientIDSecret(ctx context.Context, clientID, secret string) (err error) {
|
|
ctx, span := tracing.NewSpan(ctx)
|
|
defer func() { span.EndWithError(err) }()
|
|
|
|
app, err := a.Query.AppByClientID(ctx, clientID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if app.OIDCConfig != nil {
|
|
return a.Commands.VerifyOIDCClientSecret(ctx, app.ProjectID, app.ID, secret)
|
|
}
|
|
return a.Commands.VerifyAPIClientSecret(ctx, app.ProjectID, app.ID, secret)
|
|
}
|