2023-04-11 13:37:42 +00:00
|
|
|
package user
|
|
|
|
|
|
|
|
import (
|
2023-05-24 18:29:58 +00:00
|
|
|
"context"
|
|
|
|
|
2023-04-11 13:37:42 +00:00
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/api/authz"
|
|
|
|
"github.com/zitadel/zitadel/internal/api/grpc/server"
|
|
|
|
"github.com/zitadel/zitadel/internal/command"
|
2023-04-25 07:02:29 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/crypto"
|
2023-04-11 13:37:42 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/query"
|
2023-09-13 12:43:01 +00:00
|
|
|
user "github.com/zitadel/zitadel/pkg/grpc/user/v2beta"
|
2023-04-11 13:37:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ user.UserServiceServer = (*Server)(nil)
|
|
|
|
|
|
|
|
type Server struct {
|
|
|
|
user.UnimplementedUserServiceServer
|
2023-04-25 07:02:29 +00:00
|
|
|
command *command.Commands
|
|
|
|
query *query.Queries
|
|
|
|
userCodeAlg crypto.EncryptionAlgorithm
|
2023-05-24 18:29:58 +00:00
|
|
|
idpAlg crypto.EncryptionAlgorithm
|
|
|
|
idpCallback func(ctx context.Context) string
|
2023-09-29 09:26:14 +00:00
|
|
|
samlRootURL func(ctx context.Context, idpID string) string
|
2023-04-11 13:37:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Config struct{}
|
|
|
|
|
2023-05-24 18:29:58 +00:00
|
|
|
func CreateServer(
|
|
|
|
command *command.Commands,
|
|
|
|
query *query.Queries,
|
|
|
|
userCodeAlg crypto.EncryptionAlgorithm,
|
|
|
|
idpAlg crypto.EncryptionAlgorithm,
|
|
|
|
idpCallback func(ctx context.Context) string,
|
2023-09-29 09:26:14 +00:00
|
|
|
samlRootURL func(ctx context.Context, idpID string) string,
|
2023-05-24 18:29:58 +00:00
|
|
|
) *Server {
|
2023-04-11 13:37:42 +00:00
|
|
|
return &Server{
|
2023-04-25 07:02:29 +00:00
|
|
|
command: command,
|
|
|
|
query: query,
|
|
|
|
userCodeAlg: userCodeAlg,
|
2023-05-24 18:29:58 +00:00
|
|
|
idpAlg: idpAlg,
|
|
|
|
idpCallback: idpCallback,
|
2023-09-29 09:26:14 +00:00
|
|
|
samlRootURL: samlRootURL,
|
2023-04-11 13:37:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) RegisterServer(grpcServer *grpc.Server) {
|
|
|
|
user.RegisterUserServiceServer(grpcServer, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) AppName() string {
|
|
|
|
return user.UserService_ServiceDesc.ServiceName
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) MethodPrefix() string {
|
|
|
|
return user.UserService_ServiceDesc.ServiceName
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) AuthMethods() authz.MethodMapping {
|
|
|
|
return user.UserService_AuthMethods
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) RegisterGateway() server.RegisterGatewayFunc {
|
|
|
|
return user.RegisterUserServiceHandler
|
|
|
|
}
|