-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
58 lines (50 loc) · 1.62 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"github.com/kogosoftwarellc/auth0-add-uris/types"
"github.com/kogosoftwarellc/go-simple-logging"
"gopkg.in/alecthomas/kingpin.v2"
"github.com/kogosoftwarellc/auth0-add-uris/helpers"
"os"
)
func main() {
logger := logging.NewLogger()
appClientId := kingpin.Flag("app-client-id", "The client id for the app client").
Required().String()
clientId := kingpin.Flag("client-id", "The client id for the non interactive client").
Required().String()
clientSecret := kingpin.Flag("client-secret", "The client secret for the non interactive client").
Required().String()
domain := kingpin.Flag("domain", "The domain of the auth0 app").
Required().String()
callbacks := kingpin.Flag("callback", "A callback url to add to the client's allowed callback urls").
Required().URLList()
logouts := kingpin.Flag("logout", "A logout url to add to the client's allowed logout urls").
Required().URLList()
maxLen := kingpin.Flag("max-len", "The maximum number of urls to allow").
Default("1").
Int()
kingpin.Parse()
if len(*callbacks) == 0 {
logger.Error("At least one --callback must be suplied.")
os.Exit(1)
}
if len(*logouts) == 0 {
logger.Error("At least one --logout must be suplied.")
os.Exit(1)
}
if *maxLen < len(*callbacks) || *maxLen < len(*logouts) {
logger.Error("maxLen cannot be less than the number of callbacks or logouts")
os.Exit(1)
}
config := types.ApplicationConfig {
Logger: logger,
ClientSecret: *clientSecret,
ClientId: *clientId,
Callbacks: *callbacks,
Logouts: *logouts,
Domain: *domain,
AppClientId: *appClientId,
MaxLen: *maxLen,
}
helpers.AddUris(config)
}