()
| 28 | ) |
| 29 | |
| 30 | func main() { |
| 31 | flag.Parse() |
| 32 | |
| 33 | // prompt for password and otpseed in case the user didn't want to specify as flags |
| 34 | reader := bufio.NewReader(os.Stdin) |
| 35 | if *password == "" { |
| 36 | fmt.Print("password: ") |
| 37 | *password, _ = reader.ReadString('\n') |
| 38 | *password = strings.TrimSpace(*password) |
| 39 | } |
| 40 | if *otpseed == "" { |
| 41 | fmt.Print("OTP seed: ") |
| 42 | *otpseed, _ = reader.ReadString('\n') |
| 43 | *otpseed = strings.TrimSpace(*otpseed) |
| 44 | } |
| 45 | |
| 46 | client := scrape.NewClient(nil) |
| 47 | |
| 48 | if err := client.Authenticate(*username, *password, *otpseed); err != nil { |
| 49 | log.Fatal(err) |
| 50 | } |
| 51 | |
| 52 | enabled, err := client.AppRestrictionsEnabled(*org) |
| 53 | if err != nil { |
| 54 | log.Fatal(err) |
| 55 | } |
| 56 | fmt.Printf("App restrictions enabled for %q: %t\n", *org, enabled) |
| 57 | |
| 58 | apps, err := client.ListOAuthApps(*org) |
| 59 | if err != nil { |
| 60 | log.Fatal(err) |
| 61 | } |
| 62 | fmt.Printf("OAuth apps for %q: \n", *org) |
| 63 | for _, app := range apps { |
| 64 | fmt.Printf("\t%+v\n", app) |
| 65 | } |
| 66 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…