diff --git a/auth/auth.go b/auth/auth.go index cdac7fd..c8da5ab 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -18,7 +18,7 @@ type AuthenticationHandler interface { // Account is an interface that gives the application access to infos about the user. type Account interface { - Get(constants.AccountConstant) interface{} + Get(constants.AccountConstant) any List() []constants.AccountConstant Anonymous() bool Redirect(c *gin.Context) @@ -37,7 +37,7 @@ func (*AnonAccountHandler) Account(*gin.Context) Account { type AnonAccount struct{} // Get returns only AccountAnon = true -func (*AnonAccount) Get(key constants.AccountConstant) (in interface{}) { +func (*AnonAccount) Get(key constants.AccountConstant) (in any) { if key == constants.AccountAnon { return true } diff --git a/funcs/funcs.go b/funcs/funcs.go index 7bedfd3..a4b440a 100644 --- a/funcs/funcs.go +++ b/funcs/funcs.go @@ -13,7 +13,7 @@ import ( type PGXLogger struct{} // Log sends the logging data to phuslu/log -func (PGXLogger) Log(ctx context.Context, level pgx.LogLevel, msg string, data map[string]interface{}) { +func (PGXLogger) Log(ctx context.Context, level pgx.LogLevel, msg string, data map[string]any) { var entry *zerolog.Event switch level { case pgx.LogLevelDebug: diff --git a/funcs/go1.16_test.go b/funcs/go1.16_test.go index edcfac0..87fc20f 100644 --- a/funcs/go1.16_test.go +++ b/funcs/go1.16_test.go @@ -1,3 +1,4 @@ +//go:build go1.16 // +build go1.16 package funcs_test @@ -51,7 +52,7 @@ func getFS(depth, width int) fstest.MapFS { go nodes.getchildren("", &m, &wg) wg.Wait() var fs = make(fstest.MapFS) - m.Range(func(key, value interface{}) bool { + m.Range(func(key, value any) bool { fs[key.(string)] = value.(*fstest.MapFile) return true }) diff --git a/go.mod b/go.mod index a4859da..04a6e72 100644 --- a/go.mod +++ b/go.mod @@ -1,24 +1,58 @@ module go.sebtobie.de/httpserver -go 1.16 +go 1.19 require ( - github.com/Masterminds/goutils v1.1.1 // indirect github.com/crewjam/saml v0.4.8 github.com/flosch/pongo2/v6 v6.0.0 github.com/gin-gonic/gin v1.8.1 - github.com/go-playground/validator/v10 v10.11.1 // indirect github.com/golang-jwt/jwt/v4 v4.4.2 github.com/google/uuid v1.3.0 - github.com/imdario/mergo v0.3.13 // indirect github.com/jackc/pgx/v4 v4.17.2 github.com/jackc/tern v1.13.0 - github.com/jonboulle/clockwork v0.3.0 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/rs/xid v1.4.0 github.com/rs/zerolog v1.28.0 - golang.org/x/crypto v0.1.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect +) + +require ( + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver v1.5.0 // indirect + github.com/Masterminds/sprig v2.22.0+incompatible // indirect + github.com/beevik/etree v1.1.0 // indirect + github.com/crewjam/httperr v0.2.0 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/validator/v10 v10.11.1 // indirect + github.com/goccy/go-json v0.9.11 // indirect + github.com/huandu/xstrings v1.3.2 // indirect + github.com/imdario/mergo v0.3.13 // indirect + github.com/jackc/chunkreader/v2 v2.0.1 // indirect + github.com/jackc/pgconn v1.13.0 // indirect + github.com/jackc/pgio v1.0.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgproto3/v2 v2.3.1 // indirect + github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect + github.com/jackc/pgtype v1.12.0 // indirect + github.com/jackc/puddle v1.3.0 // indirect + github.com/jonboulle/clockwork v0.3.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.0.5 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/russellhaering/goxmldsig v1.1.1 // indirect + github.com/ugorji/go/codec v1.2.7 // indirect + golang.org/x/crypto v0.1.0 // indirect + golang.org/x/net v0.1.0 // indirect + golang.org/x/sys v0.1.0 // indirect + golang.org/x/text v0.4.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 2e21e68..0b546cd 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,6 @@ 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/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= -github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= github.com/flosch/pongo2/v6 v6.0.0 h1:lsGru8IAzHgIAw6H2m4PCyleO58I40ow6apih0WprMU= github.com/flosch/pongo2/v6 v6.0.0/go.mod h1:CuDpFm47R0uGGE7z13/tTlt1Y6zdxvr2RLT5LJhsHEU= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -60,12 +58,11 @@ github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/goccy/go-json v0.9.7 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM= -github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= @@ -205,8 +202,9 @@ github.com/mattermost/xml-roundtrip-validator v0.1.0/go.mod h1:qccnGMcpgwcNaBnxq github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= @@ -230,14 +228,10 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ 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/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= -github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= -github.com/phuslu/log v1.0.83 h1:zfqz5tfFPLF8w0jEscpDxE2aFg1Y1kcbORDPliKdIbU= -github.com/phuslu/log v1.0.83/go.mod h1:yAZh4pv6KxAsJDmJIcVSMxkMiUF7mJbpFN3vROkf0dc= +github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= +github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -308,7 +302,6 @@ github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95 github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec/go.mod h1:owBmyHYMLkxyrugmfwE/DLJyW8Ro9mkphwuVErQ0iUw= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -335,7 +328,6 @@ golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -346,7 +338,6 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -357,7 +348,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/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-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -365,7 +355,6 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ 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-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/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-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -386,15 +375,11 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -413,9 +398,7 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/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-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -427,13 +410,11 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/http.go b/http.go index ad0b3a7..72e7ddb 100644 --- a/http.go +++ b/http.go @@ -208,7 +208,7 @@ func (s *Server) menus() []menus.Menu { return s.menu } -func maptoarray(m map[string]Site) (a []interface{}) { +func maptoarray(m map[string]Site) (a []any) { for _, i := range m { a = append(a, i) } diff --git a/menus/menus_test.go b/menus/menus_test.go index f6627e0..bbb520b 100644 --- a/menus/menus_test.go +++ b/menus/menus_test.go @@ -17,7 +17,7 @@ func (a *account) Anonymous() bool { return !a.auth } -func (*account) Get(constants.AccountConstant) interface{} { +func (*account) Get(constants.AccountConstant) any { return nil } diff --git a/middleware/db/db.go b/middleware/db/db.go index 3e76553..bd62964 100644 --- a/middleware/db/db.go +++ b/middleware/db/db.go @@ -115,7 +115,7 @@ func (m *Middleware) Setup(mc middleware.Config) { // Defaults returns an default config for connections func (*Middleware) Defaults() middleware.Config { - return map[string]interface{}{ + return map[string]any{ "default": "host=/run/postgresql port=5432 dbname=httpserver", } } @@ -130,7 +130,7 @@ func (m *Middleware) Teardown() { } // Sites is an function for getting the migrations of the site -func (m *Middleware) Sites(sites []interface{}) (err error) { +func (m *Middleware) Sites(sites []any) (err error) { m.lock.Lock() defer m.lock.Unlock() var ( diff --git a/middleware/middleware.go b/middleware/middleware.go index 1e67acb..2419a90 100644 --- a/middleware/middleware.go +++ b/middleware/middleware.go @@ -56,7 +56,7 @@ func RequireUser(c *gin.Context) { } // Config is the type For Configuration of the Middleware -type Config map[string]interface{} +type Config map[string]any // Middleware is an type to Save data between executions and to provide help at the teardown. type Middleware interface { @@ -64,5 +64,5 @@ type Middleware interface { Defaults() Config Setup(Config) Teardown() - Sites([]interface{}) error + Sites([]any) error } diff --git a/modules/saml/account.go b/modules/saml/account.go index 68ce5a8..49b6084 100644 --- a/modules/saml/account.go +++ b/modules/saml/account.go @@ -15,15 +15,15 @@ import ( ) var defaccount = &account{ - data: map[constants.AccountConstant]interface{}{ + data: map[constants.AccountConstant]any{ constants.AccountID: uuid.Nil, constants.AccountAnon: true, }, } -func maptoarray(m map[string]interface{}) (output []interface{}) { +func maptoarray(m map[string]any) (output []any) { for k, v := range m { - output = append(output, []interface{}{k, v}) + output = append(output, []any{k, v}) } return } @@ -55,7 +55,7 @@ func (s *SAML) Account(c *gin.Context) auth.Account { return acc } -func (s *SAML) signingkey(token *jwt.Token) (key interface{}, err error) { +func (s *SAML) signingkey(token *jwt.Token) (key any, err error) { if _, ok := token.Method.(*jwt.SigningMethodRSAPSS); !ok { return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"]) } @@ -64,7 +64,7 @@ func (s *SAML) signingkey(token *jwt.Token) (key interface{}, err error) { type account struct { s *SAML - data map[constants.AccountConstant]interface{} + data map[constants.AccountConstant]any } func (a *account) Anonymous() bool { @@ -103,7 +103,7 @@ func (a *account) Redirect(c *gin.Context) { c.Redirect(http.StatusSeeOther, u.String()) } -func (a *account) Get(key constants.AccountConstant) interface{} { +func (a *account) Get(key constants.AccountConstant) any { return a.data[key] } diff --git a/modules/saml/funcs.go b/modules/saml/funcs.go index 068cd82..a351866 100644 --- a/modules/saml/funcs.go +++ b/modules/saml/funcs.go @@ -13,7 +13,7 @@ import ( "github.com/rs/zerolog/log" ) -func initcert(file string, verify func(interface{}) bool) (key interface{}, err error) { +func initcert(file string, verify func(any) bool) (key any, err error) { var blocks []*pem.Block if file == "" { err = fmt.Errorf("File %s is empty", file) @@ -24,7 +24,7 @@ func initcert(file string, verify func(interface{}) bool) (key interface{}, err return nil, err } for _, b := range blocks { - var key interface{} + var key any key, err = x509.ParsePKCS8PrivateKey(b.Bytes) if err != nil { key, err = x509.ParseCertificate(b.Bytes) @@ -75,7 +75,7 @@ func empty(data []string) bool { return false } -func jwttoken(claim jwt.Claims, privatekey interface{}) (string, error) { +func jwttoken(claim jwt.Claims, privatekey any) (string, error) { token := jwt.NewWithClaims( jwt.SigningMethodPS512, claim, diff --git a/modules/saml/saml.go b/modules/saml/saml.go index 97bde7e..8e56116 100644 --- a/modules/saml/saml.go +++ b/modules/saml/saml.go @@ -87,10 +87,10 @@ func (s *SAML) Setup(config httpserver.SiteConfig) (err error) { case int64: s.sp.MetadataValidDuration = time.Duration(config["metadatavalid"].(int64)) } - var key interface{} + var key any if keyfile, found := config["spprivatekey"]; found { s.SPPrivatekey = keyfile.(string) - key, err = initcert(s.SPPrivatekey, func(key interface{}) bool { + key, err = initcert(s.SPPrivatekey, func(key any) bool { _, ok := key.(*rsa.PrivateKey) return ok }) @@ -103,7 +103,7 @@ func (s *SAML) Setup(config httpserver.SiteConfig) (err error) { } if keyfile, found := config["sppublickey"]; found { s.SPPublicKey = keyfile.(string) - key, err = initcert(s.SPPublicKey, func(key interface{}) bool { + key, err = initcert(s.SPPublicKey, func(key any) bool { _, ok := key.(*x509.Certificate) return ok }) @@ -117,7 +117,7 @@ func (s *SAML) Setup(config httpserver.SiteConfig) (err error) { if keyfile, found := config["jwtprivatekey"]; found { s.JWTPrivatekey = keyfile.(string) - key, err = initcert(s.JWTPrivatekey, func(key interface{}) bool { + key, err = initcert(s.JWTPrivatekey, func(key any) bool { _, ok := key.(*rsa.PrivateKey) return ok }) @@ -206,7 +206,7 @@ func (s *SAML) acsHF(c *gin.Context) { // Defaults returns the default values for the config func (s *SAML) Defaults() httpserver.SiteConfig { - return map[string]interface{}{ + return map[string]any{ "domain": "example.com", "idp": defaultsaml.idp.String(), "sppublickey": "publickey.pem", diff --git a/site.go b/site.go index d1a53a9..dcd0197 100644 --- a/site.go +++ b/site.go @@ -26,4 +26,4 @@ type TeardownSite interface { } // SiteConfig is an interface for configitems of the site. The methods return the required items for the server -type SiteConfig map[string]interface{} +type SiteConfig map[string]any diff --git a/templates/templates.go b/templates/templates.go index add606e..a96a4de 100644 --- a/templates/templates.go +++ b/templates/templates.go @@ -62,7 +62,7 @@ func NewPongo2Renderer(ts *pongo2.TemplateSet) render.HTMLRender { } // Instance create an new instance of an REnder object -func (p2r *Pongo2Renderer) Instance(name string, data interface{}) render.Render { +func (p2r *Pongo2Renderer) Instance(name string, data any) render.Render { tmpl, err := p2r.ts.FromFile(name) r := &renderer{ tmpl: tmpl, @@ -72,10 +72,10 @@ func (p2r *Pongo2Renderer) Instance(name string, data interface{}) render.Render switch data.(type) { case pongo2.Context: r.data = data.(pongo2.Context) - case map[string]interface{}: - r.data = data.(map[string]interface{}) + case map[string]any: + r.data = data.(map[string]any) default: - r.err = errors.New("Failed to detect possible format for pongo2. It needs to be map[string]interface{} or pongo2.Context") + r.err = errors.New("Failed to detect possible format for pongo2. It needs to be map[string]any or pongo2.Context") } } log.Debug().Msg("Returning an instance")