2020-07-08 11:56:37 +00:00
|
|
|
package auth
|
|
|
|
|
|
|
|
import (
|
2021-02-23 14:13:04 +00:00
|
|
|
"github.com/caos/zitadel/internal/command"
|
|
|
|
"github.com/caos/zitadel/internal/query"
|
2020-07-08 11:56:37 +00:00
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
|
|
|
"github.com/caos/zitadel/internal/api/authz"
|
|
|
|
"github.com/caos/zitadel/internal/api/grpc/server"
|
|
|
|
"github.com/caos/zitadel/internal/auth/repository"
|
|
|
|
"github.com/caos/zitadel/internal/auth/repository/eventsourcing"
|
|
|
|
"github.com/caos/zitadel/pkg/grpc/auth"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ auth.AuthServiceServer = (*Server)(nil)
|
|
|
|
|
|
|
|
const (
|
|
|
|
authName = "Auth-API"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Server struct {
|
2021-02-24 10:17:39 +00:00
|
|
|
command *command.Commands
|
|
|
|
query *query.Queries
|
2021-01-07 15:06:45 +00:00
|
|
|
repo repository.Repository
|
2020-07-08 11:56:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
Repository eventsourcing.Config
|
|
|
|
}
|
|
|
|
|
2021-02-24 10:17:39 +00:00
|
|
|
func CreateServer(command *command.Commands, query *query.Queries, authRepo repository.Repository) *Server {
|
2020-07-08 11:56:37 +00:00
|
|
|
return &Server{
|
2021-01-07 15:06:45 +00:00
|
|
|
command: command,
|
|
|
|
query: query,
|
|
|
|
repo: authRepo,
|
2020-07-08 11:56:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) RegisterServer(grpcServer *grpc.Server) {
|
|
|
|
auth.RegisterAuthServiceServer(grpcServer, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) AppName() string {
|
|
|
|
return authName
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) MethodPrefix() string {
|
|
|
|
return auth.AuthService_MethodPrefix
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) AuthMethods() authz.MethodMapping {
|
|
|
|
return auth.AuthService_AuthMethods
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) RegisterGateway() server.GatewayFunc {
|
|
|
|
return auth.RegisterAuthServiceHandlerFromEndpoint
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) GatewayPathPrefix() string {
|
|
|
|
return "/auth/v1"
|
|
|
|
}
|