Authenticate Handler API and SDK, and much more (#183)
This commit is contained in:
1 parent
acce195dcb
commit
28dbcd84bd
89 files changed
+5296
-1943
No files matched your search
@@ -36,6 +36,7 @@ type Command struct {
|
||||
flagDev bool
|
||||
flagDevAdminPassword string
|
||||
flagDevOrgId string
|
||||
flagDevAuthMethodId string
|
||||
flagDevControllerAPIListenAddr string
|
||||
flagDevControllerClusterListenAddr string
|
||||
flagDevPassthroughDirectory string
|
||||
@@ -92,6 +93,14 @@ func (c *Command) Flags() *base.FlagSets {
|
||||
"mode.",
|
||||
})
|
||||
|
||||
f.StringVar(&base.StringVar{
|
||||
Name: "dev-auth-method-id",
|
||||
Target: &c.flagDevAuthMethodId,
|
||||
EnvVar: "WATCHTWER_DEV_AUTH_METHOD_ID",
|
||||
Usage: "Auto-created auth method ID. This only applies when running in \"dev\" " +
|
||||
"mode.",
|
||||
})
|
||||
|
||||
f.StringVar(&base.StringVar{
|
||||
Name: "dev-admin-password",
|
||||
Target: &c.flagDevAdminPassword,
|
||||
@@ -155,6 +164,18 @@ func (c *Command) Run(args []string) int {
|
||||
if c.flagDevOrgId != "" {
|
||||
devConfig.DefaultOrgId = c.flagDevOrgId
|
||||
}
|
||||
if c.flagDevAuthMethodId != "" {
|
||||
if !strings.HasPrefix(c.flagDevAuthMethodId, "am_") {
|
||||
c.UI.Error(fmt.Sprintf("Invalid dev auth method ID, must start with %q", "am_"))
|
||||
return 1
|
||||
}
|
||||
if len(c.flagDevAuthMethodId) != 13 {
|
||||
c.UI.Error(fmt.Sprintf("Invalid dev auth method ID, must be 10 base62 characters after %q", "am_"))
|
||||
return 1
|
||||
}
|
||||
c.DevAuthMethodId = c.flagDevAuthMethodId
|
||||
}
|
||||
|
||||
devConfig.PassthroughDirectory = c.flagDevPassthroughDirectory
|
||||
|
||||
for _, l := range devConfig.Listeners {
|
||||
|
||||
Reference in new issue
Block a user