It Compiles !
This commit is contained in:
parent
e8d46fdf7d
commit
40ecbe2cfb
26 changed files with 175 additions and 4129 deletions
4
Makefile
4
Makefile
|
@ -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
|
||||||
|
|
||||||
|
|
112
controller.go
112
controller.go
|
@ -1,112 +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/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
|
|
||||||
}
|
|
109
directory.go
109
directory.go
|
@ -1,109 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"html/template"
|
|
||||||
"net/http"
|
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"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) {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
//Log to allow the research
|
|
||||||
login := checkLogin(w, r)
|
|
||||||
if login == nil {
|
|
||||||
http.Error(w, "Login required", http.StatusUnauthorized)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//Search values with ldap and filter
|
|
||||||
searchRequest := ldap.NewSearchRequest(
|
|
||||||
config.UserBaseDN,
|
|
||||||
ldap.ScopeSingleLevel, ldap.NeverDerefAliases, 0, 0, false,
|
|
||||||
"(&(objectclass=organizationalPerson)("+FIELD_NAME_DIRECTORY_VISIBILITY+"=on))",
|
|
||||||
[]string{
|
|
||||||
config.UserNameAttr,
|
|
||||||
"displayname",
|
|
||||||
"mail",
|
|
||||||
"description",
|
|
||||||
FIELD_NAME_PROFILE_PICTURE,
|
|
||||||
},
|
|
||||||
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
|
|
||||||
results := []SearchResult{}
|
|
||||||
|
|
||||||
for _, values := range sr.Entries {
|
|
||||||
if input == "" ||
|
|
||||||
ContainsI(values.GetAttributeValue(config.UserNameAttr), input) ||
|
|
||||||
ContainsI(values.GetAttributeValue("displayname"), input) ||
|
|
||||||
ContainsI(values.GetAttributeValue("mail"), input) {
|
|
||||||
results = append(results, SearchResult{
|
|
||||||
DN: values.DN,
|
|
||||||
Id: values.GetAttributeValue(config.UserNameAttr),
|
|
||||||
DisplayName: values.GetAttributeValue("displayname"),
|
|
||||||
Email: values.GetAttributeValue("mail"),
|
|
||||||
Description: values.GetAttributeValue("description"),
|
|
||||||
ProfilePicture: values.GetAttributeValue(FIELD_NAME_PROFILE_PICTURE),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
search_results := SearchResults{
|
|
||||||
Results: results,
|
|
||||||
}
|
|
||||||
sort.Sort(&search_results)
|
|
||||||
|
|
||||||
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]
|
|
||||||
}
|
|
252
garage.go
252
garage.go
|
@ -1,252 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
garage "git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-golang"
|
|
||||||
"github.com/go-ldap/ldap/v3"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
)
|
|
||||||
|
|
||||||
func gadmin() (*garage.APIClient, context.Context) {
|
|
||||||
// Set Host and other parameters
|
|
||||||
configuration := garage.NewConfiguration()
|
|
||||||
configuration.Host = config.S3AdminEndpoint
|
|
||||||
|
|
||||||
// We can now generate a client
|
|
||||||
client := garage.NewAPIClient(configuration)
|
|
||||||
|
|
||||||
// Authentication is handled through the context pattern
|
|
||||||
ctx := context.WithValue(context.Background(), garage.ContextAccessToken, config.S3AdminToken)
|
|
||||||
return client, ctx
|
|
||||||
}
|
|
||||||
|
|
||||||
func grgCreateKey(name string) (*garage.KeyInfo, error) {
|
|
||||||
client, ctx := gadmin()
|
|
||||||
|
|
||||||
kr := garage.AddKeyRequest{Name: &name}
|
|
||||||
resp, _, err := client.KeyApi.AddKey(ctx).AddKeyRequest(kr).Execute()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v\n", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func grgGetKey(accessKey string) (*garage.KeyInfo, error) {
|
|
||||||
client, ctx := gadmin()
|
|
||||||
|
|
||||||
resp, _, err := client.KeyApi.GetKey(ctx, accessKey).Execute()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v\n", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func grgCreateWebsite(gkey, bucket string) (*garage.BucketInfo, error) {
|
|
||||||
client, ctx := gadmin()
|
|
||||||
|
|
||||||
br := garage.NewCreateBucketRequest()
|
|
||||||
br.SetGlobalAlias(bucket)
|
|
||||||
|
|
||||||
// Create Bucket
|
|
||||||
binfo, _, err := client.BucketApi.CreateBucket(ctx).CreateBucketRequest(*br).Execute()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v\n", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow user's key
|
|
||||||
ar := garage.AllowBucketKeyRequest{
|
|
||||||
BucketId: *binfo.Id,
|
|
||||||
AccessKeyId: gkey,
|
|
||||||
Permissions: *garage.NewAllowBucketKeyRequestPermissions(true, true, true),
|
|
||||||
}
|
|
||||||
binfo, _, err = client.BucketApi.AllowBucketKey(ctx).AllowBucketKeyRequest(ar).Execute()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v\n", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expose website and set quota
|
|
||||||
wr := garage.NewUpdateBucketRequestWebsiteAccess()
|
|
||||||
wr.SetEnabled(true)
|
|
||||||
wr.SetIndexDocument("index.html")
|
|
||||||
wr.SetErrorDocument("error.html")
|
|
||||||
|
|
||||||
qr := garage.NewUpdateBucketRequestQuotas()
|
|
||||||
qr.SetMaxSize(1024 * 1024 * 50) // 50MB
|
|
||||||
qr.SetMaxObjects(10000) //10k objects
|
|
||||||
|
|
||||||
ur := garage.NewUpdateBucketRequest()
|
|
||||||
ur.SetWebsiteAccess(*wr)
|
|
||||||
ur.SetQuotas(*qr)
|
|
||||||
|
|
||||||
binfo, _, err = client.BucketApi.UpdateBucket(ctx, *binfo.Id).UpdateBucketRequest(*ur).Execute()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v\n", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return updated binfo
|
|
||||||
return binfo, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func grgGetBucket(bid string) (*garage.BucketInfo, error) {
|
|
||||||
client, ctx := gadmin()
|
|
||||||
|
|
||||||
resp, _, err := client.BucketApi.GetBucketInfo(ctx, bid).Execute()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v\n", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return resp, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkLoginAndS3(w http.ResponseWriter, r *http.Request) (*LoginStatus, *garage.KeyInfo, error) {
|
|
||||||
login := checkLogin(w, r)
|
|
||||||
if login == nil {
|
|
||||||
return nil, nil, errors.New("LDAP login failed")
|
|
||||||
}
|
|
||||||
|
|
||||||
keyID := login.UserEntry.GetAttributeValue("garage_s3_access_key")
|
|
||||||
if keyID == "" {
|
|
||||||
keyPair, err := grgCreateKey(login.Info.Username)
|
|
||||||
if err != nil {
|
|
||||||
return login, nil, err
|
|
||||||
}
|
|
||||||
modify_request := ldap.NewModifyRequest(login.Info.DN, nil)
|
|
||||||
modify_request.Replace("garage_s3_access_key", []string{*keyPair.AccessKeyId})
|
|
||||||
// @FIXME compatibility feature for bagage (SFTP+webdav)
|
|
||||||
// you can remove it once bagage will be updated to fetch the key from garage directly
|
|
||||||
// or when bottin will be able to dynamically fetch it.
|
|
||||||
modify_request.Replace("garage_s3_secret_key", []string{*keyPair.SecretAccessKey})
|
|
||||||
err = login.conn.Modify(modify_request)
|
|
||||||
return login, keyPair, err
|
|
||||||
}
|
|
||||||
// Note: we could simply return the login info, but LX asked we do not
|
|
||||||
// store the secrets in LDAP in the future.
|
|
||||||
keyPair, err := grgGetKey(keyID)
|
|
||||||
return login, keyPair, err
|
|
||||||
}
|
|
||||||
|
|
||||||
type keyView struct {
|
|
||||||
Status *LoginStatus
|
|
||||||
Key *garage.KeyInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleGarageKey(w http.ResponseWriter, r *http.Request) {
|
|
||||||
login, s3key, err := checkLoginAndS3(w, r)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
view := keyView{Status: login, Key: s3key}
|
|
||||||
|
|
||||||
tKey := getTemplate("garage/key.html")
|
|
||||||
tKey.Execute(w, &view)
|
|
||||||
}
|
|
||||||
|
|
||||||
type webListView struct {
|
|
||||||
Status *LoginStatus
|
|
||||||
Key *garage.KeyInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleGarageWebsiteList(w http.ResponseWriter, r *http.Request) {
|
|
||||||
login, s3key, err := checkLoginAndS3(w, r)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
view := webListView{Status: login, Key: s3key}
|
|
||||||
|
|
||||||
tWebsiteList := getTemplate("garage/website/list.html")
|
|
||||||
tWebsiteList.Execute(w, &view)
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleGarageWebsiteNew(w http.ResponseWriter, r *http.Request) {
|
|
||||||
_, s3key, err := checkLoginAndS3(w, r)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tWebsiteNew := getTemplate("garage/website/new.html")
|
|
||||||
if r.Method == "POST" {
|
|
||||||
r.ParseForm()
|
|
||||||
log.Println(r.Form)
|
|
||||||
|
|
||||||
bucket := strings.Join(r.Form["bucket"], "")
|
|
||||||
if bucket == "" {
|
|
||||||
bucket = strings.Join(r.Form["bucket2"], "")
|
|
||||||
}
|
|
||||||
if bucket == "" {
|
|
||||||
log.Println("Form empty")
|
|
||||||
// @FIXME we need to return the error to the user
|
|
||||||
tWebsiteNew.Execute(w, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
binfo, err := grgCreateWebsite(*s3key.AccessKeyId, bucket)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
// @FIXME we need to return the error to the user
|
|
||||||
tWebsiteNew.Execute(w, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
http.Redirect(w, r, "/garage/website/b/"+*binfo.Id, http.StatusFound)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
login, s3key, err := checkLoginAndS3(w, r)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
bucketId := mux.Vars(r)["bucket"]
|
|
||||||
binfo, err := grgGetBucket(bucketId)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
wc := binfo.GetWebsiteConfig()
|
|
||||||
q := binfo.GetQuotas()
|
|
||||||
|
|
||||||
view := webInspectView{
|
|
||||||
Status: login,
|
|
||||||
Key: s3key,
|
|
||||||
Bucket: binfo,
|
|
||||||
IndexDoc: (&wc).GetIndexDocument(),
|
|
||||||
ErrorDoc: (&wc).GetErrorDocument(),
|
|
||||||
MaxObjects: (&q).GetMaxObjects(),
|
|
||||||
MaxSize: (&q).GetMaxSize(),
|
|
||||||
}
|
|
||||||
|
|
||||||
tWebsiteInspect := getTemplate("garage/website/inspect.html")
|
|
||||||
tWebsiteInspect.Execute(w, &view)
|
|
||||||
}
|
|
61
go.mod
61
go.mod
|
@ -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
502
go.sum
|
@ -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
15
main.go
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
185
model-passwd.go
185
model-passwd.go
|
@ -1,185 +0,0 @@
|
||||||
/*
|
|
||||||
gpas is GVoisin password reset
|
|
||||||
*/
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"html/template"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
// "github.com/emersion/go-sasl"
|
|
||||||
// "github.com/emersion/go-smtp"
|
|
||||||
"net/smtp"
|
|
||||||
|
|
||||||
"github.com/go-ldap/ldap/v3"
|
|
||||||
// "strings"
|
|
||||||
b64 "encoding/base64"
|
|
||||||
)
|
|
||||||
|
|
||||||
// type InvitationAccount struct {
|
|
||||||
// UID string
|
|
||||||
// Password string
|
|
||||||
// BaseDN string
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 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 {
|
|
||||||
if user.CN == "" && user.Mail == "" && user.OtherMailbox == "" {
|
|
||||||
return errors.New("Il n'y a pas de quoi identifier l'utilisateur")
|
|
||||||
}
|
|
||||||
searchFilter := "(|"
|
|
||||||
if user.CN != "" {
|
|
||||||
searchFilter += "(cn=" + user.UID + ")"
|
|
||||||
}
|
|
||||||
if user.Mail != "" {
|
|
||||||
searchFilter += "(mail=" + user.Mail + ")"
|
|
||||||
}
|
|
||||||
if user.OtherMailbox != "" {
|
|
||||||
searchFilter += "(carLicense=" + user.OtherMailbox + ")"
|
|
||||||
}
|
|
||||||
searchFilter += ")"
|
|
||||||
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)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("passwordLost search : %v %v", err, ldapConn)
|
|
||||||
log.Printf("passwordLost search : %v", searchReq)
|
|
||||||
log.Printf("passwordLost search : %v", searchRes)
|
|
||||||
log.Printf("passwordLost search: %v", user)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if len(searchRes.Entries) == 0 {
|
|
||||||
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")
|
|
||||||
}
|
|
||||||
// log.Printf("passwordLost 58 : %v", user)
|
|
||||||
// log.Printf("passwordLost 59 : %v", searchRes.Entries[0])
|
|
||||||
// log.Printf("passwordLost 60 : %v", searchRes.Entries[0].GetAttributeValue("cn"))
|
|
||||||
// log.Printf("passwordLost 61 : %v", searchRes.Entries[0].GetAttributeValue("uid"))
|
|
||||||
// log.Printf("passwordLost 62 : %v", searchRes.Entries[0].GetAttributeValue("mail"))
|
|
||||||
// log.Printf("passwordLost 63 : %v", searchRes.Entries[0].GetAttributeValue("carLicense"))
|
|
||||||
// Préparation du courriel à envoyer
|
|
||||||
|
|
||||||
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.UID = searchRes.Entries[0].GetAttributeValue("cn")
|
|
||||||
user.CN = searchRes.Entries[0].GetAttributeValue("cn")
|
|
||||||
user.Mail = searchRes.Entries[0].GetAttributeValue("mail")
|
|
||||||
user.OtherMailbox = searchRes.Entries[0].GetAttributeValue("carLicense")
|
|
||||||
code := b64.URLEncoding.EncodeToString([]byte(user.UID + ";" + user.Password))
|
|
||||||
/* Check for outstanding invitation */
|
|
||||||
searchReq = ldap.NewSearchRequest(config.InvitationBaseDN, ldap.ScopeSingleLevel,
|
|
||||||
ldap.NeverDerefAliases, 0, 0, false, "(uid="+user.UID+")", []string{"seeAlso"}, nil)
|
|
||||||
searchRes, err = ldapConn.Search(searchReq)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf(fmt.Sprintf("passwordLost (Check existing invitation) : %v", err))
|
|
||||||
log.Printf(fmt.Sprintf("passwordLost (Check existing invitation) : %v", user))
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// if len(searchRes.Entries) == 0 {
|
|
||||||
/* Add the invitation */
|
|
||||||
addReq := ldap.NewAddRequest(
|
|
||||||
"uid="+user.UID+","+config.InvitationBaseDN,
|
|
||||||
nil)
|
|
||||||
addReq.Attribute("objectClass", []string{"top", "account", "simpleSecurityObject"})
|
|
||||||
addReq.Attribute("uid", []string{user.UID})
|
|
||||||
addReq.Attribute("userPassword", []string{user.Password})
|
|
||||||
addReq.Attribute("seeAlso", []string{config.UserNameAttr + "=" + user.UID + "," + config.UserBaseDN})
|
|
||||||
// Password invitation may already exist
|
|
||||||
|
|
||||||
//
|
|
||||||
err = ldapConn.Add(addReq)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("passwordLost 83 : %v", err)
|
|
||||||
log.Printf("passwordLost 84 : %v", user)
|
|
||||||
|
|
||||||
log.Printf("passwordLost 84 : %v", addReq)
|
|
||||||
// // log.Printf("passwordLost 85 : %v", searchRes.Entries[0]))
|
|
||||||
// // For some reason I get here even if the entry exists already
|
|
||||||
// return err
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
ldapNewConn, err := openNewUserLdap(config)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("passwordLost openNewUserLdap : %v", err)
|
|
||||||
}
|
|
||||||
err = passwd(user, config, ldapNewConn)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("passwordLost passwd : %v", err)
|
|
||||||
log.Printf("passwordLost passwd : %v", user)
|
|
||||||
log.Printf("passwordLost passwd : %v", searchRes.Entries[0])
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
templateMail := template.Must(template.ParseFiles(templatePath + "/passwd/lost_password_email.txt"))
|
|
||||||
buf := bytes.NewBuffer([]byte{})
|
|
||||||
templateMail.Execute(buf, &CodeMailFields{
|
|
||||||
To: user.OtherMailbox,
|
|
||||||
From: config.MailFrom,
|
|
||||||
InviteFrom: user.UID,
|
|
||||||
Code: code,
|
|
||||||
WebBaseAddress: config.WebAddress,
|
|
||||||
})
|
|
||||||
// message := []byte("Hi " + user.OtherMailbox)
|
|
||||||
log.Printf("Sending mail to: %s", user.OtherMailbox)
|
|
||||||
// var auth sasl.Client = nil
|
|
||||||
// if config.SMTPUsername != "" {
|
|
||||||
// auth = sasl.NewPlainClient("", config.SMTPUsername, config.SMTPPassword)
|
|
||||||
// }
|
|
||||||
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{user.OtherMailbox}, message)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("email send error %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
log.Printf("Mail sent.")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func passwordFound(user User, config *ConfigFile, ldapConn *ldap.Conn) (string, error) {
|
|
||||||
l, err := openLdap(config)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("passwordFound openLdap %v", err)
|
|
||||||
// log.Printf("passwordFound openLdap Config : %v", config)
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if user.DN == "" && user.UID != "" {
|
|
||||||
user.DN = "uid=" + user.UID + "," + config.InvitationBaseDN
|
|
||||||
}
|
|
||||||
err = l.Bind(user.DN, user.Password)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("passwordFound l.Bind %v", err)
|
|
||||||
log.Printf("passwordFound l.Bind %v", user.DN)
|
|
||||||
log.Printf("passwordFound l.Bind %v", user.UID)
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
searchReq := ldap.NewSearchRequest(user.DN, ldap.ScopeBaseObject,
|
|
||||||
ldap.NeverDerefAliases, 0, 0, false, "(uid="+user.UID+")", []string{"seeAlso"}, nil)
|
|
||||||
var searchRes *ldap.SearchResult
|
|
||||||
searchRes, err = ldapConn.Search(searchReq)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("passwordFound %v", err)
|
|
||||||
log.Printf("passwordFound %v", searchReq)
|
|
||||||
log.Printf("passwordFound %v", ldapConn)
|
|
||||||
log.Printf("passwordFound %v", searchRes)
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if len(searchRes.Entries) == 0 {
|
|
||||||
log.Printf("passwordFound %v", err)
|
|
||||||
log.Printf("passwordFound %v", searchReq)
|
|
||||||
log.Printf("passwordFound %v", ldapConn)
|
|
||||||
log.Printf("passwordFound %v", searchRes)
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
delReq := ldap.NewDelRequest("uid="+user.CN+","+config.InvitationBaseDN, nil)
|
|
||||||
ldapConn.Del(delReq)
|
|
||||||
return searchRes.Entries[0].GetAttributeValue("seeAlso"), err
|
|
||||||
}
|
|
187
model-user.go
187
model-user.go
|
@ -1,187 +0,0 @@
|
||||||
/*
|
|
||||||
Model-User handles everything having to do with the user.
|
|
||||||
*/
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/go-ldap/ldap/v3"
|
|
||||||
)
|
|
||||||
|
|
||||||
func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
|
|
||||||
searchReq := ldap.NewSearchRequest(
|
|
||||||
user.DN,
|
|
||||||
ldap.ScopeBaseObject,
|
|
||||||
ldap.NeverDerefAliases,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
"(objectClass=*)",
|
|
||||||
[]string{
|
|
||||||
"cn",
|
|
||||||
"givenName",
|
|
||||||
"displayName",
|
|
||||||
"uid",
|
|
||||||
"sn",
|
|
||||||
"mail",
|
|
||||||
"description",
|
|
||||||
"carLicense",
|
|
||||||
},
|
|
||||||
nil)
|
|
||||||
searchRes, err := ldapConn.Search(searchReq)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("get User : %v", err)
|
|
||||||
log.Printf("get User : %v", searchReq)
|
|
||||||
log.Printf("get User : %v", searchRes)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
userEntry := searchRes.Entries[0]
|
|
||||||
resUser := User{
|
|
||||||
DN: user.DN,
|
|
||||||
GivenName: searchRes.Entries[0].GetAttributeValue("givenName"),
|
|
||||||
DisplayName: searchRes.Entries[0].GetAttributeValue("displayName"),
|
|
||||||
Description: searchRes.Entries[0].GetAttributeValue("description"),
|
|
||||||
SN: searchRes.Entries[0].GetAttributeValue("sn"),
|
|
||||||
UID: searchRes.Entries[0].GetAttributeValue("uid"),
|
|
||||||
CN: searchRes.Entries[0].GetAttributeValue("cn"),
|
|
||||||
Mail: searchRes.Entries[0].GetAttributeValue("mail"),
|
|
||||||
OtherMailbox: searchRes.Entries[0].GetAttributeValue("carLicense"),
|
|
||||||
CanAdmin: strings.EqualFold(user.DN, config.AdminAccount),
|
|
||||||
CanInvite: true,
|
|
||||||
UserEntry: userEntry,
|
|
||||||
}
|
|
||||||
searchReq.BaseDN = config.GroupCanAdmin
|
|
||||||
searchReq.Filter = "(member=" + user.DN + ")"
|
|
||||||
searchRes, err = ldapConn.Search(searchReq)
|
|
||||||
if err == nil {
|
|
||||||
if len(searchRes.Entries) > 0 {
|
|
||||||
resUser.CanAdmin = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return &resUser, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds a new user
|
|
||||||
func add(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
|
||||||
log.Printf(fmt.Sprint("Adding New User"))
|
|
||||||
// LDAP Add Object
|
|
||||||
dn := user.DN
|
|
||||||
req := ldap.NewAddRequest(dn, nil)
|
|
||||||
req.Attribute("objectClass", []string{"top", "person", "organizationalPerson", "inetOrgPerson"})
|
|
||||||
if user.DisplayName != "" {
|
|
||||||
req.Attribute("displayName", []string{user.DisplayName})
|
|
||||||
}
|
|
||||||
if user.GivenName != "" {
|
|
||||||
req.Attribute("givenName", []string{user.GivenName})
|
|
||||||
}
|
|
||||||
if user.Mail != "" {
|
|
||||||
req.Attribute("mail", []string{user.Mail})
|
|
||||||
}
|
|
||||||
if user.UID != "" {
|
|
||||||
req.Attribute("uid", []string{user.UID})
|
|
||||||
}
|
|
||||||
// if user.Member != "" {
|
|
||||||
// req.Attribute("member", []string{user.Member})
|
|
||||||
// }
|
|
||||||
if user.SN != "" {
|
|
||||||
req.Attribute("sn", []string{user.SN})
|
|
||||||
}
|
|
||||||
if user.OtherMailbox != "" {
|
|
||||||
req.Attribute("carLicense", []string{user.OtherMailbox})
|
|
||||||
}
|
|
||||||
if user.Description != "" {
|
|
||||||
req.Attribute("description", []string{user.Description})
|
|
||||||
}
|
|
||||||
// Add the User
|
|
||||||
// err := ldapConn.Add(req)
|
|
||||||
// var ldapNewConn *ldap.Conn
|
|
||||||
ldapNewConn, err := openNewUserLdap(config)
|
|
||||||
err = ldapNewConn.Add(req)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf(fmt.Sprintf("add(User) ldapconn.Add: %v", err))
|
|
||||||
log.Printf(fmt.Sprintf("add(User) ldapconn.Add: %v", req))
|
|
||||||
log.Printf(fmt.Sprintf("add(User) ldapconn.Add: %v", user))
|
|
||||||
//return err
|
|
||||||
}
|
|
||||||
// passwordModifyRequest := ldap.NewPasswordModifyRequest(user.DN, "", user.Password)
|
|
||||||
// _, err = ldapConn.PasswordModify(passwordModifyRequest)
|
|
||||||
// if err != nil {
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Send the email
|
|
||||||
|
|
||||||
newUserLdapConn, _ := openNewUserLdap(config)
|
|
||||||
user.OtherMailbox = ""
|
|
||||||
err = passwordLost(user, config, newUserLdapConn)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("add User PasswordLost %v", err)
|
|
||||||
log.Printf("add User PasswordLost %v", newUserLdapConn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// sendMailTplData := SendMailTplData{
|
|
||||||
// From: "alice@resdigita.org",
|
|
||||||
// To: user.OtherMailbox,
|
|
||||||
// RelTemplatePath: "user/new.email.txt",
|
|
||||||
// EmailContentVars: EmailContentVarsTplData{
|
|
||||||
// InviteFrom: "alice@resdigita.org",
|
|
||||||
// SendAddress: "https://www.gvoisins.org",
|
|
||||||
// Code: "...",
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// err = sendMail(sendMailTplData)
|
|
||||||
// if err != nil {
|
|
||||||
// log.Printf("add(user) sendMail: %v", err)
|
|
||||||
// log.Printf("add(user) sendMail: %v", user)
|
|
||||||
// log.Printf("add(user) sendMail: %v", sendMailTplData)
|
|
||||||
// }
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func modify(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
|
||||||
modify_request := ldap.NewModifyRequest(user.DN, nil)
|
|
||||||
previousUser, err := get(user, config, ldapConn)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
replaceIfContent(modify_request, "displayName", user.DisplayName, previousUser.DisplayName)
|
|
||||||
replaceIfContent(modify_request, "givenName", user.GivenName, previousUser.GivenName)
|
|
||||||
replaceIfContent(modify_request, "sn", user.SN, previousUser.SN)
|
|
||||||
replaceIfContent(modify_request, "carLicense", user.OtherMailbox, user.OtherMailbox)
|
|
||||||
replaceIfContent(modify_request, "description", user.Description, previousUser.Description)
|
|
||||||
err = ldapConn.Modify(modify_request)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf(fmt.Sprintf("71: %v", err))
|
|
||||||
log.Printf(fmt.Sprintf("72: %v", modify_request))
|
|
||||||
log.Printf(fmt.Sprintf("73: %v", user))
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func passwd(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
|
||||||
passwordModifyRequest := ldap.NewPasswordModifyRequest(user.DN, "", user.Password)
|
|
||||||
_, err := ldapConn.PasswordModify(passwordModifyRequest)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf(fmt.Sprintf("model-user passwd : %v %v", err, ldapConn))
|
|
||||||
log.Printf(fmt.Sprintf("model-user passwd : %v", user))
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func bind(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
|
||||||
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
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// }
|
|
31
model.go
31
model.go
|
@ -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
|
|
41
notgo.mod
Normal file
41
notgo.mod
Normal 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
|
||||||
|
)
|
184
picture.go
184
picture.go
|
@ -1,184 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"image"
|
|
||||||
"image/jpeg"
|
|
||||||
_ "image/png"
|
|
||||||
|
|
||||||
"mime/multipart"
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"github.com/minio/minio-go/v7"
|
|
||||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
|
||||||
"github.com/nfnt/resize"
|
|
||||||
)
|
|
||||||
|
|
||||||
func newMinioClient() (*minio.Client, error) {
|
|
||||||
endpoint := config.S3Endpoint
|
|
||||||
accessKeyID := config.S3AccessKey
|
|
||||||
secretKeyID := config.S3SecretKey
|
|
||||||
useSSL := true
|
|
||||||
|
|
||||||
//Initialize Minio
|
|
||||||
minioCLient, err := minio.New(endpoint, &minio.Options{
|
|
||||||
Creds: credentials.NewStaticV4(accessKeyID, secretKeyID, ""),
|
|
||||||
Secure: useSSL,
|
|
||||||
Region: config.S3Region,
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return minioCLient, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Upload image through guichet server.
|
|
||||||
func uploadProfilePicture(w http.ResponseWriter, r *http.Request, login *LoginStatus) (string, error) {
|
|
||||||
file, _, err := r.FormFile("image")
|
|
||||||
|
|
||||||
if err == http.ErrMissingFile {
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
err = checkImage(file)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
buffFull := bytes.NewBuffer([]byte{})
|
|
||||||
buffThumb := bytes.NewBuffer([]byte{})
|
|
||||||
err = resizePicture(file, buffFull, buffThumb)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
mc, err := newMinioClient()
|
|
||||||
if err != nil || mc == nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a previous profile picture existed, delete it
|
|
||||||
// (don't care about errors)
|
|
||||||
if nameConsul := login.UserEntry.GetAttributeValue(FIELD_NAME_PROFILE_PICTURE); nameConsul != "" {
|
|
||||||
mc.RemoveObject(context.Background(), config.S3Bucket, nameConsul, minio.RemoveObjectOptions{})
|
|
||||||
mc.RemoveObject(context.Background(), config.S3Bucket, nameConsul+"-thumb", minio.RemoveObjectOptions{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate new random name for picture
|
|
||||||
nameFull := uuid.New().String()
|
|
||||||
nameThumb := nameFull + "-thumb"
|
|
||||||
|
|
||||||
_, err = mc.PutObject(context.Background(), config.S3Bucket, nameThumb, buffThumb, int64(buffThumb.Len()), minio.PutObjectOptions{
|
|
||||||
ContentType: "image/jpeg",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = mc.PutObject(context.Background(), config.S3Bucket, nameFull, buffFull, int64(buffFull.Len()), minio.PutObjectOptions{
|
|
||||||
ContentType: "image/jpeg",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nameFull, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkImage(file multipart.File) error {
|
|
||||||
buff := make([]byte, 512) //Detect read only the first 512 bytes
|
|
||||||
_, err := file.Read(buff)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
file.Seek(0, 0)
|
|
||||||
|
|
||||||
fileType := http.DetectContentType(buff)
|
|
||||||
fileType = strings.Split(fileType, "/")[0]
|
|
||||||
if fileType != "image" {
|
|
||||||
return errors.New("bad type")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func resizePicture(file multipart.File, buffFull, buffThumb *bytes.Buffer) error {
|
|
||||||
file.Seek(0, 0)
|
|
||||||
picture, _, err := image.Decode(file)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
thumbnail := resize.Thumbnail(90, 90, picture, resize.Lanczos3)
|
|
||||||
picture = resize.Thumbnail(480, 480, picture, resize.Lanczos3)
|
|
||||||
|
|
||||||
err = jpeg.Encode(buffFull, picture, &jpeg.Options{
|
|
||||||
Quality: 95,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = jpeg.Encode(buffThumb, thumbnail, &jpeg.Options{
|
|
||||||
Quality: 100,
|
|
||||||
})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleDownloadPicture(w http.ResponseWriter, r *http.Request) {
|
|
||||||
name := mux.Vars(r)["name"]
|
|
||||||
|
|
||||||
//Check login
|
|
||||||
login := checkLogin(w, r)
|
|
||||||
if login == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get the object after connect MC
|
|
||||||
mc, err := newMinioClient()
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, "MinioClient: "+err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
obj, err := mc.GetObject(context.Background(), "bottin-pictures", name, minio.GetObjectOptions{})
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, "MinioClient: GetObject: "+err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer obj.Close()
|
|
||||||
|
|
||||||
objStat, err := obj.Stat()
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, "MiniObjet: "+err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//Send JSON through xhttp
|
|
||||||
w.Header().Set("Content-Type", objStat.ContentType)
|
|
||||||
w.Header().Set("Content-Length", strconv.Itoa(int(objStat.Size)))
|
|
||||||
//Copy obj in w
|
|
||||||
writting, err := io.Copy(w, obj)
|
|
||||||
|
|
||||||
if writting != objStat.Size || err != nil {
|
|
||||||
http.Error(w, fmt.Sprintf("WriteBody: %s, bytes wrote %d on %d", err.Error(), writting, objStat.Size), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
176
session.go
176
session.go
|
@ -1,176 +0,0 @@
|
||||||
/*
|
|
||||||
Handles session login and lougout with HTTP stuff
|
|
||||||
*/
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
|
|
||||||
var login_info *LoginInfo
|
|
||||||
l, err := ldapOpen(w)
|
|
||||||
if l == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
session, err := store.Get(r, SESSION_NAME)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("checkLogin ldapOpen : %v", err)
|
|
||||||
log.Printf("checkLogin ldapOpen : %v", session)
|
|
||||||
log.Printf("checkLogin ldapOpen : %v", session.Values)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
username, ok := session.Values["login_username"]
|
|
||||||
password, ok2 := session.Values["login_password"]
|
|
||||||
user_dn, ok3 := session.Values["login_dn"]
|
|
||||||
|
|
||||||
if ok && ok2 && ok3 {
|
|
||||||
login_info = &LoginInfo{
|
|
||||||
DN: user_dn.(string),
|
|
||||||
Username: username.(string),
|
|
||||||
Password: password.(string),
|
|
||||||
}
|
|
||||||
err = bind(User{
|
|
||||||
DN: login_info.DN,
|
|
||||||
Password: login_info.Password,
|
|
||||||
}, config, l)
|
|
||||||
if err != nil {
|
|
||||||
delete(session.Values, "login_username")
|
|
||||||
delete(session.Values, "login_password")
|
|
||||||
delete(session.Values, "login_dn")
|
|
||||||
|
|
||||||
err = session.Save(r, w)
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return checkLogin(w, r)
|
|
||||||
}
|
|
||||||
ldapUser, err := get(User{
|
|
||||||
DN: login_info.DN,
|
|
||||||
CN: login_info.Username,
|
|
||||||
}, config, l)
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
userEntry := ldapUser.UserEntry
|
|
||||||
loginStatus := LoginStatus{
|
|
||||||
Info: login_info,
|
|
||||||
conn: l,
|
|
||||||
UserEntry: userEntry,
|
|
||||||
Common: NestedCommonTplData{
|
|
||||||
CanAdmin: ldapUser.CanAdmin,
|
|
||||||
CanInvite: ldapUser.CanInvite,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return &loginStatus
|
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
requestKind := "(objectClass=organizationalPerson)"
|
|
||||||
if strings.EqualFold(login_info.DN, config.AdminAccount) {
|
|
||||||
requestKind = "(objectclass=*)"
|
|
||||||
}
|
|
||||||
searchRequest := ldap.NewSearchRequest(
|
|
||||||
login_info.DN,
|
|
||||||
ldap.ScopeBaseObject, ldap.NeverDerefAliases, 0, 0, false,
|
|
||||||
requestKind,
|
|
||||||
[]string{
|
|
||||||
"dn",
|
|
||||||
"displayname",
|
|
||||||
"givenname",
|
|
||||||
"sn",
|
|
||||||
"mail",
|
|
||||||
"cn",
|
|
||||||
"memberof",
|
|
||||||
"description",
|
|
||||||
"garage_s3_access_key",
|
|
||||||
},
|
|
||||||
nil)
|
|
||||||
// FIELD_NAME_DIRECTORY_VISIBILITY,
|
|
||||||
// FIELD_NAME_PROFILE_PICTURE,
|
|
||||||
|
|
||||||
sr, err := l.Search(searchRequest)
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(sr.Entries) != 1 {
|
|
||||||
http.Error(w, fmt.Sprintf("Unable to find entry for %s", login_info.DN), http.StatusInternalServerError)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
loginStatus.UserEntry = sr.Entries[0]
|
|
||||||
|
|
||||||
loginStatus.CanAdmin = strings.EqualFold(loginStatus.Info.DN, config.AdminAccount)
|
|
||||||
loginStatus.CanInvite = false
|
|
||||||
|
|
||||||
groups := []EntryName{}
|
|
||||||
searchRequest = ldap.NewSearchRequest(
|
|
||||||
config.GroupBaseDN,
|
|
||||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
|
||||||
fmt.Sprintf("(&(objectClass=groupOfNames)(member=%s))", login_info.DN),
|
|
||||||
[]string{"dn", "displayName", "cn", "description"},
|
|
||||||
nil)
|
|
||||||
// // log.Printf(fmt.Sprintf("708: %v",searchRequest))
|
|
||||||
sr, err = l.Search(searchRequest)
|
|
||||||
// if err != nil {
|
|
||||||
// http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
//// log.Printf(fmt.Sprintf("303: %v",sr.Entries))
|
|
||||||
for _, ent := range sr.Entries {
|
|
||||||
// log.Printf(fmt.Sprintf("305: %v",ent.DN))
|
|
||||||
groups = append(groups, EntryName{
|
|
||||||
DN: ent.DN,
|
|
||||||
Name: ent.GetAttributeValue("cn"),
|
|
||||||
})
|
|
||||||
// log.Printf(fmt.Sprintf("310: %v",config.GroupCanInvite))
|
|
||||||
if config.GroupCanInvite != "" && strings.EqualFold(ent.DN, config.GroupCanInvite) {
|
|
||||||
loginStatus.CanInvite = true
|
|
||||||
}
|
|
||||||
// log.Printf(fmt.Sprintf("314: %v",config.GroupCanAdmin))
|
|
||||||
if config.GroupCanAdmin != "" && strings.EqualFold(ent.DN, config.GroupCanAdmin) {
|
|
||||||
loginStatus.CanAdmin = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// for _, attr := range loginStatus.UserEntry.Attributes {
|
|
||||||
// if strings.EqualFold(attr.Name, "memberof") {
|
|
||||||
// for _, group := range attr.Values {
|
|
||||||
// if config.GroupCanInvite != "" && strings.EqualFold(group, config.GroupCanInvite) {
|
|
||||||
// loginStatus.CanInvite = true
|
|
||||||
// }
|
|
||||||
// if config.GroupCanAdmin != "" && strings.EqualFold(group, config.GroupCanAdmin) {
|
|
||||||
// loginStatus.CanAdmin = true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return loginStatus
|
|
||||||
*/
|
|
||||||
|
|
||||||
func logout(w http.ResponseWriter, r *http.Request) error {
|
|
||||||
session, err := store.Get(r, SESSION_NAME)
|
|
||||||
if err != nil {
|
|
||||||
session, _ = store.New(r, SESSION_NAME)
|
|
||||||
// return err
|
|
||||||
} else {
|
|
||||||
delete(session.Values, "login_username")
|
|
||||||
delete(session.Values, "login_password")
|
|
||||||
delete(session.Values, "login_dn")
|
|
||||||
|
|
||||||
err = session.Save(r, w)
|
|
||||||
}
|
|
||||||
|
|
||||||
// return err
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
}
|
|
73
utils.go
73
utils.go
|
@ -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
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jsimonetti/pwscheme/ssha512"
|
"github.com/jsimonetti/pwscheme/ssha512"
|
1025
view-admin.go
1025
view-admin.go
File diff suppressed because it is too large
Load diff
41
view-home.go
41
view-home.go
|
@ -1,41 +0,0 @@
|
||||||
/*
|
|
||||||
home show the home page
|
|
||||||
*/
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import "net/http"
|
|
||||||
|
|
||||||
func handleHome(w http.ResponseWriter, r *http.Request) {
|
|
||||||
templateHome := getTemplate("home.html")
|
|
||||||
|
|
||||||
login := checkLogin(w, r)
|
|
||||||
if login == nil {
|
|
||||||
status := handleLogin(w, r)
|
|
||||||
if status == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
login = checkLogin(w, r)
|
|
||||||
}
|
|
||||||
|
|
||||||
can_admin := false
|
|
||||||
if login != nil {
|
|
||||||
can_admin = login.Common.CanAdmin
|
|
||||||
}
|
|
||||||
|
|
||||||
data := HomePageData{
|
|
||||||
Login: NestedLoginTplData{
|
|
||||||
Login: login,
|
|
||||||
},
|
|
||||||
BaseDN: config.BaseDN,
|
|
||||||
Org: config.Org,
|
|
||||||
Common: NestedCommonTplData{
|
|
||||||
CanAdmin: can_admin,
|
|
||||||
CanInvite: true,
|
|
||||||
LoggedIn: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
execTemplate(w, templateHome, data.Common, data.Login, *config, data)
|
|
||||||
// templateHome.Execute(w, data)
|
|
||||||
|
|
||||||
}
|
|
445
view-invite.go
445
view-invite.go
|
@ -1,445 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"crypto/rand"
|
|
||||||
"encoding/binary"
|
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
|
||||||
"html/template"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
// "github.com/emersion/go-sasl"
|
|
||||||
// "github.com/emersion/go-smtp"
|
|
||||||
"github.com/go-ldap/ldap/v3"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"golang.org/x/crypto/argon2"
|
|
||||||
)
|
|
||||||
|
|
||||||
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 checkInviterLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
|
|
||||||
|
|
||||||
login := checkLogin(w, r)
|
|
||||||
if login == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// if !login.CanInvite {
|
|
||||||
// http.Error(w, "Not authorized to invite new users.", http.StatusUnauthorized)
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
|
|
||||||
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) {
|
|
||||||
l, err := ldapOpen(w)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("view-invite.go - handleInviteNewAccount - ldapOpen : %v", err)
|
|
||||||
log.Printf("view-invite.go - handleInviteNewAccount - ldapOpen: %v", l)
|
|
||||||
}
|
|
||||||
if l == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
err = l.Bind(config.NewUserDN, config.NewUserPassword)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("view-invite.go - handleInviteNewAccount - l.Bind : %v", err)
|
|
||||||
log.Printf("view-invite.go - handleInviteNewAccount - l.Bind: %v", config.NewUserDN)
|
|
||||||
panic(fmt.Sprintf("view-invite.go - handleInviteNewAccount - l.Bind : %v", err))
|
|
||||||
}
|
|
||||||
handleNewAccount(w, r, l, config.NewUserDN)
|
|
||||||
}
|
|
||||||
|
|
||||||
// New account creation using code
|
|
||||||
func handleInvitationCode(w http.ResponseWriter, r *http.Request) {
|
|
||||||
code := mux.Vars(r)["code"]
|
|
||||||
code_id, code_pw := readCode(code)
|
|
||||||
login := checkLogin(w, r)
|
|
||||||
inviteDn := config.InvitationNameAttr + "=" + code_id + "," + config.InvitationBaseDN
|
|
||||||
err := login.conn.Bind(inviteDn, code_pw)
|
|
||||||
if err != nil {
|
|
||||||
templateInviteInvalidCode := getTemplate("user/code/invalid.html")
|
|
||||||
templateInviteInvalidCode.Execute(w, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
sReq := ldap.NewSearchRequest(
|
|
||||||
inviteDn,
|
|
||||||
ldap.ScopeBaseObject, ldap.NeverDerefAliases, 0, 0, false,
|
|
||||||
fmt.Sprintf("(objectclass=*)"),
|
|
||||||
[]string{"dn", "creatorsname"},
|
|
||||||
nil)
|
|
||||||
sr, err := login.conn.Search(sReq)
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(sr.Entries) != 1 {
|
|
||||||
http.Error(w, fmt.Sprintf("Expected 1 entry, got %d", len(sr.Entries)), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
invitedBy := sr.Entries[0].GetAttributeValue("creatorsname")
|
|
||||||
if handleNewAccount(w, r, login.conn, invitedBy) {
|
|
||||||
del_req := ldap.NewDelRequest(inviteDn, nil)
|
|
||||||
err = login.conn.Del(del_req)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Could not delete invitation %s: %s", inviteDn, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Common functions for new account
|
|
||||||
func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invitedBy string) bool {
|
|
||||||
templateInviteNewAccount := getTemplate("user/new.html")
|
|
||||||
data := NewAccountData{
|
|
||||||
NewUserDefaultDomain: config.NewUserDefaultDomain,
|
|
||||||
}
|
|
||||||
if r.Method == "POST" {
|
|
||||||
r.ParseForm()
|
|
||||||
newUser := User{}
|
|
||||||
newUser.DisplayName = strings.TrimSpace(strings.Join(r.Form["displayname"], ""))
|
|
||||||
newUser.GivenName = strings.TrimSpace(strings.Join(r.Form["givenname"], ""))
|
|
||||||
newUser.SN = strings.TrimSpace(strings.Join(r.Form["surname"], ""))
|
|
||||||
newUser.OtherMailbox = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
|
|
||||||
newUser.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
|
|
||||||
newUser.UID = strings.TrimSpace(strings.Join(r.Form["username"], ""))
|
|
||||||
newUser.CN = strings.TrimSpace(strings.Join(r.Form["username"], ""))
|
|
||||||
newUser.DN = "cn=" + strings.TrimSpace(strings.Join(r.Form["username"], "")) + "," + config.UserBaseDN
|
|
||||||
password1 := strings.Join(r.Form["password"], "")
|
|
||||||
password2 := strings.Join(r.Form["password2"], "")
|
|
||||||
if password1 != password2 {
|
|
||||||
data.Common.Success = false
|
|
||||||
data.ErrorPasswordMismatch = true
|
|
||||||
} else {
|
|
||||||
newUser.Password = password2
|
|
||||||
l.Bind(config.NewUserDN, config.NewUserPassword)
|
|
||||||
err := add(newUser, config, l)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.Success = false
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
}
|
|
||||||
http.Redirect(w, r, "/user/wait", http.StatusFound)
|
|
||||||
}
|
|
||||||
// tryCreateAccount(l, data, password1, password2, invitedBy)
|
|
||||||
} else {
|
|
||||||
data.SuggestPW = fmt.Sprintf("%s", suggestPassword())
|
|
||||||
}
|
|
||||||
data.Common.CanAdmin = false
|
|
||||||
data.Common.LoggedIn = false
|
|
||||||
|
|
||||||
templateInviteNewAccount.Execute(w, data)
|
|
||||||
return data.Common.Success
|
|
||||||
}
|
|
||||||
|
|
||||||
func tryCreateAccount(l *ldap.Conn, data *NewAccountData, pass1 string, pass2 string, invitedBy string) {
|
|
||||||
checkFailed := false
|
|
||||||
// Check if username is correct
|
|
||||||
if match, err := regexp.MatchString("^[a-z0-9._-]+$", data.Username); !(err == nil && match) {
|
|
||||||
data.ErrorInvalidUsername = true
|
|
||||||
checkFailed = true
|
|
||||||
}
|
|
||||||
// Check if user exists
|
|
||||||
userDn := config.UserNameAttr + "=" + data.Username + "," + config.UserBaseDN
|
|
||||||
searchRq := ldap.NewSearchRequest(
|
|
||||||
userDn,
|
|
||||||
ldap.ScopeBaseObject, ldap.NeverDerefAliases, 0, 0, false,
|
|
||||||
"(objectclass=*)",
|
|
||||||
[]string{"dn"},
|
|
||||||
nil)
|
|
||||||
sr, err := l.Search(searchRq)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
checkFailed = true
|
|
||||||
}
|
|
||||||
if len(sr.Entries) > 0 {
|
|
||||||
data.ErrorUsernameTaken = true
|
|
||||||
checkFailed = true
|
|
||||||
}
|
|
||||||
// Check that password is long enough
|
|
||||||
if len(pass1) < 8 {
|
|
||||||
data.ErrorPasswordTooShort = true
|
|
||||||
checkFailed = true
|
|
||||||
}
|
|
||||||
if pass1 != pass2 {
|
|
||||||
data.ErrorPasswordMismatch = true
|
|
||||||
checkFailed = true
|
|
||||||
}
|
|
||||||
if checkFailed {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Actually create user
|
|
||||||
req := ldap.NewAddRequest(userDn, nil)
|
|
||||||
req.Attribute("objectclass", []string{"inetOrgPerson", "organizationalPerson", "person", "top"})
|
|
||||||
req.Attribute("structuralobjectclass", []string{"inetOrgPerson"})
|
|
||||||
pw, err := SSHAEncode(pass1)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Attribute("userpassword", []string{pw})
|
|
||||||
req.Attribute("invitedby", []string{invitedBy})
|
|
||||||
if len(data.DisplayName) > 0 {
|
|
||||||
req.Attribute("displayname", []string{data.DisplayName})
|
|
||||||
}
|
|
||||||
if len(data.GivenName) > 0 {
|
|
||||||
req.Attribute("givenname", []string{data.GivenName})
|
|
||||||
}
|
|
||||||
if len(data.Surname) > 0 {
|
|
||||||
req.Attribute("sn", []string{data.Surname})
|
|
||||||
}
|
|
||||||
if len(config.InvitedMailFormat) > 0 {
|
|
||||||
email := strings.ReplaceAll(config.InvitedMailFormat, "{}", data.Username)
|
|
||||||
req.Attribute("mail", []string{email})
|
|
||||||
}
|
|
||||||
err = l.Add(req)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for _, group := range config.InvitedAutoGroups {
|
|
||||||
req := ldap.NewModifyRequest(group, nil)
|
|
||||||
req.Add("member", []string{userDn})
|
|
||||||
err = l.Modify(req)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.WarningMessage += fmt.Sprintf("Cannot add to %s: %s\n", group, err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data.Common.Success = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- Code generation ----
|
|
||||||
func handleInviteSendCode(w http.ResponseWriter, r *http.Request) {
|
|
||||||
templateInviteSendCode := getTemplate("user/code/send.html")
|
|
||||||
login := checkInviterLogin(w, r)
|
|
||||||
if login == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if r.Method == "POST" {
|
|
||||||
r.ParseForm()
|
|
||||||
data := &SendCodeData{
|
|
||||||
WebBaseAddress: config.WebAddress,
|
|
||||||
}
|
|
||||||
// modify_request := ldap.NewModifyRequest(login.UserEntry.DN, nil)
|
|
||||||
// // choice := strings.Join(r.Form["choice"], "")
|
|
||||||
// // sendto := strings.Join(r.Form["sendto"], "")
|
|
||||||
code, code_id, code_pw := genCode()
|
|
||||||
log.Printf("272: %v %v %v", code, code_id, code_pw)
|
|
||||||
// // Create invitation object in database
|
|
||||||
// modify_request.Add("carLicense", []string{fmt.Sprintf("%s,%s,%s",code, code_id, code_pw)})
|
|
||||||
// err := login.conn.Modify(modify_request)
|
|
||||||
// if err != nil {
|
|
||||||
// data.Common.ErrorMessage = err.Error()
|
|
||||||
// // return
|
|
||||||
// } else {
|
|
||||||
// data.Common.Success = true
|
|
||||||
// data.CodeDisplay = code
|
|
||||||
// }
|
|
||||||
log.Printf("279: %v %v %v", code, code_id, code_pw)
|
|
||||||
addReq := ldap.NewAddRequest("documentIdentifier="+code_id+","+config.InvitationBaseDN, nil)
|
|
||||||
addReq.Attribute("objectClass", []string{"top", "document", "simpleSecurityObject"})
|
|
||||||
addReq.Attribute("cn", []string{code})
|
|
||||||
addReq.Attribute("userPassword", []string{code_pw})
|
|
||||||
addReq.Attribute("documentIdentifier", []string{code_id})
|
|
||||||
log.Printf("285: %v %v %v", code, code_id, code_pw)
|
|
||||||
log.Printf("286: %v", addReq)
|
|
||||||
err := login.conn.Add(addReq)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
// return
|
|
||||||
} else {
|
|
||||||
data.Common.Success = true
|
|
||||||
data.CodeDisplay = code
|
|
||||||
}
|
|
||||||
data.Common.CanAdmin = login.Common.CanAdmin
|
|
||||||
templateInviteSendCode.Execute(w, data)
|
|
||||||
// if choice == "display" || choice == "send" {
|
|
||||||
// log.Printf("260: %v %v %v %v", login, choice, sendto, data)
|
|
||||||
// trySendCode(login, choice, sendto, data)
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func trySendCode(login *LoginStatus, choice string, sendto string, data *SendCodeData) {
|
|
||||||
log.Printf("269: %v %v %v %v", login, choice, sendto, data)
|
|
||||||
// Generate code
|
|
||||||
code, code_id, code_pw := genCode()
|
|
||||||
log.Printf("272: %v %v %v", code, code_id, code_pw)
|
|
||||||
// Create invitation object in database
|
|
||||||
// len_base_dn := len(strings.Split(config.BaseDN, ","))
|
|
||||||
// dn_split := strings.Split(super_dn, ",")
|
|
||||||
// for i := len_base_dn + 1; i <= len(dn_split); i++ {
|
|
||||||
// path = append(path, PathItem{
|
|
||||||
// DN: strings.Join(dn_split[len(dn_split)-i:len(dn_split)], ","),
|
|
||||||
// Identifier: dn_split[len(dn_split)-i],
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// data := &SendCodeData{
|
|
||||||
// WebBaseAddress: config.WebAddress,
|
|
||||||
// }
|
|
||||||
// // Handle data
|
|
||||||
// data := &CreateData{
|
|
||||||
// SuperDN: super_dn,
|
|
||||||
// Path: path,
|
|
||||||
// }
|
|
||||||
// data.IdType = config.UserNameAttr
|
|
||||||
// data.StructuralObjectClass = "inetOrgPerson"
|
|
||||||
// data.ObjectClass = "inetOrgPerson\norganizationalPerson\nperson\ntop"
|
|
||||||
// data.IdValue = strings.TrimSpace(strings.Join(r.Form["idvalue"], ""))
|
|
||||||
// data.DisplayName = strings.TrimSpace(strings.Join(r.Form["displayname"], ""))
|
|
||||||
// data.GivenName = strings.TrimSpace(strings.Join(r.Form["givenname"], ""))
|
|
||||||
// data.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
|
|
||||||
// data.Member = strings.TrimSpace(strings.Join(r.Form["member"], ""))
|
|
||||||
// data.Description = strings.TrimSpace(strings.Join(r.Form["description"], ""))
|
|
||||||
// data.SN = strings.TrimSpace(strings.Join(r.Form["sn"], ""))
|
|
||||||
// object_class := []string{}
|
|
||||||
// for _, oc := range strings.Split(data.ObjectClass, "\n") {
|
|
||||||
// x := strings.TrimSpace(oc)
|
|
||||||
// if x != "" {
|
|
||||||
// object_class = append(object_class, x)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// dn := data.IdType + "=" + data.IdValue + "," + super_dn
|
|
||||||
// req := ldap.NewAddRequest(dn, nil)
|
|
||||||
// req.Attribute("objectclass", object_class)
|
|
||||||
// // req.Attribute("mail", []string{data.IdValue})
|
|
||||||
// /*
|
|
||||||
// if data.StructuralObjectClass != "" {
|
|
||||||
// req.Attribute("structuralobjectclass", []string{data.StructuralObjectClass})
|
|
||||||
// }
|
|
||||||
// */
|
|
||||||
// if data.DisplayName != "" {
|
|
||||||
// req.Attribute("displayname", []string{data.DisplayName})
|
|
||||||
// }
|
|
||||||
// if data.GivenName != "" {
|
|
||||||
// req.Attribute("givenname", []string{data.GivenName})
|
|
||||||
// }
|
|
||||||
// if data.Mail != "" {
|
|
||||||
// req.Attribute("mail", []string{data.Mail})
|
|
||||||
// }
|
|
||||||
// if data.Member != "" {
|
|
||||||
// req.Attribute("member", []string{data.Member})
|
|
||||||
// }
|
|
||||||
// if data.SN != "" {
|
|
||||||
// req.Attribute("sn", []string{data.SN})
|
|
||||||
// }
|
|
||||||
// if data.Description != "" {
|
|
||||||
// req.Attribute("description", []string{data.Description})
|
|
||||||
// }
|
|
||||||
// err := login.conn.Add(req)
|
|
||||||
// // log.Printf("899: %v",err)
|
|
||||||
// // log.Printf("899: %v",req)
|
|
||||||
// // log.Printf("899: %v",data)
|
|
||||||
// if err != nil {
|
|
||||||
// data.Common.Error = err.Error()
|
|
||||||
// } else {
|
|
||||||
// if template == "ml" {
|
|
||||||
// http.Redirect(w, r, "/admin/mailing/"+data.IdValue, http.StatusFound)
|
|
||||||
// } else {
|
|
||||||
// http.Redirect(w, r, "/admin/ldap/"+dn, http.StatusFound)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// inviteDn := config.InvitationNameAttr + "=" + code_id + "," + config.InvitationBaseDN
|
|
||||||
// req := ldap.NewAddRequest(inviteDn, nil)
|
|
||||||
// pw, err := SSHAEncode(code_pw)
|
|
||||||
// if err != nil {
|
|
||||||
// data.Common.ErrorMessage = err.Error()
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// req.Attribute("employeeNumber", []string{pw})
|
|
||||||
// req.Attribute("objectclass", []string{"top", "invitationCode"})
|
|
||||||
// err = login.conn.Add(req)
|
|
||||||
// if err != nil {
|
|
||||||
// log.Printf("286: %v", req)
|
|
||||||
// data.Common.ErrorMessage = err.Error()
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// If we want to display it, do so
|
|
||||||
if choice == "display" {
|
|
||||||
data.Common.Success = true
|
|
||||||
data.CodeDisplay = code
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Otherwise, we are sending a mail
|
|
||||||
if !EMAIL_REGEXP.MatchString(sendto) {
|
|
||||||
data.ErrorInvalidEmail = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
templateMail := template.Must(template.ParseFiles(templatePath + "/invite_mail.txt"))
|
|
||||||
buf := bytes.NewBuffer([]byte{})
|
|
||||||
templateMail.Execute(buf, &CodeMailFields{
|
|
||||||
To: sendto,
|
|
||||||
From: config.MailFrom,
|
|
||||||
InviteFrom: login.WelcomeName(),
|
|
||||||
Code: code,
|
|
||||||
WebBaseAddress: config.WebAddress,
|
|
||||||
})
|
|
||||||
log.Printf("Sending mail to: %s", sendto)
|
|
||||||
// var auth sasl.Client = nil
|
|
||||||
// if config.SMTPUsername != "" {
|
|
||||||
// auth = sasl.NewPlainClient("", config.SMTPUsername, config.SMTPPassword)
|
|
||||||
// }
|
|
||||||
// err = smtp.SendMail(config.SMTPServer, auth, config.MailFrom, []string{sendto}, buf)
|
|
||||||
// if err != nil {
|
|
||||||
// data.Common.ErrorMessage = err.Error()
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// log.Printf("Mail sent.")
|
|
||||||
data.Common.Success = true
|
|
||||||
data.CodeSentTo = sendto
|
|
||||||
}
|
|
||||||
|
|
||||||
func genCode() (code string, code_id string, code_pw string) {
|
|
||||||
random := make([]byte, 32)
|
|
||||||
n, err := rand.Read(random)
|
|
||||||
if err != nil || n != 32 {
|
|
||||||
log.Fatalf("Could not generate random bytes: %s", err)
|
|
||||||
}
|
|
||||||
a := binary.BigEndian.Uint32(random[0:4])
|
|
||||||
b := binary.BigEndian.Uint32(random[4:8])
|
|
||||||
c := binary.BigEndian.Uint32(random[8:12])
|
|
||||||
code = fmt.Sprintf("%03d-%03d-%03d", a%1000, b%1000, c%1000)
|
|
||||||
code_id, code_pw = readCode(code)
|
|
||||||
log.Printf("342: %v %v %v", code, code_id, code_pw)
|
|
||||||
return code, code_id, code_pw
|
|
||||||
}
|
|
||||||
|
|
||||||
func readCode(code string) (code_id string, code_pw string) {
|
|
||||||
// Strip everything that is not a digit
|
|
||||||
code_digits := ""
|
|
||||||
for _, c := range code {
|
|
||||||
if c >= '0' && c <= '9' {
|
|
||||||
code_digits = code_digits + string(c)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
id_hash := argon2.IDKey([]byte(code_digits), []byte("Guichet ID"), 2, 64*1024, 4, 32)
|
|
||||||
pw_hash := argon2.IDKey([]byte(code_digits), []byte("Guichet PW"), 2, 64*1024, 4, 32)
|
|
||||||
code_id = hex.EncodeToString(id_hash[:8])
|
|
||||||
code_pw = hex.EncodeToString(pw_hash[:16])
|
|
||||||
return code_id, code_pw
|
|
||||||
}
|
|
137
view-login.go
137
view-login.go
|
@ -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
|
|
||||||
}
|
|
160
view-passwd.go
160
view-passwd.go
|
@ -1,160 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
b64 "encoding/base64"
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
// "github.com/go-ldap/ldap/v3"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
)
|
|
||||||
|
|
||||||
func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
|
||||||
templateLostPasswordPage := getTemplate("passwd/lost.html")
|
|
||||||
if checkLogin(w, r) != nil {
|
|
||||||
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
|
|
||||||
}
|
|
||||||
|
|
||||||
data := PasswordLostData{
|
|
||||||
Common: NestedCommonTplData{
|
|
||||||
CanAdmin: false,
|
|
||||||
LoggedIn: false},
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.Method == "POST" {
|
|
||||||
r.ParseForm()
|
|
||||||
data.Username = strings.TrimSpace(strings.Join(r.Form["username"], ""))
|
|
||||||
data.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
|
|
||||||
data.OtherMailbox = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
|
|
||||||
user := User{
|
|
||||||
CN: strings.TrimSpace(strings.Join(r.Form["username"], "")),
|
|
||||||
UID: strings.TrimSpace(strings.Join(r.Form["username"], "")),
|
|
||||||
Mail: strings.TrimSpace(strings.Join(r.Form["mail"], "")),
|
|
||||||
OtherMailbox: strings.TrimSpace(strings.Join(r.Form["othermailbox"], "")),
|
|
||||||
}
|
|
||||||
ldapNewConn, err := openNewUserLdap(config)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf(fmt.Sprintf("handleLostPassword 99 : %v %v", err, ldapNewConn))
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
log.Printf(fmt.Sprintf("handleLostPassword 104 : %v %v", err, ldapNewConn))
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
} else {
|
|
||||||
// err = ldapConn.Bind(config.NewUserDN, config.NewUserPassword)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf(fmt.Sprintf("handleLostPassword 109 : %v %v", err, ldapNewConn))
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
} else {
|
|
||||||
data.Common.Success = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err = passwordLost(user, config, ldapNewConn)
|
|
||||||
}
|
|
||||||
data.Common.CanAdmin = false
|
|
||||||
// templateLostPasswordPage.Execute(w, data)
|
|
||||||
execTemplate(w, templateLostPasswordPage, data.Common, NestedLoginTplData{}, *config, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleFoundPassword(w http.ResponseWriter, r *http.Request) {
|
|
||||||
templateFoundPasswordPage := getTemplate("passwd.html")
|
|
||||||
data := PasswdTplData{
|
|
||||||
Common: NestedCommonTplData{
|
|
||||||
CanAdmin: false,
|
|
||||||
LoggedIn: false},
|
|
||||||
}
|
|
||||||
code := mux.Vars(r)["code"]
|
|
||||||
// code = strings.TrimSpace(strings.Join([]string{code}, ""))
|
|
||||||
newCode, _ := b64.URLEncoding.DecodeString(code)
|
|
||||||
ldapNewConn, err := openNewUserLdap(config)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("handleFoundPassword openNewUserLdap(config) : %v", err)
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
}
|
|
||||||
codeArray := strings.Split(string(newCode), ";")
|
|
||||||
user := User{
|
|
||||||
UID: codeArray[0],
|
|
||||||
Password: codeArray[1],
|
|
||||||
DN: "uid=" + codeArray[0] + "," + config.InvitationBaseDN,
|
|
||||||
}
|
|
||||||
user.SeeAlso, err = passwordFound(user, config, ldapNewConn)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("passwordFound(user, config, ldapConn) %v", err)
|
|
||||||
log.Printf("passwordFound(user, config, ldapConn) %v", user)
|
|
||||||
log.Printf("passwordFound(user, config, ldapConn) %v", ldapNewConn)
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
}
|
|
||||||
if r.Method == "POST" {
|
|
||||||
r.ParseForm()
|
|
||||||
|
|
||||||
password := strings.Join(r.Form["password"], "")
|
|
||||||
password2 := strings.Join(r.Form["password2"], "")
|
|
||||||
|
|
||||||
if len(password) < 8 {
|
|
||||||
data.TooShortError = true
|
|
||||||
} else if password2 != password {
|
|
||||||
data.NoMatchError = true
|
|
||||||
} else {
|
|
||||||
err := passwd(User{
|
|
||||||
DN: user.SeeAlso,
|
|
||||||
Password: password,
|
|
||||||
}, config, ldapNewConn)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
} else {
|
|
||||||
data.Common.Success = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data.Common.CanAdmin = false
|
|
||||||
// templateFoundPasswordPage.Execute(w, data)
|
|
||||||
execTemplate(w, templateFoundPasswordPage, data.Common, data.Login, *config, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
func handlePasswd(w http.ResponseWriter, r *http.Request) {
|
|
||||||
templatePasswd := getTemplate("passwd.html")
|
|
||||||
data := &PasswdTplData{
|
|
||||||
Common: NestedCommonTplData{
|
|
||||||
CanAdmin: false,
|
|
||||||
LoggedIn: true,
|
|
||||||
ErrorMessage: "",
|
|
||||||
Success: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
login := checkLogin(w, r)
|
|
||||||
if login == nil {
|
|
||||||
http.Redirect(w, r, "/", http.StatusFound)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data.Login.Status = login
|
|
||||||
data.Common.CanAdmin = login.Common.CanAdmin
|
|
||||||
|
|
||||||
if r.Method == "POST" {
|
|
||||||
r.ParseForm()
|
|
||||||
|
|
||||||
password := strings.Join(r.Form["password"], "")
|
|
||||||
password2 := strings.Join(r.Form["password2"], "")
|
|
||||||
|
|
||||||
if len(password) < 8 {
|
|
||||||
data.TooShortError = true
|
|
||||||
} else if password2 != password {
|
|
||||||
data.NoMatchError = true
|
|
||||||
} else {
|
|
||||||
err := passwd(User{
|
|
||||||
DN: login.Info.DN,
|
|
||||||
Password: password,
|
|
||||||
}, config, login.conn)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
} else {
|
|
||||||
data.Common.Success = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data.Common.CanAdmin = false
|
|
||||||
// templatePasswd.Execute(w, data)
|
|
||||||
execTemplate(w, templatePasswd, data.Common, data.Login, *config, data)
|
|
||||||
}
|
|
174
view-user.go
174
view-user.go
|
@ -1,174 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
// b64 "encoding/base64"
|
|
||||||
"fmt"
|
|
||||||
// "log"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/go-ldap/ldap/v3"
|
|
||||||
// "github.com/gorilla/mux"
|
|
||||||
)
|
|
||||||
|
|
||||||
func handleUserWait(w http.ResponseWriter, r *http.Request) {
|
|
||||||
templateUser := getTemplate("user/wait.html")
|
|
||||||
templateUser.Execute(w, HomePageData{
|
|
||||||
Common: NestedCommonTplData{
|
|
||||||
CanAdmin: false,
|
|
||||||
LoggedIn: false,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleUserMail(w http.ResponseWriter, r *http.Request) {
|
|
||||||
login := checkLogin(w, r)
|
|
||||||
if login == nil {
|
|
||||||
http.Redirect(w, r, "/", http.StatusFound)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
email := r.FormValue("email")
|
|
||||||
action := r.FormValue("action")
|
|
||||||
var err error
|
|
||||||
if action == "Add" {
|
|
||||||
// Add the new mail value to the entry
|
|
||||||
modifyRequest := ldap.NewModifyRequest(login.Info.DN, nil)
|
|
||||||
modifyRequest.Add("mail", []string{email})
|
|
||||||
|
|
||||||
err = login.conn.Modify(modifyRequest)
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, fmt.Sprintf("Error adding the email: %v", modifyRequest), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else if action == "Delete" {
|
|
||||||
modifyRequest := ldap.NewModifyRequest(login.Info.DN, nil)
|
|
||||||
modifyRequest.Delete("mail", []string{email})
|
|
||||||
|
|
||||||
log.Printf("handleUserMail %v", modifyRequest)
|
|
||||||
err = login.conn.Modify(modifyRequest)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("handleUserMail DeleteMail %v", err)
|
|
||||||
http.Error(w, fmt.Sprintf("Error deleting the email: %s", err), http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message := fmt.Sprintf("Mail value updated successfully to: %s", email)
|
|
||||||
http.Redirect(w, r, "/user?message="+message, http.StatusSeeOther)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func toInteger(index string) {
|
|
||||||
panic("unimplemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleUser(w http.ResponseWriter, r *http.Request) {
|
|
||||||
templateUser := getTemplate("user.html")
|
|
||||||
|
|
||||||
login := checkLogin(w, r)
|
|
||||||
if login == nil {
|
|
||||||
http.Redirect(w, r, "/", http.StatusFound)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data := &ProfileTplData{
|
|
||||||
Login: NestedLoginTplData{
|
|
||||||
Status: login,
|
|
||||||
Login: login,
|
|
||||||
},
|
|
||||||
Common: NestedCommonTplData{
|
|
||||||
CanAdmin: login.Common.CanAdmin,
|
|
||||||
LoggedIn: true,
|
|
||||||
ErrorMessage: "",
|
|
||||||
Success: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
data.Mail = login.UserEntry.GetAttributeValue("mail")
|
|
||||||
data.DisplayName = login.UserEntry.GetAttributeValue("displayName")
|
|
||||||
data.GivenName = login.UserEntry.GetAttributeValue("givenName")
|
|
||||||
data.Surname = login.UserEntry.GetAttributeValue("sn")
|
|
||||||
data.OtherMailbox = login.UserEntry.GetAttributeValue("carLicense")
|
|
||||||
data.MailValues = login.UserEntry.GetAttributeValues("mail")
|
|
||||||
// data.Visibility = login.UserEntry.GetAttributeValue(FIELD_NAME_DIRECTORY_VISIBILITY)
|
|
||||||
data.Description = login.UserEntry.GetAttributeValue("description")
|
|
||||||
//data.ProfilePicture = login.UserEntry.GetAttributeValue(FIELD_NAME_PROFILE_PICTURE)
|
|
||||||
|
|
||||||
if r.Method == "POST" {
|
|
||||||
//5MB maximum size files
|
|
||||||
r.ParseMultipartForm(5 << 20)
|
|
||||||
user := User{
|
|
||||||
DN: login.Info.DN,
|
|
||||||
GivenName: strings.TrimSpace(strings.Join(r.Form["given_name"], "")),
|
|
||||||
DisplayName: strings.TrimSpace(strings.Join(r.Form["display_name"], "")),
|
|
||||||
Mail: strings.TrimSpace(strings.Join(r.Form["mail"], "")),
|
|
||||||
SN: strings.TrimSpace(strings.Join(r.Form["surname"], "")),
|
|
||||||
OtherMailbox: strings.TrimSpace(strings.Join(r.Form["othermailbox"], "")),
|
|
||||||
Description: strings.TrimSpace(strings.Join(r.Form["description"], "")),
|
|
||||||
// Password: ,
|
|
||||||
//UID: ,
|
|
||||||
// CN: ,
|
|
||||||
}
|
|
||||||
|
|
||||||
if user.DisplayName != "" {
|
|
||||||
err := modify(user, config, login.conn)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.ErrorMessage = "handleUser : " + err.Error()
|
|
||||||
} else {
|
|
||||||
data.Common.Success = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
findUser, err := get(user, config, login.conn)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.ErrorMessage = "handleUser : " + err.Error()
|
|
||||||
}
|
|
||||||
data.DisplayName = findUser.DisplayName
|
|
||||||
data.GivenName = findUser.GivenName
|
|
||||||
data.Surname = findUser.SN
|
|
||||||
data.Description = findUser.Description
|
|
||||||
data.Mail = findUser.Mail
|
|
||||||
data.Common.LoggedIn = false
|
|
||||||
|
|
||||||
/*
|
|
||||||
visible := strings.TrimSpace(strings.Join(r.Form["visibility"], ""))
|
|
||||||
if visible != "" {
|
|
||||||
visible = "on"
|
|
||||||
} else {
|
|
||||||
visible = "off"
|
|
||||||
}
|
|
||||||
data.Visibility = visible
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
profilePicture, err := uploadProfilePicture(w, r, login)
|
|
||||||
if err != nil {
|
|
||||||
data.Common.ErrorMessage = err.Error()
|
|
||||||
}
|
|
||||||
if profilePicture != "" {
|
|
||||||
data.ProfilePicture = profilePicture
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//modify_request.Replace(FIELD_NAME_DIRECTORY_VISIBILITY, []string{data.Visibility})
|
|
||||||
//modify_request.Replace(FIELD_NAME_DIRECTORY_VISIBILITY, []string{"on"})
|
|
||||||
//if data.ProfilePicture != "" {
|
|
||||||
// modify_request.Replace(FIELD_NAME_PROFILE_PICTURE, []string{data.ProfilePicture})
|
|
||||||
// }
|
|
||||||
|
|
||||||
// err := login.conn.Modify(modify_request)
|
|
||||||
// log.Printf(fmt.Sprintf("Profile:079: %v",modify_request))
|
|
||||||
// log.Printf(fmt.Sprintf("Profile:079: %v",err))
|
|
||||||
// log.Printf(fmt.Sprintf("Profile:079: %v",data))
|
|
||||||
// if err != nil {
|
|
||||||
// data.Common.ErrorMessage = err.Error()
|
|
||||||
// } else {
|
|
||||||
// data.Common.Success = true
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("handleUser : %v", data)
|
|
||||||
|
|
||||||
// templateUser.Execute(w, data)
|
|
||||||
execTemplate(w, templateUser, data.Common, data.Login, *config, data)
|
|
||||||
}
|
|
278
view.go
278
view.go
|
@ -1,278 +0,0 @@
|
||||||
/*
|
|
||||||
Creates the webpages to be processed by Guichet
|
|
||||||
*/
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"html/template"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
// "net/http"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/go-ldap/ldap/v3"
|
|
||||||
)
|
|
||||||
|
|
||||||
type NestedCommonTplData struct {
|
|
||||||
Error string
|
|
||||||
ErrorMessage string
|
|
||||||
CanAdmin bool
|
|
||||||
CanInvite bool
|
|
||||||
LoggedIn bool
|
|
||||||
Success bool
|
|
||||||
WarningMessage string
|
|
||||||
WebsiteName string
|
|
||||||
WebsiteURL string
|
|
||||||
}
|
|
||||||
type NestedLoginTplData struct {
|
|
||||||
Login *LoginStatus
|
|
||||||
Username string
|
|
||||||
Status *LoginStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
type AdminUsersTplData struct {
|
|
||||||
UserNameAttr string
|
|
||||||
UserBaseDN string
|
|
||||||
Users EntryList
|
|
||||||
Common NestedCommonTplData
|
|
||||||
Login NestedLoginTplData
|
|
||||||
}
|
|
||||||
type AdminLDAPTplData struct {
|
|
||||||
DN string
|
|
||||||
|
|
||||||
Path []PathItem
|
|
||||||
ChildrenOU []Child
|
|
||||||
ChildrenOther []Child
|
|
||||||
CanAddChild bool
|
|
||||||
Props map[string]*PropValues
|
|
||||||
CanDelete bool
|
|
||||||
|
|
||||||
HasMembers bool
|
|
||||||
Members []EntryName
|
|
||||||
PossibleNewMembers []EntryName
|
|
||||||
HasGroups bool
|
|
||||||
Groups []EntryName
|
|
||||||
PossibleNewGroups []EntryName
|
|
||||||
|
|
||||||
ListMemGro map[string]string
|
|
||||||
|
|
||||||
Common NestedCommonTplData
|
|
||||||
Login NestedLoginTplData
|
|
||||||
}
|
|
||||||
type AdminMailingListTplData struct {
|
|
||||||
Common NestedCommonTplData
|
|
||||||
Login NestedLoginTplData
|
|
||||||
MailingNameAttr string
|
|
||||||
MailingBaseDN string
|
|
||||||
MailingList *ldap.Entry
|
|
||||||
Members EntryList
|
|
||||||
PossibleNewMembers EntryList
|
|
||||||
AllowGuest bool
|
|
||||||
}
|
|
||||||
type AdminMailingTplData struct {
|
|
||||||
Common NestedCommonTplData
|
|
||||||
Login NestedLoginTplData
|
|
||||||
MailingNameAttr string
|
|
||||||
MailingBaseDN string
|
|
||||||
MailingLists EntryList
|
|
||||||
}
|
|
||||||
type AdminGroupsTplData struct {
|
|
||||||
Common NestedCommonTplData
|
|
||||||
Login NestedLoginTplData
|
|
||||||
GroupNameAttr string
|
|
||||||
GroupBaseDN string
|
|
||||||
Groups EntryList
|
|
||||||
}
|
|
||||||
type EntryName struct {
|
|
||||||
DN string
|
|
||||||
Name string
|
|
||||||
}
|
|
||||||
type Child struct {
|
|
||||||
DN string
|
|
||||||
Identifier string
|
|
||||||
Name string
|
|
||||||
}
|
|
||||||
type PathItem struct {
|
|
||||||
DN string
|
|
||||||
Identifier string
|
|
||||||
Active bool
|
|
||||||
}
|
|
||||||
type PropValues struct {
|
|
||||||
Name string
|
|
||||||
Values []string
|
|
||||||
Editable bool
|
|
||||||
Deletable bool
|
|
||||||
}
|
|
||||||
type CreateData struct {
|
|
||||||
SuperDN string
|
|
||||||
Path []PathItem
|
|
||||||
Template string
|
|
||||||
|
|
||||||
IdType string
|
|
||||||
IdValue string
|
|
||||||
DisplayName string
|
|
||||||
GivenName string
|
|
||||||
Member string
|
|
||||||
Mail string
|
|
||||||
Description string
|
|
||||||
StructuralObjectClass string
|
|
||||||
ObjectClass string
|
|
||||||
SN string
|
|
||||||
OtherMailbox string
|
|
||||||
|
|
||||||
Common NestedCommonTplData
|
|
||||||
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 {
|
|
||||||
Common NestedCommonTplData
|
|
||||||
Login NestedLoginTplData
|
|
||||||
BaseDN string
|
|
||||||
Org string
|
|
||||||
}
|
|
||||||
type PasswordFoundData struct {
|
|
||||||
Common NestedCommonTplData
|
|
||||||
Login NestedLoginTplData
|
|
||||||
Username string
|
|
||||||
Mail string
|
|
||||||
OtherMailbox string
|
|
||||||
}
|
|
||||||
type PasswordLostData struct {
|
|
||||||
Common NestedCommonTplData
|
|
||||||
ErrorMessage string
|
|
||||||
Success bool
|
|
||||||
Username string
|
|
||||||
Mail string
|
|
||||||
OtherMailbox string
|
|
||||||
}
|
|
||||||
type NewAccountData struct {
|
|
||||||
Username string
|
|
||||||
DisplayName string
|
|
||||||
GivenName string
|
|
||||||
Surname string
|
|
||||||
Mail string
|
|
||||||
SuggestPW string
|
|
||||||
OtherMailbox string
|
|
||||||
|
|
||||||
ErrorUsernameTaken bool
|
|
||||||
ErrorInvalidUsername bool
|
|
||||||
ErrorPasswordTooShort bool
|
|
||||||
ErrorPasswordMismatch bool
|
|
||||||
Common NestedCommonTplData
|
|
||||||
NewUserDefaultDomain string
|
|
||||||
}
|
|
||||||
type SendCodeData struct {
|
|
||||||
Common NestedCommonTplData
|
|
||||||
ErrorInvalidEmail bool
|
|
||||||
|
|
||||||
CodeDisplay string
|
|
||||||
CodeSentTo string
|
|
||||||
WebBaseAddress string
|
|
||||||
}
|
|
||||||
|
|
||||||
type CodeMailFields struct {
|
|
||||||
From string
|
|
||||||
To string
|
|
||||||
Code string
|
|
||||||
InviteFrom string
|
|
||||||
WebBaseAddress string
|
|
||||||
Common NestedCommonTplData
|
|
||||||
}
|
|
||||||
type ProfileTplData struct {
|
|
||||||
Mail string
|
|
||||||
MailValues []string
|
|
||||||
DisplayName string
|
|
||||||
GivenName string
|
|
||||||
Surname string
|
|
||||||
Description string
|
|
||||||
OtherMailbox string
|
|
||||||
Common NestedCommonTplData
|
|
||||||
Login NestedLoginTplData
|
|
||||||
}
|
|
||||||
|
|
||||||
//ProfilePicture string
|
|
||||||
//Visibility string
|
|
||||||
|
|
||||||
type PasswdTplData struct {
|
|
||||||
Common NestedCommonTplData
|
|
||||||
Login NestedLoginTplData
|
|
||||||
TooShortError 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 {
|
|
||||||
Username string
|
|
||||||
WrongUser bool
|
|
||||||
WrongPass bool
|
|
||||||
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 {
|
|
||||||
Template *template.Template
|
|
||||||
}
|
|
||||||
|
|
||||||
var templatePath = "./templates"
|
|
||||||
|
|
||||||
func getTemplate(name string) *template.Template {
|
|
||||||
return template.Must(template.New("layout.html").Funcs(template.FuncMap{
|
|
||||||
"contains": strings.Contains,
|
|
||||||
}).ParseFiles(
|
|
||||||
templatePath+"/layout.html",
|
|
||||||
templatePath+"/"+name,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
Reference in a new issue