remove storage from server

This commit is contained in:
Tim Möhlmann
2023-11-13 19:38:52 +02:00
parent 292d7d85dd
commit 9c0f38ef94
4 changed files with 8 additions and 7 deletions

View File

@@ -148,9 +148,9 @@ func (s *Server) clientFromCredentials(ctx context.Context, cc *op.ClientCredent
if _, err := oidc.ParseToken(cc.ClientAssertion, claims); err != nil {
return nil, oidc.ErrUnauthorizedClient().WithParent(err)
}
client, err = s.storage.query.GetIntrospectionClientByID(ctx, claims.Issuer, true)
client, err = s.query.GetIntrospectionClientByID(ctx, claims.Issuer, true)
} else {
client, err = s.storage.query.GetIntrospectionClientByID(ctx, cc.ClientID, false)
client, err = s.query.GetIntrospectionClientByID(ctx, cc.ClientID, false)
}
if errors.Is(err, sql.ErrNoRows) {
return nil, oidc.ErrUnauthorizedClient().WithParent(err)
@@ -195,7 +195,7 @@ func (s *Server) introspectionToken(ctx context.Context, accessToken string, rc
}
if strings.HasPrefix(tokenID, command.IDPrefixV2) {
token, err := s.storage.query.ActiveAccessTokenByToken(ctx, tokenID)
token, err := s.query.ActiveAccessTokenByToken(ctx, tokenID)
if err != nil {
rc <- &introspectionTokenResult{err: err}
return nil, err
@@ -203,7 +203,7 @@ func (s *Server) introspectionToken(ctx context.Context, accessToken string, rc
return introspectionTokenResultV2(tokenID, subject, token), nil
}
token, err := s.storage.repo.TokenByIDs(ctx, subject, tokenID)
token, err := s.repo.TokenByIDs(ctx, subject, tokenID)
if err != nil {
return nil, errz.ThrowPermissionDenied(err, "OIDC-Dsfb2", "token is not valid or has expired")
}

View File

@@ -119,8 +119,8 @@ func NewServer(
}
server := &Server{
storage: storage,
LegacyServer: op.NewLegacyServer(provider, endpoints(config.CustomEndpoints)),
repo: repo,
query: query,
command: command,
keySet: newKeySet(context.TODO(), time.Hour, query.GetActivePublicKeyByID),

View File

@@ -10,6 +10,7 @@ import (
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/zitadel/internal/auth/repository"
"github.com/zitadel/zitadel/internal/command"
"github.com/zitadel/zitadel/internal/crypto"
"github.com/zitadel/zitadel/internal/query"
@@ -18,9 +19,9 @@ import (
type Server struct {
http.Handler
storage *OPStorage
*op.LegacyServer
repo repository.Repository
query *query.Queries
command *command.Commands
keySet *keySetCache

View File

@@ -72,7 +72,7 @@ type userInfoResult struct {
}
func (s *Server) getUserInfo(ctx context.Context, userID string, rc chan<- *userInfoResult) {
userInfo, err := s.storage.query.GetOIDCUserInfo(ctx, userID)
userInfo, err := s.query.GetOIDCUserInfo(ctx, userID)
rc <- &userInfoResult{
userInfo: userInfo,
err: err,