Compare commits

..

8 commits
main ... work

Author SHA1 Message Date
Chris Mann
23c77e0e23 It Compiles ! 2023-12-09 18:23:06 +01:00
Chris Mann
40ecbe2cfb It Compiles ! 2023-12-09 18:22:37 +01:00
e8d46fdf7d Not sure about this trailing slash issue. 2023-09-02 10:45:31 +02:00
c6496a6de8 Retouch to signin screen 2023-08-21 07:37:08 +02:00
93d8578d55 Bug fixed 2023-08-18 11:29:52 +02:00
828e3c51aa Delete invitation before creating a new one 2023-08-18 11:22:07 +02:00
aea77f19b0 Debugging 2023-08-18 11:04:02 +02:00
2a0eeb1fd7 Correction de liens mail.lesgrandsvoisins.com 2023-08-14 16:52:39 +02:00
38 changed files with 1224 additions and 1271 deletions

5
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"recommendations": [
"github.github-vscode-theme"
]
}

View file

@ -1,5 +1,7 @@
BIN=guichet BIN=guichet
SRC=main.go model.go view.go controller.go utils.go model-user.go model-passwd.go view-admin.go view-home.go view-invite.go view-login.go view-passwd.go view-user.go utils-http.go utils-ldap.go utils-config.go directory.go garage.go picture.go session.go utils-ssha.go SRC=models/model.go models/user.go models/passwd.go views/admin.go views/home.go views/invite.go views/login.go views/passwd.go views/user.go views/http.go models/ldap.go models/config.go views/directory.go views/picture.go views/session.go utils/ssha.go models/modelutils.go views/view.go controllers/controller.go main.go
#SRC=models/model.go models/user.go models/passwd.go views/admin.go views/home.go views/invite.go views/login.go views/passwd.go views/user.go utils/http.go utils/ldap.go utils/config.go utils/ssha.go utils/lesutils.go views/view.go controller.go main.go
# ssha.go profile.go admin.go invite.go directory.go utils.go picture.go login.go config.go http-utils.go home.go model-user.go gpas.go session.go model.go view.go controller.go utils-ldap.go # ssha.go profile.go admin.go invite.go directory.go utils.go picture.go login.go config.go http-utils.go home.go model-user.go gpas.go session.go model.go view.go controller.go utils-ldap.go

View file

@ -1,111 +0,0 @@
/*
Routes the requests to the app
*/
package main
import (
"net/http"
"github.com/gorilla/mux"
)
type ConfigFile struct {
HttpBindAddr string `json:"http_bind_addr"`
LdapServerAddr string `json:"ldap_server_addr"`
LdapTLS bool `json:"ldap_tls"`
BaseDN string `json:"base_dn"`
UserBaseDN string `json:"user_base_dn"`
UserNameAttr string `json:"user_name_attr"`
GroupBaseDN string `json:"group_base_dn"`
GroupNameAttr string `json:"group_name_attr"`
MailingBaseDN string `json:"mailing_list_base_dn"`
MailingNameAttr string `json:"mailing_list_name_attr"`
MailingGuestsBaseDN string `json:"mailing_list_guest_user_base_dn"`
InvitationBaseDN string `json:"invitation_base_dn"`
InvitationNameAttr string `json:"invitation_name_attr"`
InvitedMailFormat string `json:"invited_mail_format"`
InvitedAutoGroups []string `json:"invited_auto_groups"`
WebAddress string `json:"web_address"`
MailFrom string `json:"mail_from"`
SMTPServer string `json:"smtp_server"`
SMTPUsername string `json:"smtp_username"`
SMTPPassword string `json:"smtp_password"`
AdminAccount string `json:"admin_account"`
GroupCanInvite string `json:"group_can_invite"`
GroupCanAdmin string `json:"group_can_admin"`
S3AdminEndpoint string `json:"s3_admin_endpoint"`
S3AdminToken string `json:"s3_admin_token"`
S3Endpoint string `json:"s3_endpoint"`
S3AccessKey string `json:"s3_access_key"`
S3SecretKey string `json:"s3_secret_key"`
S3Region string `json:"s3_region"`
S3Bucket string `json:"s3_bucket"`
Org string `json:"org"`
DomainName string `json:"domain_name"`
NewUserDN string `json:"new_user_dn"`
NewUserPassword string `json:"new_user_password"`
NewUsersBaseDN string `json:"new_users_base_dn"`
NewUserDefaultDomain string `json:"new_user_default_domain"`
}
var staticPath = "./static"
/*
Create the different routes
*/
func makeGVRouter() (*mux.Router, error) {
r := mux.NewRouter()
r.HandleFunc("/", handleHome)
r.HandleFunc("/session/logout", handleLogout)
r.HandleFunc("/user", handleUser)
r.HandleFunc("/user/new", handleInviteNewAccount)
r.HandleFunc("/user/wait", handleUserWait)
r.HandleFunc("/user/mail", handleUserMail)
r.HandleFunc("/picture/{name}", handleDownloadPicture)
r.HandleFunc("/passwd", handlePasswd)
r.HandleFunc("/passwd/lost", handleLostPassword)
r.HandleFunc("/passwd/lost/{code}", handleFoundPassword)
r.HandleFunc("/admin", handleHome)
r.HandleFunc("/admin/activate", handleAdminActivateUsers)
r.HandleFunc("/admin/unactivate/{cn}", handleAdminUnactivateUser)
r.HandleFunc("/admin/activate/{cn}", handleAdminActivateUser)
r.HandleFunc("/admin/users", handleAdminUsers)
r.HandleFunc("/admin/groups", handleAdminGroups)
r.HandleFunc("/admin/ldap/{dn}", handleAdminLDAP)
r.HandleFunc("/admin/create/{template}/{super_dn}", handleAdminCreate)
// r.HandleFunc("/directory/search", handleDirectorySearch)
// r.HandleFunc("/directory", handleDirectory)
// r.HandleFunc("/garage/key", handleGarageKey)
// r.HandleFunc("/garage/website", handleGarageWebsiteList)
// r.HandleFunc("/garage/website/new", handleGarageWebsiteNew)
// r.HandleFunc("/garage/website/b/{bucket}", handleGarageWebsiteInspect)
// r.HandleFunc("/user/send_code", handleInviteSendCode)
// r.HandleFunc("/invitation/{code}", handleInvitationCode)
// r.HandleFunc("/admin-mailing", handleAdminMailing)
// r.HandleFunc("/admin/mailing/{id}", handleAdminMailingList)
staticFiles := http.FileServer(http.Dir(staticPath))
r.Handle("/static/{file:.*}", http.StripPrefix("/static/", staticFiles))
// log.Printf("Starting HTTP server on %s", config.HttpBindAddr)
err := http.ListenAndServe(config.HttpBindAddr, logRequest(r))
return r, err
}

73
controllers/controller.go Normal file
View file

@ -0,0 +1,73 @@
/*
Routes the requests to the app
*/
package controllers
import (
"guichet/models"
"guichet/views"
"net/http"
"github.com/gorilla/mux"
)
var staticPath = "./static"
/*
Create the different routes
*/
func MakeGVRouter() (*mux.Router, error) {
r := mux.NewRouter()
r.HandleFunc("/", views.HandleHome)
r.HandleFunc("/session/logout", views.HandleLogout)
r.HandleFunc("/user", views.HandleUser)
r.HandleFunc("/user/new", views.HandleInviteNewAccount)
r.HandleFunc("/user/new/", views.HandleInviteNewAccount)
r.HandleFunc("/user/wait", views.HandleUserWait)
r.HandleFunc("/user/mail", views.HandleUserMail)
r.HandleFunc("/picture/{name}", views.HandleDownloadPicture)
r.HandleFunc("/passwd", views.HandlePasswd)
r.HandleFunc("/passwd/lost", views.HandleLostPassword)
r.HandleFunc("/passwd/lost/{code}", views.HandleFoundPassword)
r.HandleFunc("/admin", views.HandleHome)
r.HandleFunc("/admin/activate", views.HandleAdminActivateUsers)
r.HandleFunc("/admin/unactivate/{cn}", views.HandleAdminUnactivateUser)
r.HandleFunc("/admin/activate/{cn}", views.HandleAdminActivateUser)
r.HandleFunc("/admin/users", views.HandleAdminUsers)
r.HandleFunc("/admin/groups", views.HandleAdminGroups)
r.HandleFunc("/admin/ldap/{dn}", views.HandleAdminLDAP)
r.HandleFunc("/admin/create/{template}/{super_dn}", views.HandleAdminCreate)
// r.HandleFunc("/directory/search", views.HandleDirectorySearch)
// r.HandleFunc("/directory", views.HandleDirectory)
// r.HandleFunc("/garage/key", views.HandleGarageKey)
// r.HandleFunc("/garage/website", views.HandleGarageWebsiteList)
// r.HandleFunc("/garage/website/new", views.HandleGarageWebsiteNew)
// r.HandleFunc("/garage/website/b/{bucket}", views.HandleGarageWebsiteInspect)
// r.HandleFunc("/user/send_code", views.HandleInviteSendCode)
// r.HandleFunc("/invitation/{code}", views.HandleInvitationCode)
// r.HandleFunc("/admin-mailing", views.HandleAdminMailing)
// r.HandleFunc("/admin/mailing/{id}", views.HandleAdminMailingList)
staticFiles := http.FileServer(http.Dir(staticPath))
r.Handle("/static/{file:.*}", http.StripPrefix("/static/", staticFiles))
config_file := models.ReadConfig()
// log.Printf("Starting HTTP server on %s", config.HttpBindAddr)
err := http.ListenAndServe(config_file.HttpBindAddr, views.LogRequest(r))
return r, err
}

View file

@ -1,4 +1,4 @@
package main package models
import ( import (
"context" "context"
@ -13,6 +13,8 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )
var config = ReadConfig()
func gadmin() (*garage.APIClient, context.Context) { func gadmin() (*garage.APIClient, context.Context) {
// Set Host and other parameters // Set Host and other parameters
configuration := garage.NewConfiguration() configuration := garage.NewConfiguration()
@ -137,12 +139,9 @@ func checkLoginAndS3(w http.ResponseWriter, r *http.Request) (*LoginStatus, *gar
return login, keyPair, err return login, keyPair, err
} }
type keyView struct {
Status *LoginStatus
Key *garage.KeyInfo
}
func handleGarageKey(w http.ResponseWriter, r *http.Request) {
func HandleGarageKey(w http.ResponseWriter, r *http.Request) {
login, s3key, err := checkLoginAndS3(w, r) login, s3key, err := checkLoginAndS3(w, r)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
@ -154,12 +153,9 @@ func handleGarageKey(w http.ResponseWriter, r *http.Request) {
tKey.Execute(w, &view) tKey.Execute(w, &view)
} }
type webListView struct {
Status *LoginStatus
Key *garage.KeyInfo
}
func handleGarageWebsiteList(w http.ResponseWriter, r *http.Request) {
func HandleGarageWebsiteList(w http.ResponseWriter, r *http.Request) {
login, s3key, err := checkLoginAndS3(w, r) login, s3key, err := checkLoginAndS3(w, r)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
@ -171,7 +167,7 @@ func handleGarageWebsiteList(w http.ResponseWriter, r *http.Request) {
tWebsiteList.Execute(w, &view) tWebsiteList.Execute(w, &view)
} }
func handleGarageWebsiteNew(w http.ResponseWriter, r *http.Request) { func HandleGarageWebsiteNew(w http.ResponseWriter, r *http.Request) {
_, s3key, err := checkLoginAndS3(w, r) _, s3key, err := checkLoginAndS3(w, r)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
@ -209,18 +205,9 @@ func handleGarageWebsiteNew(w http.ResponseWriter, r *http.Request) {
tWebsiteNew.Execute(w, nil) tWebsiteNew.Execute(w, nil)
} }
type webInspectView struct {
Status *LoginStatus
Key *garage.KeyInfo
Bucket *garage.BucketInfo
IndexDoc string
ErrorDoc string
MaxObjects int64
MaxSize int64
UsedSizePct float64
}
func handleGarageWebsiteInspect(w http.ResponseWriter, r *http.Request) {
func HandleGarageWebsiteInspect(w http.ResponseWriter, r *http.Request) {
login, s3key, err := checkLoginAndS3(w, r) login, s3key, err := checkLoginAndS3(w, r)
if err != nil { if err != nil {
log.Println(err) log.Println(err)

61
go.mod
View file

@ -1,37 +1,42 @@
module git.deuxfleurs.fr/Deuxfleurs/guichet module guichet
go 1.18 go 1.19
require ( require (
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20230131081355-c965fe7f7dc9 github.com/go-ldap/ldap/v3 v3.4.5
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 github.com/google/uuid v1.3.1
github.com/emersion/go-smtp v0.17.0 github.com/gorilla/mux v1.8.0
github.com/go-ldap/ldap/v3 v3.1.6 github.com/gorilla/sessions v1.2.1
github.com/google/uuid v1.1.1 github.com/jsimonetti/pwscheme v0.0.0-20220922140336-67a4d090f150
github.com/gorilla/mux v1.7.3 github.com/minio/minio-go/v7 v7.0.63
github.com/gorilla/sessions v1.2.0
github.com/jsimonetti/pwscheme v0.0.0-20220125093853-4d9895f5db73
github.com/minio/minio-go/v7 v7.0.0
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 golang.org/x/crypto v0.12.0
) )
require ( require (
github.com/go-asn1-ber/asn1-ber v1.3.1 // indirect github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/golang/protobuf v1.4.2 // indirect github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect github.com/gorilla/securecookie v1.1.1 // indirect
github.com/json-iterator/go v1.1.10 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid v1.2.3 // indirect github.com/klauspost/compress v1.16.7 // indirect
github.com/minio/md5-simd v1.1.0 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/minio/sha256-simd v0.1.1 // indirect github.com/minio/md5-simd v1.1.2 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/minio/sha256-simd v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect github.com/rs/xid v1.5.0 // indirect
golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 // indirect github.com/sirupsen/logrus v1.9.3 // indirect
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642 // indirect golang.org/x/net v0.14.0 // indirect
golang.org/x/text v0.3.3 // indirect golang.org/x/sys v0.11.0 // indirect
google.golang.org/appengine v1.6.6 // indirect golang.org/x/text v0.12.0 // indirect
google.golang.org/protobuf v1.25.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/ini.v1 v1.57.0 // indirect
) )
replace guichet/views => ./views
replace guichet/utils => ./utils
replace guichet/models => ./models
replace guichet/controllers => ./utils/controllers

502
go.sum
View file

@ -1,433 +1,115 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 h1:Kk6a4nehpJ3UuJRqlA3JxYxBZEqCeOmATOvrbT4p9RA=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20230131081355-c965fe7f7dc9 h1:ERg8KCpIKym98EOKa8Gq0NSBxsasD3sqb/R0gg1wOzU=
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20230131081355-c965fe7f7dc9/go.mod h1:TlSL6QVxozmdRaSgP6Akspi0HCJv4HAkkq3Dldru4GM=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/emersion/go-sasl v0.0.0-20190817083125-240c8404624e/go.mod h1:G/dpzLu16WtQpBfQ/z3LYiYJn3ZhKSGWn83fyoyQe/k= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/emersion/go-sasl v0.0.0-20191210011802-430746ea8b9b h1:uhWtEWBHgop1rqEk2klKaxPAkVDCXexai6hSuRQ7Nvs= github.com/go-asn1-ber/asn1-ber v1.5.4 h1:vXT6d/FNDiELJnLb6hGNa309LMsrCoYFvpwHDF0+Y1A=
github.com/emersion/go-sasl v0.0.0-20191210011802-430746ea8b9b/go.mod h1:G/dpzLu16WtQpBfQ/z3LYiYJn3ZhKSGWn83fyoyQe/k= github.com/go-asn1-ber/asn1-ber v1.5.4/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 h1:OJyUGMJTzHTd1XQp98QTaHernxMYzRaOasRir9hUlFQ= github.com/go-ldap/ldap/v3 v3.4.5 h1:ekEKmaDrpvR2yf5Nc/DClsGG9lAmdDixe44mLzlW5r8=
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ= github.com/go-ldap/ldap/v3 v3.4.5/go.mod h1:bMGIq3AGbytbaMwf8wdv5Phdxz0FWHTIYMSzyrYgnQs=
github.com/emersion/go-smtp v0.12.1 h1:1R8BDqrR2HhlGwgFYcOi+BVTvK1bMjAB65QcVpJ5sNA=
github.com/emersion/go-smtp v0.12.1/go.mod h1:SD9V/xa4ndMw77lR3Mf7htkp8RBNYuPh9UeuBs9tpUQ=
github.com/emersion/go-smtp v0.17.0 h1:tq90evlrcyqRfE6DSXaWVH54oX6OuZOQECEmhWBMEtI=
github.com/emersion/go-smtp v0.17.0/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/go-asn1-ber/asn1-ber v1.3.1 h1:gvPdv/Hr++TRFCl0UbPFHC54P9N9jgsRPnmnr419Uck=
github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-ldap/ldap/v3 v3.1.6 h1:VTihvB7egSAvU6KOagaiA/EvgJMR2jsjRAVIho2ydBo=
github.com/go-ldap/ldap/v3 v3.1.6/go.mod h1:5Zun81jBTabRaI8lzN7E1JjyEl1g6zI6u9pd8luAK4Q=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ= github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=
github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/jsimonetti/pwscheme v0.0.0-20220922140336-67a4d090f150 h1:ta6N7DaOQEACq28cLa0iRqXIbchByN9Lfll08CT2GBc=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/jsimonetti/pwscheme v0.0.0-20220922140336-67a4d090f150/go.mod h1:SiNTKDgjKQORnazFVHXhpny7UtU0iJOqtxd7R7sCfDI=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/jsimonetti/pwscheme v0.0.0-20220125093853-4d9895f5db73 h1:ZhC4QngptYaGx53+ph1RjxcH8fkCozBaY+935TNX4i8= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jsimonetti/pwscheme v0.0.0-20220125093853-4d9895f5db73/go.mod h1:t0Q9JvoMTfTYdAWIk2MF69iz+Qpdk9D+PgVu6fVmaDI= github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/minio/minio-go/v7 v7.0.63 h1:GbZ2oCvaUdgT5640WJOpyDhhDxvknAJU2/T3yurwcbQ=
github.com/klauspost/cpuid v1.2.3 h1:CCtW0xUnWGVINKvE/WWOYKdsPV6mawAtvQuSl8guwQs= github.com/minio/minio-go/v7 v7.0.63/go.mod h1:Q6X7Qjb7WMhvG65qKf4gUgA5XaiSox74kR1uAEjxRS4=
github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4=
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
github.com/minio/minio-go/v7 v7.0.0 h1:99hRCmsmMi+hKK93C26iPnRQebTsdK8GEx8Xb4XLr7I=
github.com/minio/minio-go/v7 v7.0.0/go.mod h1:dJ80Mv2HeGkYLH1sqS/ksz07ON6csH3S6JUMSQ2zAns=
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20220921155015-db77216a4ee9/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 h1:D7nTwh4J0i+5mW4Zjzn5omvlr6YBcWywE6KOcatyNxY=
golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20220919170432-7a66f970e087/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642 h1:B6caxRw+hozq68X2MY7jEpZh/cr4/aHLv9xU8Kkadrw=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.57.0 h1:9unxIsFcTt4I55uWluz+UmL95q4kdJ0buvQ1ZIqVQww= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

15
main.go
View file

@ -8,37 +8,32 @@ package main
import ( import (
"crypto/rand" "crypto/rand"
// "crypto/tls" // "crypto/tls"
// "encoding/json" // "encoding/json"
"flag" "flag"
// "fmt" // "fmt"
// "io/ioutil" // "io/ioutil"
"guichet/controllers"
"guichet/views"
"log" "log"
// "os" // "os"
// "strings" // "strings"
"github.com/gorilla/sessions" "github.com/gorilla/sessions"
) )
const SESSION_NAME = "guichet_session"
var store sessions.Store = nil
func main() { func main() {
flag.Parse() flag.Parse()
config_file := readConfig()
config = &config_file
session_key := make([]byte, 32) session_key := make([]byte, 32)
n, err := rand.Read(session_key) n, err := rand.Read(session_key)
if err != nil || n != 32 { if err != nil || n != 32 {
log.Fatal(err) log.Fatal(err)
} }
store = sessions.NewCookieStore(session_key) views.GuichetSessionStore = sessions.NewCookieStore(session_key)
_, err = makeGVRouter() _, err = controllers.MakeGVRouter()
if err != nil { if err != nil {
log.Fatal("Cannot start http server: ", err) log.Fatal("Cannot start http server: ", err)
} }

View file

@ -1,31 +0,0 @@
/*
Centralises the models used in this application
*/
package main
import (
"github.com/go-ldap/ldap/v3"
)
/*
Represents a user
*/
type User struct {
DN string
CN string
GivenName string
DisplayName string
Mail string
SN string
UID string
Description string
Password string
OtherMailbox string
CanAdmin bool
CanInvite bool
UserEntry *ldap.Entry
SeeAlso string
}
type EntryList []*ldap.Entry

52
models/config.go Normal file
View file

@ -0,0 +1,52 @@
/*
config Handles reading the config.json file at the root and processing the settings
*/
package models
type ConfigFile struct {
HttpBindAddr string `json:"http_bind_addr"`
LdapServerAddr string `json:"ldap_server_addr"`
LdapTLS bool `json:"ldap_tls"`
BaseDN string `json:"base_dn"`
UserBaseDN string `json:"user_base_dn"`
UserNameAttr string `json:"user_name_attr"`
GroupBaseDN string `json:"group_base_dn"`
GroupNameAttr string `json:"group_name_attr"`
MailingBaseDN string `json:"mailing_list_base_dn"`
MailingNameAttr string `json:"mailing_list_name_attr"`
MailingGuestsBaseDN string `json:"mailing_list_guest_user_base_dn"`
InvitationBaseDN string `json:"invitation_base_dn"`
InvitationNameAttr string `json:"invitation_name_attr"`
InvitedMailFormat string `json:"invited_mail_format"`
InvitedAutoGroups []string `json:"invited_auto_groups"`
WebAddress string `json:"web_address"`
MailFrom string `json:"mail_from"`
SMTPServer string `json:"smtp_server"`
SMTPUsername string `json:"smtp_username"`
SMTPPassword string `json:"smtp_password"`
AdminAccount string `json:"admin_account"`
GroupCanInvite string `json:"group_can_invite"`
GroupCanAdmin string `json:"group_can_admin"`
S3AdminEndpoint string `json:"s3_admin_endpoint"`
S3AdminToken string `json:"s3_admin_token"`
S3Endpoint string `json:"s3_endpoint"`
S3AccessKey string `json:"s3_access_key"`
S3SecretKey string `json:"s3_secret_key"`
S3Region string `json:"s3_region"`
S3Bucket string `json:"s3_bucket"`
Org string `json:"org"`
DomainName string `json:"domain_name"`
NewUserDN string `json:"new_user_dn"`
NewUserPassword string `json:"new_user_password"`
NewUsersBaseDN string `json:"new_users_base_dn"`
NewUserDefaultDomain string `json:"new_user_default_domain"`
}

View file

@ -1,48 +1,78 @@
package main /*
Utilities related to LDAP
*/
package models
import ( import (
"html/template" "log"
"net/http"
"sort" "sort"
"strings" "strings"
"github.com/go-ldap/ldap/v3" "github.com/go-ldap/ldap/v3"
) )
var config = ReadConfig()
const FIELD_NAME_PROFILE_PICTURE = "profilePicture" const FIELD_NAME_PROFILE_PICTURE = "profilePicture"
const FIELD_NAME_DIRECTORY_VISIBILITY = "directoryVisibility" const FIELD_NAME_DIRECTORY_VISIBILITY = "directoryVisibility"
func handleDirectory(w http.ResponseWriter, r *http.Request) { type SearchResult struct {
templateDirectory := getTemplate("directory.html") DN string
Id string
login := checkLogin(w, r) DisplayName string
if login == nil { Email string
return Description string
ProfilePicture string
}
type SearchResults struct {
Results []SearchResult
} }
templateDirectory.Execute(w, nil)
func (r *SearchResults) Len() int {
return len(r.Results)
} }
func handleDirectorySearch(w http.ResponseWriter, r *http.Request) { func (r *SearchResults) Less(i, j int) bool {
templateDirectoryResults := template.Must(template.ParseFiles(templatePath + "/directory_results.html")) return r.Results[i].Id < r.Results[j].Id
//Get input value by user
r.ParseMultipartForm(1024)
input := strings.TrimSpace(strings.Join(r.Form["query"], ""))
if r.Method != "POST" {
http.Error(w, "Invalid request", http.StatusBadRequest)
return
} }
//Log to allow the research func (r *SearchResults) Swap(i, j int) {
login := checkLogin(w, r) r.Results[i], r.Results[j] = r.Results[j], r.Results[i]
if login == nil {
http.Error(w, "Login required", http.StatusUnauthorized)
return
} }
func ContainsI(a string, b string) bool {
return strings.Contains(
strings.ToLower(a),
strings.ToLower(b),
)
}
// New account creation directly from interface
func OpenNewUserLdap(config *ConfigFile) (*ldap.Conn, error) {
l, err := openLdap(config)
if err != nil {
log.Printf("OpenNewUserLdap 1 : %v %v", err, l)
log.Printf("OpenNewUserLdap 1 : %v", config)
// data.Common.ErrorMessage = err.Error()
}
err = l.Bind(config.NewUserDN, config.NewUserPassword)
if err != nil {
log.Printf("OpenNewUserLdap Bind : %v", err)
log.Printf("OpenNewUserLdap Bind : %v", config.NewUserDN)
log.Printf("OpenNewUserLdap Bind : %v", config.NewUserPassword)
log.Printf("OpenNewUserLdap Bind : %v", config)
// data.Common.ErrorMessage = err.Error()
}
return l, err
}
func DoDirectorySearch(ldapConn *ldap.Conn, input string) (SearchResults, error) {
//Search values with ldap and filter //Search values with ldap and filter
searchRequest := ldap.NewSearchRequest( searchRequest := ldap.NewSearchRequest(
config.UserBaseDN, config.UserBaseDN,
ldap.ScopeSingleLevel, ldap.NeverDerefAliases, 0, 0, false, ldap.ScopeSingleLevel, ldap.NeverDerefAliases, 0, 0, false,
@ -55,15 +85,14 @@ func handleDirectorySearch(w http.ResponseWriter, r *http.Request) {
FIELD_NAME_PROFILE_PICTURE, FIELD_NAME_PROFILE_PICTURE,
}, },
nil) nil)
sr, err := login.conn.Search(searchRequest)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
//Transform the researh's result in a correct struct to send JSON //Transform the researh's result in a correct struct to send JSON
results := []SearchResult{} results := []SearchResult{}
sr, err := ldapConn.Search(searchRequest)
if err != nil {
return SearchResults{}, err
}
for _, values := range sr.Entries { for _, values := range sr.Entries {
if input == "" || if input == "" ||
@ -80,30 +109,10 @@ func handleDirectorySearch(w http.ResponseWriter, r *http.Request) {
}) })
} }
} }
// sort.Sort(&results)
search_results := SearchResults{ search_results := SearchResults{
Results: results, Results: results,
} }
sort.Sort(&search_results) sort.Sort(&search_results)
return search_results, nil
templateDirectoryResults.Execute(w, search_results)
}
func ContainsI(a string, b string) bool {
return strings.Contains(
strings.ToLower(a),
strings.ToLower(b),
)
}
func (r *SearchResults) Len() int {
return len(r.Results)
}
func (r *SearchResults) Less(i, j int) bool {
return r.Results[i].Id < r.Results[j].Id
}
func (r *SearchResults) Swap(i, j int) {
r.Results[i], r.Results[j] = r.Results[j], r.Results[i]
} }

67
models/model.go Normal file
View file

@ -0,0 +1,67 @@
/*
Centralises the models used in this application
*/
package models
import (
// "crypto/tls"
// "log"
// "net"
"github.com/go-ldap/ldap/v3"
)
/*
Represents a user
*/
type User struct {
DN string
CN string
GivenName string
DisplayName string
Mail string
SN string
UID string
Description string
Password string
OtherMailbox string
CanAdmin bool
CanInvite bool
UserEntry *ldap.Entry
SeeAlso string
}
// func openLdap(config *ConfigFile) (*ldap.Conn, error) {
// var ldapConn *ldap.Conn
// var err error
// if config.LdapTLS {
// tlsConf := &tls.Config{
// ServerName: config.LdapServerAddr,
// InsecureSkipVerify: true,
// }
// ldapConn, err = ldap.DialTLS("tcp", net.JoinHostPort(config.LdapServerAddr, "636"), tlsConf)
// } else {
// ldapConn, err = ldap.DialURL("ldap://" + config.LdapServerAddr)
// }
// if err != nil {
// log.Printf("openLDAP %v", err)
// log.Printf("openLDAP %v", config.LdapServerAddr)
// }
// return ldapConn, err
// // l, err := ldap.DialURL(config.LdapServerAddr)
// // if err != nil {
// // log.Printf(fmt.Sprint("Erreur connect LDAP %v", err))
// // log.Printf(fmt.Sprint("Erreur connect LDAP %v", config.LdapServerAddr))
// // return nil
// // } else {
// // return l
// // }
// }

135
models/modelutils.go Normal file
View file

@ -0,0 +1,135 @@
package models
import (
"bytes"
"crypto/tls"
"log"
"net"
"net/smtp"
"html/template"
"github.com/go-ldap/ldap/v3"
// "golang.org/x/text/encoding/unicode"
"encoding/json"
"io/ioutil"
"os"
"flag"
)
//
func ReadConfig() ConfigFile {
// Default configuration values for certain fields
flag.Parse()
var configFlag = flag.String("config", "./config.json", "Configuration file path")
config_file := ConfigFile{
HttpBindAddr: ":9991",
LdapServerAddr: "ldap://127.0.0.1:389",
UserNameAttr: "uid",
GroupNameAttr: "gid",
InvitationNameAttr: "cn",
InvitedAutoGroups: []string{},
Org: "ResDigita",
}
_, err := os.Stat(*configFlag)
if os.IsNotExist(err) {
log.Fatalf("Could not find Guichet configuration file at %s. Please create this file, for exemple starting with config.json.exemple and customizing it for your deployment.", *configFlag)
}
if err != nil {
log.Fatal(err)
}
bytes, err := ioutil.ReadFile(*configFlag)
if err != nil {
log.Fatal(err)
}
err = json.Unmarshal(bytes, &config_file)
if err != nil {
log.Fatal(err)
}
return config_file
}
type EmailContentVarsTplData struct {
Code string
SendAddress string
InviteFrom string
}
// Data to be passed to an email for sending
type SendMailTplData struct {
// Sender of the email
To string
// Receiver of the email
From string
// Relative path (without leading /) to the email template in the templates folder
// usually ending in .txt
RelTemplatePath string
// Variables to be included in the template of the email
EmailContentVars EmailContentVarsTplData
}
func openLdap(config *ConfigFile) (*ldap.Conn, error) {
var ldapConn *ldap.Conn
var err error
if config.LdapTLS {
tlsConf := &tls.Config{
ServerName: config.LdapServerAddr,
InsecureSkipVerify: true,
}
ldapConn, err = ldap.DialTLS("tcp", net.JoinHostPort(config.LdapServerAddr, "636"), tlsConf)
} else {
ldapConn, err = ldap.DialURL("ldap://" + config.LdapServerAddr)
}
if err != nil {
log.Printf("openLDAP %v", err)
log.Printf("openLDAP %v", config.LdapServerAddr)
}
return ldapConn, err
// l, err := ldap.DialURL(config.LdapServerAddr)
// if err != nil {
// log.Printf(fmt.Sprint("Erreur connect LDAP %v", err))
// log.Printf(fmt.Sprint("Erreur connect LDAP %v", config.LdapServerAddr))
// return nil
// } else {
// return l
// }
}
// Sends an email according to the enclosed information
func sendMail(sendMailTplData SendMailTplData) error {
log.Printf("sendMail")
templateMail := template.Must(template.ParseFiles( "./templates" + sendMailTplData.RelTemplatePath))
buf := bytes.NewBuffer([]byte{})
err := templateMail.Execute(buf, sendMailTplData)
message := buf.Bytes()
auth := smtp.PlainAuth("", config.SMTPUsername, config.SMTPPassword, config.SMTPServer)
log.Printf("auth: %v", auth)
err = smtp.SendMail(config.SMTPServer+":587", auth, config.SMTPUsername, []string{sendMailTplData.To}, message)
if err != nil {
log.Printf("sendMail smtp.SendMail %v", err)
log.Printf("sendMail smtp.SendMail %v", sendMailTplData)
return err
}
log.Printf("Mail sent.")
return err
}

View file

@ -2,7 +2,7 @@
gpas is GVoisin password reset gpas is GVoisin password reset
*/ */
package main package models
import ( import (
"bytes" "bytes"
@ -10,25 +10,62 @@ import (
"fmt" "fmt"
"html/template" "html/template"
"log" "log"
"math/rand"
// "github.com/emersion/go-sasl" // "github.com/emersion/go-sasl"
// "github.com/emersion/go-smtp" // "github.com/emersion/go-smtp"
"net/smtp" "net/smtp"
"github.com/go-ldap/ldap/v3" "github.com/go-ldap/ldap/v3"
// "strings" // "strings"
b64 "encoding/base64" b64 "encoding/base64"
) )
var templatePath = "./templates"
type CodeMailFields struct {
From string
To string
Code string
InviteFrom string
WebBaseAddress string
Common NestedCommonTplData
}
type NestedCommonTplData struct {
Error string
ErrorMessage string
CanAdmin bool
CanInvite bool
LoggedIn bool
Success bool
WarningMessage string
WebsiteName string
WebsiteURL string
}
// type InvitationAccount struct { // type InvitationAccount struct {
// UID string // UID string
// Password string // Password string
// BaseDN string // BaseDN string
// } // }
// Suggesting a 12 char password with some excentrics
func SuggestPassword() string {
password := ""
chars := "abcdfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*+_-="
for i := 0; i < 12; i++ {
password += string([]rune(chars)[rand.Intn(len(chars))])
}
return password
}
// var EMAIL_REGEXP := regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$") // var EMAIL_REGEXP := regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error { func getInvitationBaseDN(config *ConfigFile) string {
return config.InvitationBaseDN
}
func PasswordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
if user.CN == "" && user.Mail == "" && user.OtherMailbox == "" { if user.CN == "" && user.Mail == "" && user.OtherMailbox == "" {
return errors.New("Il n'y a pas de quoi identifier l'utilisateur") return errors.New("Il n'y a pas de quoi identifier l'utilisateur")
} }
@ -46,38 +83,41 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
searchReq := ldap.NewSearchRequest(config.UserBaseDN, ldap.ScopeSingleLevel, ldap.NeverDerefAliases, 0, 0, false, searchFilter, []string{"cn", "uid", "mail", "carLicense", "sn", "displayName", "givenName"}, nil) searchReq := ldap.NewSearchRequest(config.UserBaseDN, ldap.ScopeSingleLevel, ldap.NeverDerefAliases, 0, 0, false, searchFilter, []string{"cn", "uid", "mail", "carLicense", "sn", "displayName", "givenName"}, nil)
searchRes, err := ldapConn.Search(searchReq) searchRes, err := ldapConn.Search(searchReq)
if err != nil { if err != nil {
log.Printf("passwordLost search : %v %v", err, ldapConn) log.Printf("PasswordLost search : %v %v", err, ldapConn)
log.Printf("passwordLost search : %v", searchReq) log.Printf("PasswordLost search : %v", searchReq)
log.Printf("passwordLost search : %v", searchRes) log.Printf("PasswordLost search : %v", searchRes)
log.Printf("passwordLost search: %v", user) log.Printf("PasswordLost search: %v", user)
return err return err
} }
if len(searchRes.Entries) == 0 { if len(searchRes.Entries) == 0 {
log.Printf("Il n'y a pas d'utilisateur qui correspond %v", searchReq) log.Printf("Il n'y a pas d'utilisateur qui correspond %v", searchReq)
return errors.New("Il n'y a pas d'utilisateur qui correspond") return errors.New("Il n'y a pas d'utilisateur qui correspond")
} }
// log.Printf("passwordLost 58 : %v", user) // log.Printf("PasswordLost 58 : %v", user)
// log.Printf("passwordLost 59 : %v", searchRes.Entries[0]) // log.Printf("PasswordLost 59 : %v", searchRes.Entries[0])
// log.Printf("passwordLost 60 : %v", searchRes.Entries[0].GetAttributeValue("cn")) // log.Printf("PasswordLost 60 : %v", searchRes.Entries[0].GetAttributeValue("cn"))
// log.Printf("passwordLost 61 : %v", searchRes.Entries[0].GetAttributeValue("uid")) // log.Printf("PasswordLost 61 : %v", searchRes.Entries[0].GetAttributeValue("uid"))
// log.Printf("passwordLost 62 : %v", searchRes.Entries[0].GetAttributeValue("mail")) // log.Printf("PasswordLost 62 : %v", searchRes.Entries[0].GetAttributeValue("mail"))
// log.Printf("passwordLost 63 : %v", searchRes.Entries[0].GetAttributeValue("carLicense")) // log.Printf("PasswordLost 63 : %v", searchRes.Entries[0].GetAttributeValue("carLicense"))
// Préparation du courriel à envoyer // Préparation du courriel à envoyer
user.Password = suggestPassword()
code := b64.URLEncoding.EncodeToString([]byte(user.UID + ";" + user.Password))
delReq := ldap.NewDelRequest("uid="+searchRes.Entries[0].GetAttributeValue("cn")+","+config.InvitationBaseDN, nil)
err = ldapConn.Del(delReq)
user.Password = SuggestPassword()
user.DN = "uid=" + searchRes.Entries[0].GetAttributeValue("cn") + "," + config.InvitationBaseDN user.DN = "uid=" + searchRes.Entries[0].GetAttributeValue("cn") + "," + config.InvitationBaseDN
user.UID = searchRes.Entries[0].GetAttributeValue("cn") user.UID = searchRes.Entries[0].GetAttributeValue("cn")
user.CN = searchRes.Entries[0].GetAttributeValue("cn") user.CN = searchRes.Entries[0].GetAttributeValue("cn")
user.Mail = searchRes.Entries[0].GetAttributeValue("mail") user.Mail = searchRes.Entries[0].GetAttributeValue("mail")
user.OtherMailbox = searchRes.Entries[0].GetAttributeValue("carLicense") user.OtherMailbox = searchRes.Entries[0].GetAttributeValue("carLicense")
code := b64.URLEncoding.EncodeToString([]byte(user.UID + ";" + user.Password))
/* Check for outstanding invitation */ /* Check for outstanding invitation */
searchReq = ldap.NewSearchRequest(config.InvitationBaseDN, ldap.ScopeSingleLevel, searchReq = ldap.NewSearchRequest(config.InvitationBaseDN, ldap.ScopeSingleLevel,
ldap.NeverDerefAliases, 0, 0, false, "(uid="+user.UID+")", []string{"seeAlso"}, nil) ldap.NeverDerefAliases, 0, 0, false, "(uid="+user.UID+")", []string{"seeAlso"}, nil)
searchRes, err = ldapConn.Search(searchReq) searchRes, err = ldapConn.Search(searchReq)
if err != nil { if err != nil {
log.Printf(fmt.Sprintf("passwordLost (Check existing invitation) : %v", err)) log.Printf(fmt.Sprintf("PasswordLost (Check existing invitation) : %v", err))
log.Printf(fmt.Sprintf("passwordLost (Check existing invitation) : %v", user)) log.Printf(fmt.Sprintf("PasswordLost (Check existing invitation) : %v", user))
return err return err
} }
// if len(searchRes.Entries) == 0 { // if len(searchRes.Entries) == 0 {
@ -87,28 +127,31 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
nil) nil)
addReq.Attribute("objectClass", []string{"top", "account", "simpleSecurityObject"}) addReq.Attribute("objectClass", []string{"top", "account", "simpleSecurityObject"})
addReq.Attribute("uid", []string{user.UID}) addReq.Attribute("uid", []string{user.UID})
addReq.Attribute("userPassword", []string{suggestPassword()}) addReq.Attribute("userPassword", []string{user.Password})
addReq.Attribute("seeAlso", []string{config.UserNameAttr + "=" + user.UID + "," + config.UserBaseDN}) addReq.Attribute("seeAlso", []string{config.UserNameAttr + "=" + user.UID + "," + config.UserBaseDN})
// Password invitation may already exist
//
err = ldapConn.Add(addReq) err = ldapConn.Add(addReq)
if err != nil { if err != nil {
log.Printf("passwordLost 83 : %v", err) log.Printf("PasswordLost 83 : %v", err)
log.Printf("passwordLost 84 : %v", user) log.Printf("PasswordLost 84 : %v", user)
log.Printf("passwordLost 84 : %v", addReq) log.Printf("PasswordLost 84 : %v", addReq)
// // log.Printf("passwordLost 85 : %v", searchRes.Entries[0])) // // log.Printf("PasswordLost 85 : %v", searchRes.Entries[0]))
// // For some reason I get here even if the entry exists already // // For some reason I get here even if the entry exists already
// return err // return err
} }
// } // }
ldapNewConn, err := openNewUserLdap(config) ldapNewConn, err := OpenNewUserLdap(config)
if err != nil { if err != nil {
log.Printf("passwordLost openNewUserLdap : %v", err) log.Printf("PasswordLost OpenNewUserLdap : %v", err)
} }
err = passwd(user, config, ldapNewConn) err = PassWD(user, config, ldapNewConn)
if err != nil { if err != nil {
log.Printf("passwordLost passwd : %v", err) log.Printf("PasswordLost PassWD : %v", err)
log.Printf("passwordLost passwd : %v", user) log.Printf("PasswordLost PassWD : %v", user)
log.Printf("passwordLost passwd : %v", searchRes.Entries[0]) log.Printf("PasswordLost PassWD : %v", searchRes.Entries[0])
return err return err
} }
templateMail := template.Must(template.ParseFiles(templatePath + "/passwd/lost_password_email.txt")) templateMail := template.Must(template.ParseFiles(templatePath + "/passwd/lost_password_email.txt"))
@ -138,11 +181,11 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
return err return err
} }
func passwordFound(user User, config *ConfigFile, ldapConn *ldap.Conn) (string, error) { func PasswordFound(user User, config *ConfigFile, ldapConn *ldap.Conn) (string, error) {
l, err := openLdap(config) l, err := openLdap(config)
if err != nil { if err != nil {
log.Printf("passwordFound openLdap %v", err) log.Printf("PasswordFound openLdap %v", err)
// log.Printf("passwordFound openLdap Config : %v", config) // log.Printf("PasswordFound openLdap Config : %v", config)
return "", err return "", err
} }
if user.DN == "" && user.UID != "" { if user.DN == "" && user.UID != "" {
@ -150,9 +193,9 @@ func passwordFound(user User, config *ConfigFile, ldapConn *ldap.Conn) (string,
} }
err = l.Bind(user.DN, user.Password) err = l.Bind(user.DN, user.Password)
if err != nil { if err != nil {
log.Printf("passwordFound l.Bind %v", err) log.Printf("PasswordFound l.Bind %v", err)
log.Printf("passwordFound l.Bind %v", user.DN) log.Printf("PasswordFound l.Bind %v", user.DN)
log.Printf("passwordFound l.Bind %v", user.UID) log.Printf("PasswordFound l.Bind %v", user.UID)
return "", err return "", err
} }
searchReq := ldap.NewSearchRequest(user.DN, ldap.ScopeBaseObject, searchReq := ldap.NewSearchRequest(user.DN, ldap.ScopeBaseObject,
@ -160,17 +203,17 @@ func passwordFound(user User, config *ConfigFile, ldapConn *ldap.Conn) (string,
var searchRes *ldap.SearchResult var searchRes *ldap.SearchResult
searchRes, err = ldapConn.Search(searchReq) searchRes, err = ldapConn.Search(searchReq)
if err != nil { if err != nil {
log.Printf("passwordFound %v", err) log.Printf("PasswordFound %v", err)
log.Printf("passwordFound %v", searchReq) log.Printf("PasswordFound %v", searchReq)
log.Printf("passwordFound %v", ldapConn) log.Printf("PasswordFound %v", ldapConn)
log.Printf("passwordFound %v", searchRes) log.Printf("PasswordFound %v", searchRes)
return "", err return "", err
} }
if len(searchRes.Entries) == 0 { if len(searchRes.Entries) == 0 {
log.Printf("passwordFound %v", err) log.Printf("PasswordFound %v", err)
log.Printf("passwordFound %v", searchReq) log.Printf("PasswordFound %v", searchReq)
log.Printf("passwordFound %v", ldapConn) log.Printf("PasswordFound %v", ldapConn)
log.Printf("passwordFound %v", searchRes) log.Printf("PasswordFound %v", searchRes)
return "", err return "", err
} }
delReq := ldap.NewDelRequest("uid="+user.CN+","+config.InvitationBaseDN, nil) delReq := ldap.NewDelRequest("uid="+user.CN+","+config.InvitationBaseDN, nil)

View file

@ -1,7 +1,7 @@
/* /*
Model-User handles everything having to do with the user. Model-User Handles everything having to do with the user.
*/ */
package main package models
import ( import (
"fmt" "fmt"
@ -11,6 +11,19 @@ import (
"github.com/go-ldap/ldap/v3" "github.com/go-ldap/ldap/v3"
) )
func replaceIfContent(modifReq *ldap.ModifyRequest, key string, value string, previousValue string) error {
if value != "" {
modifReq.Replace(key, []string{value})
} else if previousValue != "" {
modifReq.Delete(key, []string{previousValue})
}
return nil
}
func GetUser(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
return get(user, config, ldapConn)
}
func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) { func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
searchReq := ldap.NewSearchRequest( searchReq := ldap.NewSearchRequest(
user.DN, user.DN,
@ -64,6 +77,10 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
return &resUser, nil return &resUser, nil
} }
func AddUser(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
return add(user, config, ldapConn)
}
// Adds a new user // Adds a new user
func add(user User, config *ConfigFile, ldapConn *ldap.Conn) error { func add(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
log.Printf(fmt.Sprint("Adding New User")) log.Printf(fmt.Sprint("Adding New User"))
@ -98,7 +115,7 @@ func add(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
// Add the User // Add the User
// err := ldapConn.Add(req) // err := ldapConn.Add(req)
// var ldapNewConn *ldap.Conn // var ldapNewConn *ldap.Conn
ldapNewConn, err := openNewUserLdap(config) ldapNewConn, err := OpenNewUserLdap(config)
err = ldapNewConn.Add(req) err = ldapNewConn.Add(req)
if err != nil { if err != nil {
log.Printf(fmt.Sprintf("add(User) ldapconn.Add: %v", err)) log.Printf(fmt.Sprintf("add(User) ldapconn.Add: %v", err))
@ -114,9 +131,9 @@ func add(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
// Send the email // Send the email
newUserLdapConn, _ := openNewUserLdap(config) newUserLdapConn, _ := OpenNewUserLdap(config)
user.OtherMailbox = "" user.OtherMailbox = ""
err = passwordLost(user, config, newUserLdapConn) err = PasswordLost(user, config, newUserLdapConn)
if err != nil { if err != nil {
log.Printf("add User PasswordLost %v", err) log.Printf("add User PasswordLost %v", err)
log.Printf("add User PasswordLost %v", newUserLdapConn) log.Printf("add User PasswordLost %v", newUserLdapConn)
@ -141,6 +158,10 @@ func add(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
return err return err
} }
func ModifyUser(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
return modify(user, config, ldapConn)
}
func modify(user User, config *ConfigFile, ldapConn *ldap.Conn) error { func modify(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
modify_request := ldap.NewModifyRequest(user.DN, nil) modify_request := ldap.NewModifyRequest(user.DN, nil)
previousUser, err := get(user, config, ldapConn) previousUser, err := get(user, config, ldapConn)
@ -162,26 +183,17 @@ func modify(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
return nil return nil
} }
func passwd(user User, config *ConfigFile, ldapConn *ldap.Conn) error { func PassWD(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
passwordModifyRequest := ldap.NewPasswordModifyRequest(user.DN, "", user.Password) passwordModifyRequest := ldap.NewPasswordModifyRequest(user.DN, "", user.Password)
_, err := ldapConn.PasswordModify(passwordModifyRequest) _, err := ldapConn.PasswordModify(passwordModifyRequest)
if err != nil { if err != nil {
log.Printf(fmt.Sprintf("model-user passwd : %v %v", err, ldapConn)) log.Printf(fmt.Sprintf("model-user PassWD : %v %v", err, ldapConn))
log.Printf(fmt.Sprintf("model-user passwd : %v", user)) log.Printf(fmt.Sprintf("model-user PassWD : %v", user))
} }
return err return err
} }
func bind(user User, config *ConfigFile, ldapConn *ldap.Conn) error { func Bind(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
return ldapConn.Bind(user.DN, user.Password) return ldapConn.Bind(user.DN, user.Password)
} }
// func encodePassword(inPassword string) (string, error) {
// utf16 := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM)
// return utf16.NewEncoder().String("\"" + inPassword + "\"")
// // if err != nil {
// // log.Printf("Error encoding password: %s", err)
// // return err
// // }
// }

41
notgo.mod Normal file
View file

@ -0,0 +1,41 @@
module guichet
go 1.19
require (
git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang v0.0.0-20230131081355-c965fe7f7dc9
github.com/go-ldap/ldap/v3 v3.4.5
github.com/google/uuid v1.3.1
github.com/gorilla/mux v1.8.0
github.com/gorilla/sessions v1.2.1
github.com/jsimonetti/pwscheme v0.0.0-20220922140336-67a4d090f150
github.com/minio/minio-go/v7 v7.0.63
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
golang.org/x/crypto v0.12.0
)
require (
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid v1.3.1 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)

View file

@ -44,7 +44,7 @@
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">
<!-- <a class="list-group-item list-group-item-action" href="/user/send_code">Envoyer un code d'invitation</a> --> <!-- <a class="list-group-item list-group-item-action" href="/user/send_code">Envoyer un code d'invitation</a> -->
<a class="list-group-item list-group-item-action" href="/user/new">Créer un nouveau compte directement</a> <a class="list-group-item list-group-item-action" href="/user/new">Créer un nouveau compte directement</a>
<a class="list-group-item list-group-item-action" href="/SOGo">Accéder à mes courriels, mon agenda et à mes contacts</a> <a class="list-group-item list-group-item-action" href="https://mail.lesgrandsvoisins.com/SOGo/">Accéder à mes courriels, mon agenda et à mes contacts</a>
<a class="list-group-item list-group-item-action" href="https://www.lesgrandsvoisins.com/resdigita">Accéder au numérique des Grands Voisins .com</a> <a class="list-group-item list-group-item-action" href="https://www.lesgrandsvoisins.com/resdigita">Accéder au numérique des Grands Voisins .com</a>
</div> </div>
</div> </div>

View file

@ -44,7 +44,7 @@
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">
<!-- <a class="list-group-item list-group-item-action" href="/user/send_code">Envoyer un code d'invitation</a> --> <!-- <a class="list-group-item list-group-item-action" href="/user/send_code">Envoyer un code d'invitation</a> -->
<a class="list-group-item list-group-item-action" href="/user/new">Créer un nouveau compte directement</a> <a class="list-group-item list-group-item-action" href="/user/new">Créer un nouveau compte directement</a>
<a class="list-group-item list-group-item-action" href="/SOGo">Accéder à mes courriels, mon agenda et à mes contacts</a> <a class="list-group-item list-group-item-action" href="https://mail.lesgrandsvoisins.com/SOGo/">Accéder à mes courriels, mon agenda et à mes contacts</a>
<a class="list-group-item list-group-item-action" href="https://www.lesgrandsvoisins.com/resdigita">Accéder au numérique des Grands Voisins .com</a> <a class="list-group-item list-group-item-action" href="https://www.lesgrandsvoisins.com/resdigita">Accéder au numérique des Grands Voisins .com</a>
</div> </div>
</div> </div>

View file

@ -50,7 +50,7 @@
<li><a href="#">Les Outils</a><ul class="submenu"> <li><a href="#">Les Outils</a><ul class="submenu">
<li><a href="https://www.lesgrandsvoisins.com/les-outils/">Les Outils</a></li> <li><a href="https://www.lesgrandsvoisins.com/les-outils/">Les Outils</a></li>
<li><a href="https://www.avmeet.com">AVMeet.com</a></li> <li><a href="https://www.avmeet.com">AVMeet.com</a></li>
<li><a href="https://www.gvoisin.com/SOGo">Mail, Cal., Contacts</a></li> <li><a href="https://mail.lesgrandsvoisins.com/SOGo/">Mail, Cal., Contacts</a></li>
<li><a href="https://wiki.lesgrandsvoisins.com">Wiki</a></li> <li><a href="https://wiki.lesgrandsvoisins.com">Wiki</a></li>
<li><a href="https://www.lesgrandsvoisins.com/admin">Editer le site web</a></li> <li><a href="https://www.lesgrandsvoisins.com/admin">Editer le site web</a></li>
<li><a href="https://www.lesgrandsvoisins.com/admin">Editer le blog</a></li> <li><a href="https://www.lesgrandsvoisins.com/admin">Editer le blog</a></li>

View file

@ -137,6 +137,9 @@
username = document.getElementById("username"); username = document.getElementById("username");
defaultdomain = document.getElementById("defaultdomain"); defaultdomain = document.getElementById("defaultdomain");
mail = document.getElementById("mail"); mail = document.getElementById("mail");
if (!username.value.includes("@")) {
username.value += "@" + defaultdomain.value;
}
mail.value = username.value + "@" + defaultdomain.value; mail.value = username.value + "@" + defaultdomain.value;
} }
document.getElementById("givenname").addEventListener("change", changeGivenNameOrSurname); document.getElementById("givenname").addEventListener("change", changeGivenNameOrSurname);

View file

@ -1,53 +0,0 @@
/*
config handles reading the config.json file at the root and processing the settings
*/
package main
import (
"encoding/json"
"flag"
"io/ioutil"
"log"
"os"
)
var configFlag = flag.String("config", "./config.json", "Configuration file path")
var config *ConfigFile
func readConfig() ConfigFile {
// Default configuration values for certain fields
config_file := ConfigFile{
HttpBindAddr: ":9991",
LdapServerAddr: "ldap://127.0.0.1:389",
UserNameAttr: "uid",
GroupNameAttr: "gid",
InvitationNameAttr: "cn",
InvitedAutoGroups: []string{},
Org: "ResDigita",
}
_, err := os.Stat(*configFlag)
if os.IsNotExist(err) {
log.Fatalf("Could not find Guichet configuration file at %s. Please create this file, for exemple starting with config.json.exemple and customizing it for your deployment.", *configFlag)
}
if err != nil {
log.Fatal(err)
}
bytes, err := ioutil.ReadFile(*configFlag)
if err != nil {
log.Fatal(err)
}
err = json.Unmarshal(bytes, &config_file)
if err != nil {
log.Fatal(err)
}
return config_file
}

View file

@ -1,40 +0,0 @@
/*
http-utils provide utility functions that interact with http
*/
package main
import (
"crypto/tls"
"net"
"net/http"
"github.com/go-ldap/ldap/v3"
)
func logRequest(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, r.URL)
handler.ServeHTTP(w, r)
})
}
func ldapOpen(w http.ResponseWriter) (*ldap.Conn, error) {
if config.LdapTLS {
tlsConf := &tls.Config{
ServerName: config.LdapServerAddr,
InsecureSkipVerify: true,
}
return ldap.DialTLS("tcp", net.JoinHostPort(config.LdapServerAddr, "636"), tlsConf)
} else {
return ldap.DialURL("ldap://" + config.LdapServerAddr)
}
// if err != nil {
// http.Error(w, err.Error(), http.StatusInternalServerError)
// log.Printf(fmt.Sprintf("27: %v %v", err, l))
// return nil
// }
// return l
}

View file

@ -1,17 +0,0 @@
/*
Utilities related to LDAP
*/
package main
import (
"github.com/go-ldap/ldap/v3"
)
func replaceIfContent(modifReq *ldap.ModifyRequest, key string, value string, previousValue string) error {
if value != "" {
modifReq.Replace(key, []string{value})
} else if previousValue != "" {
modifReq.Delete(key, []string{previousValue})
}
return nil
}

View file

@ -1,73 +0,0 @@
package main
import (
"bytes"
"crypto/tls"
"log"
"net"
"net/smtp"
"math/rand"
"html/template"
"github.com/go-ldap/ldap/v3"
// "golang.org/x/text/encoding/unicode"
)
func openLdap(config *ConfigFile) (*ldap.Conn, error) {
var ldapConn *ldap.Conn
var err error
if config.LdapTLS {
tlsConf := &tls.Config{
ServerName: config.LdapServerAddr,
InsecureSkipVerify: true,
}
ldapConn, err = ldap.DialTLS("tcp", net.JoinHostPort(config.LdapServerAddr, "636"), tlsConf)
} else {
ldapConn, err = ldap.DialURL("ldap://" + config.LdapServerAddr)
}
if err != nil {
log.Printf("openLDAP %v", err)
log.Printf("openLDAP %v", config.LdapServerAddr)
}
return ldapConn, err
// l, err := ldap.DialURL(config.LdapServerAddr)
// if err != nil {
// log.Printf(fmt.Sprint("Erreur connect LDAP %v", err))
// log.Printf(fmt.Sprint("Erreur connect LDAP %v", config.LdapServerAddr))
// return nil
// } else {
// return l
// }
}
// Suggesting a 12 char password with some excentrics
func suggestPassword() string {
password := ""
chars := "abcdfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*+_-="
for i := 0; i < 12; i++ {
password += string([]rune(chars)[rand.Intn(len(chars))])
}
return password
}
// Sends an email according to the enclosed information
func sendMail(sendMailTplData SendMailTplData) error {
log.Printf("sendMail")
templateMail := template.Must(template.ParseFiles(templatePath + "/" + sendMailTplData.RelTemplatePath))
buf := bytes.NewBuffer([]byte{})
err := templateMail.Execute(buf, sendMailTplData)
message := buf.Bytes()
auth := smtp.PlainAuth("", config.SMTPUsername, config.SMTPPassword, config.SMTPServer)
log.Printf("auth: %v", auth)
err = smtp.SendMail(config.SMTPServer+":587", auth, config.SMTPUsername, []string{sendMailTplData.To}, message)
if err != nil {
log.Printf("sendMail smtp.SendMail %v", err)
log.Printf("sendMail smtp.SendMail %v", sendMailTplData)
return err
}
log.Printf("Mail sent.")
return err
}

View file

@ -1,4 +1,4 @@
package main package utils
import ( import (
"github.com/jsimonetti/pwscheme/ssha512" "github.com/jsimonetti/pwscheme/ssha512"

View file

@ -1,137 +0,0 @@
/*
login handles login and current-user verification
*/
package main
import (
"fmt"
"log"
"net/http"
"strings"
"github.com/go-ldap/ldap/v3"
)
func (login *LoginStatus) WelcomeName() string {
ret := login.UserEntry.GetAttributeValue("givenName")
if ret == "" {
ret = login.UserEntry.GetAttributeValue("displayName")
}
if ret == "" {
ret = login.Info.Username
}
return ret
}
func handleLogout(w http.ResponseWriter, r *http.Request) {
err := logout(w, r)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
http.Redirect(w, r, "/", http.StatusFound)
}
func handleLogin(w http.ResponseWriter, r *http.Request) *LoginInfo {
templateLogin := getTemplate("login.html")
if r.Method == "POST" {
// log.Printf("%v", "Parsing Form handleLogin")
r.ParseForm()
username := strings.Join(r.Form["username"], "")
password := strings.Join(r.Form["password"], "")
user_dn := fmt.Sprintf("%s=%s,%s", config.UserNameAttr, username, config.UserBaseDN)
// log.Printf("%v", user_dn)
// log.Printf("%v", username)
if strings.EqualFold(username, config.AdminAccount) {
user_dn = username
}
loginInfo, err := doLogin(w, r, username, user_dn, password)
// log.Printf("%v", loginInfo)
if err != nil {
data := &LoginFormData{
Username: username,
Common: NestedCommonTplData{
CanAdmin: false,
CanInvite: true,
LoggedIn: false,
},
}
if ldap.IsErrorWithCode(err, ldap.LDAPResultInvalidCredentials) {
data.WrongPass = true
} else if ldap.IsErrorWithCode(err, ldap.LDAPResultNoSuchObject) {
data.WrongUser = true
} else {
log.Printf("%v", err)
log.Printf("%v", user_dn)
log.Printf("%v", username)
data.Common.ErrorMessage = err.Error()
}
// templateLogin.Execute(w, data)
execTemplate(w, templateLogin, data.Common, NestedLoginTplData{}, *config, data)
}
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
return loginInfo
} else if r.Method == "GET" {
execTemplate(w, templateLogin, NestedCommonTplData{
CanAdmin: false,
CanInvite: true,
LoggedIn: false}, NestedLoginTplData{}, *config, LoginFormData{
Common: NestedCommonTplData{
CanAdmin: false,
CanInvite: true,
LoggedIn: false}})
// templateLogin.Execute(w, LoginFormData{
// Common: NestedCommonTplData{
// CanAdmin: false,
// CanInvite: true,
// LoggedIn: false}})
return nil
} else {
http.Error(w, "Unsupported method", http.StatusBadRequest)
return nil
}
}
func doLogin(w http.ResponseWriter, r *http.Request, username string, user_dn string, password string) (*LoginInfo, error) {
l, _ := ldapOpen(w)
err := l.Bind(user_dn, password)
if err != nil {
log.Printf("doLogin : %v", err)
log.Printf("doLogin : %v", user_dn)
return nil, err
}
// Successfully logged in, save it to session
session, err := store.Get(r, SESSION_NAME)
if err != nil {
session, _ = store.New(r, SESSION_NAME)
}
session.Values["login_username"] = username
session.Values["login_password"] = password
session.Values["login_dn"] = user_dn
err = session.Save(r, w)
if err != nil {
log.Printf("doLogin Session Save: %v", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return nil, err
}
LoginInfo := LoginInfo{
DN: user_dn,
Username: username,
Password: password,
}
return &LoginInfo, nil
}

View file

@ -1,7 +1,8 @@
package main package views
import ( import (
"fmt" "fmt"
"guichet/models"
"net/http" "net/http"
"regexp" "regexp"
"sort" "sort"
@ -11,6 +12,7 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )
func checkAdminLogin(w http.ResponseWriter, r *http.Request) *LoginStatus { func checkAdminLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
login := checkLogin(w, r) login := checkLogin(w, r)
if login == nil { if login == nil {
@ -36,7 +38,7 @@ func (d EntryList) Less(i, j int) bool {
return d[i].DN < d[j].DN return d[i].DN < d[j].DN
} }
func handleAdminActivateUsers(w http.ResponseWriter, r *http.Request) { func HandleAdminActivateUsers(w http.ResponseWriter, r *http.Request) {
templateAdminActivateUsers := getTemplate("admin/activate.html") templateAdminActivateUsers := getTemplate("admin/activate.html")
login := checkAdminLogin(w, r) login := checkAdminLogin(w, r)
if login == nil { if login == nil {
@ -55,6 +57,8 @@ func handleAdminActivateUsers(w http.ResponseWriter, r *http.Request) {
nil) nil)
sr, err := login.conn.Search(searchRequest) sr, err := login.conn.Search(searchRequest)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return
@ -76,7 +80,7 @@ func handleAdminActivateUsers(w http.ResponseWriter, r *http.Request) {
} }
func handleAdminActivateUser(w http.ResponseWriter, r *http.Request) { func HandleAdminActivateUser(w http.ResponseWriter, r *http.Request) {
cn := mux.Vars(r)["cn"] cn := mux.Vars(r)["cn"]
login := checkAdminLogin(w, r) login := checkAdminLogin(w, r)
if login == nil { if login == nil {
@ -90,7 +94,7 @@ func handleAdminActivateUser(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/admin/activate", http.StatusFound) http.Redirect(w, r, "/admin/activate", http.StatusFound)
} }
func handleAdminUnactivateUser(w http.ResponseWriter, r *http.Request) { func HandleAdminUnactivateUser(w http.ResponseWriter, r *http.Request) {
cn := mux.Vars(r)["cn"] cn := mux.Vars(r)["cn"]
login := checkAdminLogin(w, r) login := checkAdminLogin(w, r)
if login == nil { if login == nil {
@ -104,7 +108,7 @@ func handleAdminUnactivateUser(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/admin/users", http.StatusFound) http.Redirect(w, r, "/admin/users", http.StatusFound)
} }
func handleAdminUsers(w http.ResponseWriter, r *http.Request) { func HandleAdminUsers(w http.ResponseWriter, r *http.Request) {
templateAdminUsers := getTemplate("admin/users.html") templateAdminUsers := getTemplate("admin/users.html")
login := checkAdminLogin(w, r) login := checkAdminLogin(w, r)
@ -148,7 +152,7 @@ func handleAdminUsers(w http.ResponseWriter, r *http.Request) {
templateAdminUsers.Execute(w, data) templateAdminUsers.Execute(w, data)
} }
func handleAdminGroups(w http.ResponseWriter, r *http.Request) { func HandleAdminGroups(w http.ResponseWriter, r *http.Request) {
templateAdminGroups := getTemplate("admin/groups.html") templateAdminGroups := getTemplate("admin/groups.html")
login := checkAdminLogin(w, r) login := checkAdminLogin(w, r)
@ -184,7 +188,7 @@ func handleAdminGroups(w http.ResponseWriter, r *http.Request) {
templateAdminGroups.Execute(w, data) templateAdminGroups.Execute(w, data)
} }
func handleAdminMailing(w http.ResponseWriter, r *http.Request) { func HandleAdminMailing(w http.ResponseWriter, r *http.Request) {
templateAdminMailing := getTemplate("admin/mailing.html") templateAdminMailing := getTemplate("admin/mailing.html")
login := checkAdminLogin(w, r) login := checkAdminLogin(w, r)
@ -220,7 +224,7 @@ func handleAdminMailing(w http.ResponseWriter, r *http.Request) {
templateAdminMailing.Execute(w, data) templateAdminMailing.Execute(w, data)
} }
func handleAdminMailingList(w http.ResponseWriter, r *http.Request) { func HandleAdminMailingList(w http.ResponseWriter, r *http.Request) {
templateAdminMailingList := getTemplate("admin/mailing/list.html") templateAdminMailingList := getTemplate("admin/mailing/list.html")
login := checkAdminLogin(w, r) login := checkAdminLogin(w, r)
@ -231,7 +235,7 @@ func handleAdminMailingList(w http.ResponseWriter, r *http.Request) {
id := mux.Vars(r)["id"] id := mux.Vars(r)["id"]
dn := fmt.Sprintf("%s=%s,%s", config.MailingNameAttr, id, config.MailingBaseDN) dn := fmt.Sprintf("%s=%s,%s", config.MailingNameAttr, id, config.MailingBaseDN)
// handle modifications // Handle modifications
dError := "" dError := ""
dSuccess := false dSuccess := false
@ -416,7 +420,7 @@ func handleAdminMailingList(w http.ResponseWriter, r *http.Request) {
// LDAP EXPLORER // LDAP EXPLORER
// =================================================== // ===================================================
func handleAdminLDAP(w http.ResponseWriter, r *http.Request) { func HandleAdminLDAP(w http.ResponseWriter, r *http.Request) {
templateAdminLDAP := getTemplate("admin/ldap.html") templateAdminLDAP := getTemplate("admin/ldap.html")
login := checkAdminLogin(w, r) login := checkAdminLogin(w, r)
@ -851,7 +855,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
}) })
} }
func handleAdminCreate(w http.ResponseWriter, r *http.Request) { func HandleAdminCreate(w http.ResponseWriter, r *http.Request) {
templateAdminCreate := getTemplate("admin/create.html") templateAdminCreate := getTemplate("admin/create.html")
login := checkAdminLogin(w, r) login := checkAdminLogin(w, r)
@ -954,7 +958,7 @@ func handleAdminCreate(w http.ResponseWriter, r *http.Request) {
} else if len(data.IdValue) == 0 { } else if len(data.IdValue) == 0 {
data.Common.Error = "No identifier specified" data.Common.Error = "No identifier specified"
} else { } else {
newUser := User{ newUser := models.User{
DN: data.IdType + "=" + data.IdValue + "," + super_dn, DN: data.IdType + "=" + data.IdValue + "," + super_dn,
} }
// dn := data.IdType + "=" + data.IdValue + "," + super_dn // dn := data.IdType + "=" + data.IdValue + "," + super_dn
@ -1002,7 +1006,7 @@ func handleAdminCreate(w http.ResponseWriter, r *http.Request) {
// req.Attribute("description", []string{data.Description}) // req.Attribute("description", []string{data.Description})
} }
add(newUser, config, login.conn) models.AddUser(newUser, &config, login.conn)
// err := login.conn.Add(req) // err := login.conn.Add(req)
// // log.Printf(fmt.Sprintf("899: %v",err)) // // log.Printf(fmt.Sprintf("899: %v",err))

58
views/directory.go Normal file
View file

@ -0,0 +1,58 @@
package views
import (
"guichet/models"
"html/template"
"net/http"
// "sort"
"strings"
// "golang.org/x/crypto/openpgp/errors"
// "honnef.co/go/tools/analysis/facts/nilness"
// "github.com/go-ldap/ldap/v3"
)
const FIELD_NAME_PROFILE_PICTURE = "profilePicture"
const FIELD_NAME_DIRECTORY_VISIBILITY = "directoryVisibility"
func HandleDirectory(w http.ResponseWriter, r *http.Request) {
templateDirectory := getTemplate("directory.html")
login := checkLogin(w, r)
if login == nil {
return
}
templateDirectory.Execute(w, nil)
}
func HandleDirectorySearch(w http.ResponseWriter, r *http.Request) error {
templateDirectoryResults := template.Must(template.ParseFiles(templatePath + "/directory_results.html"))
//Get input value by user
r.ParseMultipartForm(1024)
input := strings.TrimSpace(strings.Join(r.Form["query"], ""))
if r.Method != "POST" {
http.Error(w, "Invalid request", http.StatusBadRequest)
return nil
}
//Log to allow the research
login := checkLogin(w, r)
if login == nil {
http.Error(w, "Login required", http.StatusUnauthorized)
return nil
}
search_results, err := models.DoDirectorySearch(login.conn, input)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return err
}
templateDirectoryResults.Execute(w, search_results)
return nil
}

View file

@ -2,16 +2,18 @@
home show the home page home show the home page
*/ */
package main package views
import "net/http" import (
"net/http"
)
func handleHome(w http.ResponseWriter, r *http.Request) { func HandleHome(w http.ResponseWriter, r *http.Request) {
templateHome := getTemplate("home.html") templateHome := getTemplate("home.html")
login := checkLogin(w, r) login := checkLogin(w, r)
if login == nil { if login == nil {
status := handleLogin(w, r) status, _ := HandleLogin(w, r)
if status == nil { if status == nil {
return return
} }
@ -35,7 +37,7 @@ func handleHome(w http.ResponseWriter, r *http.Request) {
LoggedIn: true, LoggedIn: true,
}, },
} }
execTemplate(w, templateHome, data.Common, data.Login, *config, data) execTemplate(w, templateHome, data.Common, data.Login, data)
// templateHome.Execute(w, data) // templateHome.Execute(w, data)
} }

18
views/http.go Normal file
View file

@ -0,0 +1,18 @@
/*
http-utils provide utility functions that interact with http
*/
package views
import (
"net/http"
)
func LogRequest(Handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, r.URL)
Handler.ServeHTTP(w, r)
})
}

View file

@ -1,4 +1,4 @@
package main package views
import ( import (
"bytes" "bytes"
@ -6,13 +6,16 @@ import (
"encoding/binary" "encoding/binary"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"guichet/models"
"guichet/utils"
"html/template" "html/template"
"log" "log"
"net/http" "net/http"
"regexp" "regexp"
"strings" "strings"
// "github.com/emersion/go-sasl" // "crypto/rand"
// "github.com/emersion/go-smtp" // "github.com/emersion/go-smtp"
"github.com/go-ldap/ldap/v3" "github.com/go-ldap/ldap/v3"
"github.com/gorilla/mux" "github.com/gorilla/mux"
@ -36,31 +39,13 @@ func checkInviterLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
return login return login
} }
// New account creation directly from interface
func openNewUserLdap(config *ConfigFile) (*ldap.Conn, error) {
l, err := openLdap(config)
if err != nil {
log.Printf("openNewUserLdap 1 : %v %v", err, l)
log.Printf("openNewUserLdap 1 : %v", config)
// data.Common.ErrorMessage = err.Error()
}
err = l.Bind(config.NewUserDN, config.NewUserPassword)
if err != nil {
log.Printf("openNewUserLdap Bind : %v", err)
log.Printf("openNewUserLdap Bind : %v", config.NewUserDN)
// log.Printf("openNewUserLdap Bind : %v", config.NewUserPassword)
// log.Printf("openNewUserLdap Bind : %v", config)
// data.Common.ErrorMessage = err.Error()
}
return l, err
}
func handleInviteNewAccount(w http.ResponseWriter, r *http.Request) { func HandleInviteNewAccount(w http.ResponseWriter, r *http.Request) {
l, err := ldapOpen(w) l, err := ldapOpen(w)
if err != nil { if err != nil {
log.Printf("view-invite.go - handleInviteNewAccount - ldapOpen : %v", err) log.Printf("view-invite.go - HandleInviteNewAccount - ldapOpen : %v", err)
log.Printf("view-invite.go - handleInviteNewAccount - ldapOpen: %v", l) log.Printf("view-invite.go - HandleInviteNewAccount - ldapOpen: %v", l)
} }
if l == nil { if l == nil {
return return
@ -68,15 +53,15 @@ func handleInviteNewAccount(w http.ResponseWriter, r *http.Request) {
err = l.Bind(config.NewUserDN, config.NewUserPassword) err = l.Bind(config.NewUserDN, config.NewUserPassword)
if err != nil { if err != nil {
log.Printf("view-invite.go - handleInviteNewAccount - l.Bind : %v", err) log.Printf("view-invite.go - HandleInviteNewAccount - l.Bind : %v", err)
log.Printf("view-invite.go - handleInviteNewAccount - l.Bind: %v", config.NewUserDN) log.Printf("view-invite.go - HandleInviteNewAccount - l.Bind: %v", config.NewUserDN)
panic(fmt.Sprintf("view-invite.go - handleInviteNewAccount - l.Bind : %v", err)) panic(fmt.Sprintf("view-invite.go - HandleInviteNewAccount - l.Bind : %v", err))
} }
handleNewAccount(w, r, l, config.NewUserDN) HandleNewAccount(w, r, l, config.NewUserDN)
} }
// New account creation using code // New account creation using code
func handleInvitationCode(w http.ResponseWriter, r *http.Request) { func HandleInvitationCode(w http.ResponseWriter, r *http.Request) {
code := mux.Vars(r)["code"] code := mux.Vars(r)["code"]
code_id, code_pw := readCode(code) code_id, code_pw := readCode(code)
login := checkLogin(w, r) login := checkLogin(w, r)
@ -103,7 +88,7 @@ func handleInvitationCode(w http.ResponseWriter, r *http.Request) {
return return
} }
invitedBy := sr.Entries[0].GetAttributeValue("creatorsname") invitedBy := sr.Entries[0].GetAttributeValue("creatorsname")
if handleNewAccount(w, r, login.conn, invitedBy) { if HandleNewAccount(w, r, login.conn, invitedBy) {
del_req := ldap.NewDelRequest(inviteDn, nil) del_req := ldap.NewDelRequest(inviteDn, nil)
err = login.conn.Del(del_req) err = login.conn.Del(del_req)
if err != nil { if err != nil {
@ -113,14 +98,14 @@ func handleInvitationCode(w http.ResponseWriter, r *http.Request) {
} }
// Common functions for new account // Common functions for new account
func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invitedBy string) bool { func HandleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invitedBy string) bool {
templateInviteNewAccount := getTemplate("user/new.html") templateInviteNewAccount := getTemplate("user/new.html")
data := NewAccountData{ data := NewAccountData{
NewUserDefaultDomain: config.NewUserDefaultDomain, NewUserDefaultDomain: config.NewUserDefaultDomain,
} }
if r.Method == "POST" { if r.Method == "POST" {
r.ParseForm() r.ParseForm()
newUser := User{} newUser := models.User{}
newUser.DisplayName = strings.TrimSpace(strings.Join(r.Form["displayname"], "")) newUser.DisplayName = strings.TrimSpace(strings.Join(r.Form["displayname"], ""))
newUser.GivenName = strings.TrimSpace(strings.Join(r.Form["givenname"], "")) newUser.GivenName = strings.TrimSpace(strings.Join(r.Form["givenname"], ""))
newUser.SN = strings.TrimSpace(strings.Join(r.Form["surname"], "")) newUser.SN = strings.TrimSpace(strings.Join(r.Form["surname"], ""))
@ -137,7 +122,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
} else { } else {
newUser.Password = password2 newUser.Password = password2
l.Bind(config.NewUserDN, config.NewUserPassword) l.Bind(config.NewUserDN, config.NewUserPassword)
err := add(newUser, config, l) err := models.AddUser(newUser, &config, l)
if err != nil { if err != nil {
data.Common.Success = false data.Common.Success = false
data.Common.ErrorMessage = err.Error() data.Common.ErrorMessage = err.Error()
@ -146,7 +131,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
} }
// tryCreateAccount(l, data, password1, password2, invitedBy) // tryCreateAccount(l, data, password1, password2, invitedBy)
} else { } else {
data.SuggestPW = fmt.Sprintf("%s", suggestPassword()) data.SuggestPW = fmt.Sprintf("%s", models.SuggestPassword())
} }
data.Common.CanAdmin = false data.Common.CanAdmin = false
data.Common.LoggedIn = false data.Common.LoggedIn = false
@ -195,7 +180,7 @@ func tryCreateAccount(l *ldap.Conn, data *NewAccountData, pass1 string, pass2 st
req := ldap.NewAddRequest(userDn, nil) req := ldap.NewAddRequest(userDn, nil)
req.Attribute("objectclass", []string{"inetOrgPerson", "organizationalPerson", "person", "top"}) req.Attribute("objectclass", []string{"inetOrgPerson", "organizationalPerson", "person", "top"})
req.Attribute("structuralobjectclass", []string{"inetOrgPerson"}) req.Attribute("structuralobjectclass", []string{"inetOrgPerson"})
pw, err := SSHAEncode(pass1) pw, err := utils.SSHAEncode(pass1)
if err != nil { if err != nil {
data.Common.ErrorMessage = err.Error() data.Common.ErrorMessage = err.Error()
return return
@ -232,7 +217,7 @@ func tryCreateAccount(l *ldap.Conn, data *NewAccountData, pass1 string, pass2 st
} }
// ---- Code generation ---- // ---- Code generation ----
func handleInviteSendCode(w http.ResponseWriter, r *http.Request) { func HandleInviteSendCode(w http.ResponseWriter, r *http.Request) {
templateInviteSendCode := getTemplate("user/code/send.html") templateInviteSendCode := getTemplate("user/code/send.html")
login := checkInviterLogin(w, r) login := checkInviterLogin(w, r)
if login == nil { if login == nil {
@ -392,7 +377,7 @@ func trySendCode(login *LoginStatus, choice string, sendto string, data *SendCod
} }
templateMail := template.Must(template.ParseFiles(templatePath + "/invite_mail.txt")) templateMail := template.Must(template.ParseFiles(templatePath + "/invite_mail.txt"))
buf := bytes.NewBuffer([]byte{}) buf := bytes.NewBuffer([]byte{})
templateMail.Execute(buf, &CodeMailFields{ templateMail.Execute(buf, &models.CodeMailFields{
To: sendto, To: sendto,
From: config.MailFrom, From: config.MailFrom,
InviteFrom: login.WelcomeName(), InviteFrom: login.WelcomeName(),

144
views/login.go Normal file
View file

@ -0,0 +1,144 @@
/*
login Handles login and current-user verification
*/
package views
import (
"fmt"
"log"
"net/http"
"strings"
"github.com/go-ldap/ldap/v3"
)
func HandleLogout(w http.ResponseWriter, r *http.Request) {
err := logout(w, r)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
http.Redirect(w, r, "/", http.StatusFound)
}
func HandleLogin(w http.ResponseWriter, r *http.Request) (*LoginInfo, error) {
templateLogin := getTemplate("login.html")
if r.Method == "POST" {
// log.Printf("%v", "Parsing Form HandleLogin")
r.ParseForm()
username := strings.Join(r.Form["username"], "")
password := strings.Join(r.Form["password"], "")
l, _ := ldapOpen(w)
user_dn := fmt.Sprintf("%s=%s,%s", config.UserNameAttr, username, config.UserBaseDN)
// log.Printf("%v", user_dn)
// log.Printf("%v", username)
if strings.EqualFold(username, config.AdminAccount) {
user_dn = username
}
err := l.Bind(user_dn, password)
if err != nil {
log.Printf("DoLogin : %v", err)
log.Printf("DoLogin : %v", user_dn)
return nil, err
}
// func encodePassword(inPassword string) (string, error) {
// utf16 := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM)
// return utf16.NewEncoder().String("\"" + inPassword + "\"")
// // if err != nil {
// // log.Printf("Error encoding password: %s", err)
// // return err
// // }
// }
// log.Printf("%v", LoginInfo)
if err != nil {
data := &LoginFormData{
Username: username,
Common: NestedCommonTplData{
CanAdmin: false,
CanInvite: true,
LoggedIn: false,
},
}
if ldap.IsErrorWithCode(err, ldap.LDAPResultInvalidCredentials) {
data.WrongPass = true
} else if ldap.IsErrorWithCode(err, ldap.LDAPResultNoSuchObject) {
data.WrongUser = true
} else {
log.Printf("%v", err)
log.Printf("%v", user_dn)
log.Printf("%v", username)
data.Common.ErrorMessage = err.Error()
}
}
// Successfully logged in, save it to session
session, err := GuichetSessionStore.Get(r, SESSION_NAME)
if err != nil {
session, _ = GuichetSessionStore.New(r, SESSION_NAME)
}
session.Values["login_username"] = username
session.Values["login_password"] = password
session.Values["login_dn"] = user_dn
err = session.Save(r, w)
if err != nil {
log.Printf("DoLogin Session Save: %v", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return nil, err
}
// // templateLogin.Execute(w, data)
// execTemplate(w, templateLogin, data.Common, NestedLoginTplData{}, *config, data)
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
} else if r.Method == "GET" {
execTemplate(w, templateLogin, NestedCommonTplData{
CanAdmin: false,
CanInvite: true,
LoggedIn: false}, NestedLoginTplData{}, LoginFormData{
Common: NestedCommonTplData{
CanAdmin: false,
CanInvite: true,
LoggedIn: false}})
// templateLogin.Execute(w, LoginFormData{
// Common: NestedCommonTplData{
// CanAdmin: false,
// CanInvite: true,
// LoggedIn: false}})
return nil, nil
} else {
http.Error(w, "Unsupported method", http.StatusBadRequest)
return nil, nil
}
// execTemplate(w, templateLogin, data.Common, NestedLoginTplData{}, *config, data)
return nil, nil
}
// func NotDoLogin(w http.ResponseWriter, r *http.Request, username string, user_dn string, password string) (*LoginInfo, error) {
// }

View file

@ -1,8 +1,9 @@
package main package views
import ( import (
b64 "encoding/base64" b64 "encoding/base64"
"fmt" "fmt"
"guichet/models"
"log" "log"
"net/http" "net/http"
"strings" "strings"
@ -11,7 +12,7 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )
func handleLostPassword(w http.ResponseWriter, r *http.Request) { func HandleLostPassword(w http.ResponseWriter, r *http.Request) {
templateLostPasswordPage := getTemplate("passwd/lost.html") templateLostPasswordPage := getTemplate("passwd/lost.html")
if checkLogin(w, r) != nil { if checkLogin(w, r) != nil {
http.Redirect(w, r, "/", http.StatusTemporaryRedirect) http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
@ -28,37 +29,37 @@ func handleLostPassword(w http.ResponseWriter, r *http.Request) {
data.Username = strings.TrimSpace(strings.Join(r.Form["username"], "")) data.Username = strings.TrimSpace(strings.Join(r.Form["username"], ""))
data.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], "")) data.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
data.OtherMailbox = strings.TrimSpace(strings.Join(r.Form["othermailbox"], "")) data.OtherMailbox = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
user := User{ user := models.User{
CN: strings.TrimSpace(strings.Join(r.Form["username"], "")), CN: strings.TrimSpace(strings.Join(r.Form["username"], "")),
UID: strings.TrimSpace(strings.Join(r.Form["username"], "")), UID: strings.TrimSpace(strings.Join(r.Form["username"], "")),
Mail: strings.TrimSpace(strings.Join(r.Form["mail"], "")), Mail: strings.TrimSpace(strings.Join(r.Form["mail"], "")),
OtherMailbox: strings.TrimSpace(strings.Join(r.Form["othermailbox"], "")), OtherMailbox: strings.TrimSpace(strings.Join(r.Form["othermailbox"], "")),
} }
ldapNewConn, err := openNewUserLdap(config) ldapNewConn, err := models.OpenNewUserLdap(&config)
if err != nil { if err != nil {
log.Printf(fmt.Sprintf("handleLostPassword 99 : %v %v", err, ldapNewConn)) log.Printf(fmt.Sprintf("HandleLostPassword 99 : %v %v", err, ldapNewConn))
data.Common.ErrorMessage = err.Error() data.Common.ErrorMessage = err.Error()
} }
if err != nil { if err != nil {
log.Printf(fmt.Sprintf("handleLostPassword 104 : %v %v", err, ldapNewConn)) log.Printf(fmt.Sprintf("HandleLostPassword 104 : %v %v", err, ldapNewConn))
data.Common.ErrorMessage = err.Error() data.Common.ErrorMessage = err.Error()
} else { } else {
// err = ldapConn.Bind(config.NewUserDN, config.NewUserPassword) // err = ldapConn.Bind(config.NewUserDN, config.NewUserPassword)
if err != nil { if err != nil {
log.Printf(fmt.Sprintf("handleLostPassword 109 : %v %v", err, ldapNewConn)) log.Printf(fmt.Sprintf("HandleLostPassword 109 : %v %v", err, ldapNewConn))
data.Common.ErrorMessage = err.Error() data.Common.ErrorMessage = err.Error()
} else { } else {
data.Common.Success = true data.Common.Success = true
} }
} }
err = passwordLost(user, config, ldapNewConn) err = models.PasswordLost(user, &config, ldapNewConn)
} }
data.Common.CanAdmin = false data.Common.CanAdmin = false
// templateLostPasswordPage.Execute(w, data) // templateLostPasswordPage.Execute(w, data)
execTemplate(w, templateLostPasswordPage, data.Common, NestedLoginTplData{}, *config, data) execTemplate(w, templateLostPasswordPage, data.Common, NestedLoginTplData{}, data)
} }
func handleFoundPassword(w http.ResponseWriter, r *http.Request) { func HandleFoundPassword(w http.ResponseWriter, r *http.Request) {
templateFoundPasswordPage := getTemplate("passwd.html") templateFoundPasswordPage := getTemplate("passwd.html")
data := PasswdTplData{ data := PasswdTplData{
Common: NestedCommonTplData{ Common: NestedCommonTplData{
@ -68,22 +69,22 @@ func handleFoundPassword(w http.ResponseWriter, r *http.Request) {
code := mux.Vars(r)["code"] code := mux.Vars(r)["code"]
// code = strings.TrimSpace(strings.Join([]string{code}, "")) // code = strings.TrimSpace(strings.Join([]string{code}, ""))
newCode, _ := b64.URLEncoding.DecodeString(code) newCode, _ := b64.URLEncoding.DecodeString(code)
ldapNewConn, err := openNewUserLdap(config) ldapNewConn, err := models.OpenNewUserLdap(&config)
if err != nil { if err != nil {
log.Printf("handleFoundPassword openNewUserLdap(config) : %v", err) log.Printf("HandleFoundPassword OpenNewUserLdap(config) : %v", err)
data.Common.ErrorMessage = err.Error() data.Common.ErrorMessage = err.Error()
} }
codeArray := strings.Split(string(newCode), ";") codeArray := strings.Split(string(newCode), ";")
user := User{ user := models.User{
UID: codeArray[0], UID: codeArray[0],
Password: codeArray[1], Password: codeArray[1],
DN: "uid=" + codeArray[0] + "," + config.InvitationBaseDN, DN: "uid=" + codeArray[0] + "," + config.InvitationBaseDN,
} }
user.SeeAlso, err = passwordFound(user, config, ldapNewConn) user.SeeAlso, err = models.PasswordFound(user, &config, ldapNewConn)
if err != nil { if err != nil {
log.Printf("passwordFound(user, config, ldapConn) %v", err) log.Printf("PasswordFound(models.User, config, ldapConn) %v", err)
log.Printf("passwordFound(user, config, ldapConn) %v", user) log.Printf("PasswordFound(models.User, config, ldapConn) %v", user)
log.Printf("passwordFound(user, config, ldapConn) %v", ldapNewConn) log.Printf("PasswordFound(models.User, config, ldapConn) %v", ldapNewConn)
data.Common.ErrorMessage = err.Error() data.Common.ErrorMessage = err.Error()
} }
if r.Method == "POST" { if r.Method == "POST" {
@ -97,10 +98,10 @@ func handleFoundPassword(w http.ResponseWriter, r *http.Request) {
} else if password2 != password { } else if password2 != password {
data.NoMatchError = true data.NoMatchError = true
} else { } else {
err := passwd(User{ err := models.PassWD(models.User{
DN: user.SeeAlso, DN: user.SeeAlso,
Password: password, Password: password,
}, config, ldapNewConn) }, &config, ldapNewConn)
if err != nil { if err != nil {
data.Common.ErrorMessage = err.Error() data.Common.ErrorMessage = err.Error()
} else { } else {
@ -110,10 +111,10 @@ func handleFoundPassword(w http.ResponseWriter, r *http.Request) {
} }
data.Common.CanAdmin = false data.Common.CanAdmin = false
// templateFoundPasswordPage.Execute(w, data) // templateFoundPasswordPage.Execute(w, data)
execTemplate(w, templateFoundPasswordPage, data.Common, data.Login, *config, data) execTemplate(w, templateFoundPasswordPage, data.Common, data.Login, data)
} }
func handlePasswd(w http.ResponseWriter, r *http.Request) { func HandlePasswd(w http.ResponseWriter, r *http.Request) {
templatePasswd := getTemplate("passwd.html") templatePasswd := getTemplate("passwd.html")
data := &PasswdTplData{ data := &PasswdTplData{
Common: NestedCommonTplData{ Common: NestedCommonTplData{
@ -143,10 +144,10 @@ func handlePasswd(w http.ResponseWriter, r *http.Request) {
} else if password2 != password { } else if password2 != password {
data.NoMatchError = true data.NoMatchError = true
} else { } else {
err := passwd(User{ err := models.PassWD(models.User{
DN: login.Info.DN, DN: login.Info.DN,
Password: password, Password: password,
}, config, login.conn) }, &config, login.conn)
if err != nil { if err != nil {
data.Common.ErrorMessage = err.Error() data.Common.ErrorMessage = err.Error()
} else { } else {
@ -156,5 +157,5 @@ func handlePasswd(w http.ResponseWriter, r *http.Request) {
} }
data.Common.CanAdmin = false data.Common.CanAdmin = false
// templatePasswd.Execute(w, data) // templatePasswd.Execute(w, data)
execTemplate(w, templatePasswd, data.Common, data.Login, *config, data) execTemplate(w, templatePasswd, data.Common, data.Login, data)
} }

View file

@ -1,4 +1,4 @@
package main package views
import ( import (
"bytes" "bytes"
@ -141,7 +141,7 @@ func resizePicture(file multipart.File, buffFull, buffThumb *bytes.Buffer) error
return err return err
} }
func handleDownloadPicture(w http.ResponseWriter, r *http.Request) { func HandleDownloadPicture(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"] name := mux.Vars(r)["name"]
//Check login //Check login

View file

@ -1,9 +1,10 @@
/* /*
Handles session login and lougout with HTTP stuff Handles session login and lougout with HTTP stuff
*/ */
package main package views
import ( import (
"guichet/models"
"log" "log"
"net/http" "net/http"
) )
@ -14,7 +15,7 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
if l == nil { if l == nil {
return nil return nil
} }
session, err := store.Get(r, SESSION_NAME) session, err := GuichetSessionStore.Get(r, SESSION_NAME)
if err != nil { if err != nil {
log.Printf("checkLogin ldapOpen : %v", err) log.Printf("checkLogin ldapOpen : %v", err)
log.Printf("checkLogin ldapOpen : %v", session) log.Printf("checkLogin ldapOpen : %v", session)
@ -31,10 +32,10 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
Username: username.(string), Username: username.(string),
Password: password.(string), Password: password.(string),
} }
err = bind(User{ err = models.Bind(models.User{
DN: login_info.DN, DN: login_info.DN,
Password: login_info.Password, Password: login_info.Password,
}, config, l) }, &config, l)
if err != nil { if err != nil {
delete(session.Values, "login_username") delete(session.Values, "login_username")
delete(session.Values, "login_password") delete(session.Values, "login_password")
@ -47,10 +48,10 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
} }
return checkLogin(w, r) return checkLogin(w, r)
} }
ldapUser, err := get(User{ ldapUser, err := models.GetUser(models.User{
DN: login_info.DN, DN: login_info.DN,
CN: login_info.Username, CN: login_info.Username,
}, config, l) }, &config, l)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return nil return nil
@ -159,9 +160,9 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
*/ */
func logout(w http.ResponseWriter, r *http.Request) error { func logout(w http.ResponseWriter, r *http.Request) error {
session, err := store.Get(r, SESSION_NAME) session, err := GuichetSessionStore.Get(r, SESSION_NAME)
if err != nil { if err != nil {
session, _ = store.New(r, SESSION_NAME) session, _ = GuichetSessionStore.New(r, SESSION_NAME)
// return err // return err
} else { } else {
delete(session.Values, "login_username") delete(session.Values, "login_username")

View file

@ -1,9 +1,10 @@
package main package views
import ( import (
// b64 "encoding/base64" // b64 "encoding/base64"
"fmt" "fmt"
// "log" // "log"
"guichet/models"
"log" "log"
"net/http" "net/http"
"strings" "strings"
@ -12,7 +13,7 @@ import (
// "github.com/gorilla/mux" // "github.com/gorilla/mux"
) )
func handleUserWait(w http.ResponseWriter, r *http.Request) { func HandleUserWait(w http.ResponseWriter, r *http.Request) {
templateUser := getTemplate("user/wait.html") templateUser := getTemplate("user/wait.html")
templateUser.Execute(w, HomePageData{ templateUser.Execute(w, HomePageData{
Common: NestedCommonTplData{ Common: NestedCommonTplData{
@ -22,7 +23,7 @@ func handleUserWait(w http.ResponseWriter, r *http.Request) {
}) })
} }
func handleUserMail(w http.ResponseWriter, r *http.Request) { func HandleUserMail(w http.ResponseWriter, r *http.Request) {
login := checkLogin(w, r) login := checkLogin(w, r)
if login == nil { if login == nil {
http.Redirect(w, r, "/", http.StatusFound) http.Redirect(w, r, "/", http.StatusFound)
@ -45,10 +46,10 @@ func handleUserMail(w http.ResponseWriter, r *http.Request) {
modifyRequest := ldap.NewModifyRequest(login.Info.DN, nil) modifyRequest := ldap.NewModifyRequest(login.Info.DN, nil)
modifyRequest.Delete("mail", []string{email}) modifyRequest.Delete("mail", []string{email})
log.Printf("handleUserMail %v", modifyRequest) log.Printf("HandleUserMail %v", modifyRequest)
err = login.conn.Modify(modifyRequest) err = login.conn.Modify(modifyRequest)
if err != nil { if err != nil {
log.Printf("handleUserMail DeleteMail %v", err) log.Printf("HandleUserMail DeleteMail %v", err)
http.Error(w, fmt.Sprintf("Error deleting the email: %s", err), http.StatusInternalServerError) http.Error(w, fmt.Sprintf("Error deleting the email: %s", err), http.StatusInternalServerError)
return return
} }
@ -63,7 +64,7 @@ func toInteger(index string) {
panic("unimplemented") panic("unimplemented")
} }
func handleUser(w http.ResponseWriter, r *http.Request) { func HandleUser(w http.ResponseWriter, r *http.Request) {
templateUser := getTemplate("user.html") templateUser := getTemplate("user.html")
login := checkLogin(w, r) login := checkLogin(w, r)
@ -98,7 +99,7 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" { if r.Method == "POST" {
//5MB maximum size files //5MB maximum size files
r.ParseMultipartForm(5 << 20) r.ParseMultipartForm(5 << 20)
user := User{ user := models.User{
DN: login.Info.DN, DN: login.Info.DN,
GivenName: strings.TrimSpace(strings.Join(r.Form["given_name"], "")), GivenName: strings.TrimSpace(strings.Join(r.Form["given_name"], "")),
DisplayName: strings.TrimSpace(strings.Join(r.Form["display_name"], "")), DisplayName: strings.TrimSpace(strings.Join(r.Form["display_name"], "")),
@ -112,16 +113,16 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
} }
if user.DisplayName != "" { if user.DisplayName != "" {
err := modify(user, config, login.conn) err := models.ModifyUser(user, &config, login.conn)
if err != nil { if err != nil {
data.Common.ErrorMessage = "handleUser : " + err.Error() data.Common.ErrorMessage = "HandleUser : " + err.Error()
} else { } else {
data.Common.Success = true data.Common.Success = true
} }
} }
findUser, err := get(user, config, login.conn) findUser, err := models.GetUser(user, &config, login.conn)
if err != nil { if err != nil {
data.Common.ErrorMessage = "handleUser : " + err.Error() data.Common.ErrorMessage = "HandleUser : " + err.Error()
} }
data.DisplayName = findUser.DisplayName data.DisplayName = findUser.DisplayName
data.GivenName = findUser.GivenName data.GivenName = findUser.GivenName
@ -167,8 +168,8 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
} }
log.Printf("handleUser : %v", data) log.Printf("HandleUser : %v", data)
// templateUser.Execute(w, data) // templateUser.Execute(w, data)
execTemplate(w, templateUser, data.Common, data.Login, *config, data) execTemplate(w, templateUser, data.Common, data.Login, data)
} }

View file

@ -1,18 +1,84 @@
/* /*
Creates the webpages to be processed by Guichet Creates the webpages to be processed by Guichet
*/ */
package main package views
import ( import (
"crypto/tls"
"encoding/json"
"guichet/models"
"io/ioutil"
"net"
"flag"
"html/template" "html/template"
"log"
"net/http" "net/http"
"os"
// "net/http" // "net/http"
"strings" "strings"
"github.com/go-ldap/ldap/v3" "github.com/go-ldap/ldap/v3"
"github.com/gorilla/sessions"
) )
const SESSION_NAME = "guichet_session"
var templatePath = "./templates"
var GuichetSessionStore sessions.Store = nil
type EntryList []*ldap.Entry
type LoginInfo struct {
Username string
DN string
Password string
}
func ReadConfig() models.ConfigFile {
// Default configuration values for certain fields
flag.Parse()
var configFlag = flag.String("config", "./config.json", "Configuration file path")
config_file := models.ConfigFile{
HttpBindAddr: ":9991",
LdapServerAddr: "ldap://127.0.0.1:389",
UserNameAttr: "uid",
GroupNameAttr: "gid",
InvitationNameAttr: "cn",
InvitedAutoGroups: []string{},
Org: "ResDigita",
}
_, err := os.Stat(*configFlag)
if os.IsNotExist(err) {
log.Fatalf("Could not find Guichet configuration file at %s. Please create this file, for exemple starting with config.json.exemple and customizing it for your deployment.", *configFlag)
}
if err != nil {
log.Fatal(err)
}
bytes, err := ioutil.ReadFile(*configFlag)
if err != nil {
log.Fatal(err)
}
err = json.Unmarshal(bytes, &config_file)
if err != nil {
log.Fatal(err)
}
return config_file
}
type LoginStatus struct {
Info *LoginInfo
conn *ldap.Conn
UserEntry *ldap.Entry
Common NestedCommonTplData
}
type NestedCommonTplData struct { type NestedCommonTplData struct {
Error string Error string
ErrorMessage string ErrorMessage string
@ -24,12 +90,91 @@ type NestedCommonTplData struct {
WebsiteName string WebsiteName string
WebsiteURL string WebsiteURL string
} }
type CodeMailFields struct {
From string
To string
Code string
InviteFrom string
WebBaseAddress string
Common NestedCommonTplData
}
var config = ReadConfig()
func ldapOpen(w http.ResponseWriter) (*ldap.Conn, error) {
if config.LdapTLS {
tlsConf := &tls.Config{
ServerName: config.LdapServerAddr,
InsecureSkipVerify: true,
}
return ldap.DialTLS("tcp", net.JoinHostPort(config.LdapServerAddr, "636"), tlsConf)
} else {
return ldap.DialURL("ldap://" + config.LdapServerAddr)
}
// if err != nil {
// http.Error(w, err.Error(), http.StatusInternalServerError)
// log.Printf(fmt.Sprintf("27: %v %v", err, l))
// return nil
// }
// return l
}
// type keyView struct {
// Status *LoginStatus
// Key *garage.KeyInfo
// }
// type webInspectView struct {
// Status *LoginStatus
// Key *garage.KeyInfo
// Bucket *garage.BucketInfo
// IndexDoc string
// ErrorDoc string
// MaxObjects int64
// MaxSize int64
// UsedSizePct float64
// }
// type webListView struct {
// Status *LoginStatus
// Key *garage.KeyInfo
// }
type LayoutTemplateData struct {
Common NestedCommonTplData
Login NestedLoginTplData
Data any
}
type NestedLoginTplData struct { type NestedLoginTplData struct {
Login *LoginStatus Login *LoginStatus
Username string Username string
Status *LoginStatus Status *LoginStatus
} }
func execTemplate(w http.ResponseWriter, t *template.Template, commonData NestedCommonTplData, loginData NestedLoginTplData, data any) error {
commonData.WebsiteURL = config.WebAddress
commonData.WebsiteName = config.Org
return t.Execute(w, LayoutTemplateData{
Common: commonData,
Login: loginData,
Data: data,
})
}
func (login *LoginStatus) WelcomeName() string {
ret := login.UserEntry.GetAttributeValue("givenName")
if ret == "" {
ret = login.UserEntry.GetAttributeValue("displayName")
}
if ret == "" {
ret = login.Info.Username
}
return ret
}
type AdminUsersTplData struct { type AdminUsersTplData struct {
UserNameAttr string UserNameAttr string
UserBaseDN string UserBaseDN string
@ -123,17 +268,8 @@ type CreateData struct {
Common NestedCommonTplData Common NestedCommonTplData
Login NestedLoginTplData Login NestedLoginTplData
} }
type SearchResult struct {
DN string
Id string
DisplayName string
Email string
Description string
ProfilePicture string
}
type SearchResults struct {
Results []SearchResult
}
type HomePageData struct { type HomePageData struct {
Common NestedCommonTplData Common NestedCommonTplData
Login NestedLoginTplData Login NestedLoginTplData
@ -180,14 +316,7 @@ type SendCodeData struct {
WebBaseAddress string WebBaseAddress string
} }
type CodeMailFields struct {
From string
To string
Code string
InviteFrom string
WebBaseAddress string
Common NestedCommonTplData
}
type ProfileTplData struct { type ProfileTplData struct {
Mail string Mail string
MailValues []string MailValues []string
@ -209,17 +338,8 @@ type PasswdTplData struct {
TooShortError bool TooShortError bool
NoMatchError bool NoMatchError bool
} }
type LoginInfo struct {
Username string
DN string
Password string
}
type LoginStatus struct {
Info *LoginInfo
conn *ldap.Conn
UserEntry *ldap.Entry
Common NestedCommonTplData
}
type LoginFormData struct { type LoginFormData struct {
Username string Username string
WrongUser bool WrongUser bool
@ -227,30 +347,13 @@ type LoginFormData struct {
Common NestedCommonTplData Common NestedCommonTplData
} }
type EmailContentVarsTplData struct {
Code string
SendAddress string
InviteFrom string
}
// Data to be passed to an email for sending
type SendMailTplData struct {
// Sender of the email
To string
// Receiver of the email
From string
// Relative path (without leading /) to the email template in the templates folder
// usually ending in .txt
RelTemplatePath string
// Variables to be included in the template of the email
EmailContentVars EmailContentVarsTplData
}
type WrapperTemplate struct { type WrapperTemplate struct {
Template *template.Template Template *template.Template
} }
var templatePath = "./templates"
func getTemplate(name string) *template.Template { func getTemplate(name string) *template.Template {
return template.Must(template.New("layout.html").Funcs(template.FuncMap{ return template.Must(template.New("layout.html").Funcs(template.FuncMap{
@ -261,18 +364,5 @@ func getTemplate(name string) *template.Template {
)) ))
} }
type LayoutTemplateData struct {
Common NestedCommonTplData
Login NestedLoginTplData
Data any
}
func execTemplate(w http.ResponseWriter, t *template.Template, commonData NestedCommonTplData, loginData NestedLoginTplData, config ConfigFile, data any) error {
commonData.WebsiteURL = config.WebAddress
commonData.WebsiteName = config.Org
return t.Execute(w, LayoutTemplateData{
Common: commonData,
Login: loginData,
Data: data,
})
}