Skip to content

Commit cf4dfb4

Browse files
committed
refactor(server): extract the gRPC API into server/apiserver
Move the gRPC management API out of the Server god object into its own package, split by domain (clients, passwords, connectors, refresh, sessions, identities, mfa) with the constructor and shared helpers in api.go. dexAPI held a *Server but used only two things from it: the connector cache (to invalidate on connector CRUD) and the discovery-document builder. NewAPI now takes those two narrow dependencies instead, so apiserver no longer depends on the server package. The server exposes the API through a thin GRPCAPI method. The bcrypt hash-cost check is shared by the API (on password create) and the local passwordDB connector (on login), so it moves to a small server/passwords package that both import, rather than being duplicated or forcing a server -> apiserver dependency. Signed-off-by: maksim.nabokikh <max.nabokih@gmail.com>
1 parent b949756 commit cf4dfb4

17 files changed

Lines changed: 1329 additions & 1225 deletions

cmd/dex/serve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ func runServe(options serveOptions) error {
593593
}
594594

595595
grpcSrv := grpc.NewServer(grpcOptions...)
596-
api.RegisterDexServer(grpcSrv, server.NewAPI(serverConfig.Storage, logger, version, serv))
596+
api.RegisterDexServer(grpcSrv, serv.GRPCAPI(version))
597597

598598
grpcMetrics.InitializeMetrics(grpcSrv)
599599
if c.GRPC.Reflection {

0 commit comments

Comments
 (0)