Software /
code /
prosody-modules
Comparison
mod_auth_external_insecure/examples/go/prosody-auth-example/main.go @ 3884:f84ede3e9e3b
mod_auth_external->mod_auth_external_insecure: Unmaintained and almost certainly insecure, discourage its use
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 06 Feb 2020 21:03:17 +0000 |
parent | 1164:mod_auth_external/examples/go/prosody-auth-example/main.go@b6280e8886f4 |
comparison
equal
deleted
inserted
replaced
3883:571249f69577 | 3884:f84ede3e9e3b |
---|---|
1 package main | |
2 | |
3 import "fmt" | |
4 import "bufio" | |
5 import "os" | |
6 import "strings" | |
7 | |
8 const ( | |
9 ACTION = iota | |
10 USER | |
11 HOST | |
12 PASSWORD | |
13 ) | |
14 | |
15 func main() { | |
16 stdin := bufio.NewScanner(os.Stdin) | |
17 for stdin.Scan() { | |
18 parts := strings.SplitN(stdin.Text(), ":", 4) | |
19 switch parts[ACTION] { | |
20 case "auth": | |
21 if parts[USER] == "someone" { | |
22 fmt.Printf("1\n") | |
23 continue | |
24 } | |
25 | |
26 default: fmt.Printf("0\n") | |
27 } | |
28 } | |
29 } |