feat: Add user scoped git ssh keys (#834)

This commit is contained in:
Garrett Delfosse
2022-04-06 00:18:26 +00:00
committed by GitHub
parent 1e9e5f7c76
commit 9da17be61e
19 changed files with 924 additions and 2 deletions
+6 -1
View File
@@ -14,6 +14,7 @@ import (
"cdr.dev/slog"
"github.com/coder/coder/coderd/awsidentity"
"github.com/coder/coder/coderd/database"
"github.com/coder/coder/coderd/gitsshkey"
"github.com/coder/coder/coderd/httpapi"
"github.com/coder/coder/coderd/httpmw"
"github.com/coder/coder/site"
@@ -30,7 +31,8 @@ type Options struct {
AWSCertificates awsidentity.Certificates
GoogleTokenValidator *idtoken.Validator
SecureAuthCookie bool
SecureAuthCookie bool
SSHKeygenAlgorithm gitsshkey.Algorithm
}
// New constructs the Coder API into an HTTP handler.
@@ -146,6 +148,8 @@ func New(options *Options) (http.Handler, func()) {
r.Get("/", api.workspacesByUser)
r.Get("/{workspacename}", api.workspaceByUserAndName)
})
r.Get("/gitsshkey", api.gitSSHKey)
r.Put("/gitsshkey", api.regenerateGitSSHKey)
})
})
})
@@ -157,6 +161,7 @@ func New(options *Options) (http.Handler, func()) {
r.Route("/agent", func(r chi.Router) {
r.Use(httpmw.ExtractWorkspaceAgent(options.Database))
r.Get("/", api.workspaceAgentListen)
r.Get("/gitsshkey", api.agentGitSSHKey)
})
r.Route("/{workspaceresource}", func(r chi.Router) {
r.Use(