Skip to content

Commit c6689b9

Browse files
committed
Adjust to new logging API
1 parent 785f555 commit c6689b9

File tree

6 files changed

+11
-6
lines changed

6 files changed

+11
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/vkuznet/TokenManager v0.0.1 // indirect
1919
github.com/vkuznet/auth-proxy-server/auth v0.0.0-20210726200103-cffa690dda9b
2020
github.com/vkuznet/auth-proxy-server/cric v0.0.0-20210726200103-cffa690dda9b
21-
github.com/vkuznet/auth-proxy-server/logging v0.0.0-20210729183901-75d8831dd7bb
21+
github.com/vkuznet/auth-proxy-server/logging v0.0.0-20210730112749-785f5559039f
2222
golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670
2323
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84
2424
gopkg.in/square/go-jose.v2 v2.5.1 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ github.com/vkuznet/auth-proxy-server/auth v0.0.0-20210726200103-cffa690dda9b h1:
157157
github.com/vkuznet/auth-proxy-server/auth v0.0.0-20210726200103-cffa690dda9b/go.mod h1:4o7LB5cxgJ8Mb7RIZ46D4wrxAuZGCWGHq4e/+RnXKhA=
158158
github.com/vkuznet/auth-proxy-server/cric v0.0.0-20210726200103-cffa690dda9b h1:hpnaGzGXac0Ft3nIXV7575N21ReFs0C5vDKkUs9CqEQ=
159159
github.com/vkuznet/auth-proxy-server/cric v0.0.0-20210726200103-cffa690dda9b/go.mod h1:OvroOpAhAEBJYwdisIrMKAK5WQxr2tR1ncFGqRcWo0s=
160-
github.com/vkuznet/auth-proxy-server/logging v0.0.0-20210729183901-75d8831dd7bb h1:XbvJ7t15jUi0ObhJ4SYzQDdeLvvx+TMlzlqzA2ISdPQ=
161-
github.com/vkuznet/auth-proxy-server/logging v0.0.0-20210729183901-75d8831dd7bb/go.mod h1:rEHBafUXWUWp8o4zkvTooUDTHDhV4oj4trnO1fI2l4k=
160+
github.com/vkuznet/auth-proxy-server/logging v0.0.0-20210730112749-785f5559039f h1:Vssoux4/lQTLRwdLYkZLHdZEPTREFTwIzEkEFMHLfaU=
161+
github.com/vkuznet/auth-proxy-server/logging v0.0.0-20210730112749-785f5559039f/go.mod h1:rEHBafUXWUWp8o4zkvTooUDTHDhV4oj4trnO1fI2l4k=
162162
github.com/vkuznet/x509proxy v0.0.0-20191014143623-163039704c67 h1:7s/FGCnCgfaJxmyeE+k18s5Bpx1TIrss4sMesjqRJsI=
163163
github.com/vkuznet/x509proxy v0.0.0-20191014143623-163039704c67/go.mod h1:n8gnqWgHpPWW+DyA66Zam8qQshAmDxVVmSmObyR6M8g=
164164
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ func main() {
329329
log.SetOutput(rotlogs)
330330
}
331331
}
332+
// initialize logging module
333+
logging.CMSMonitType = Config.MonitType
334+
logging.CMSMonitProducer = Config.MonitProducer
335+
332336
if Config.Verbose > 0 {
333337
log.Printf("%+v\n", Config)
334338
}
@@ -350,6 +354,7 @@ func main() {
350354
// initialize all particiapted providers
351355
auth.Init(Config.Providers, Config.Verbose)
352356

357+
// initialize cmsauth module
353358
CMSAuth.Init(Config.Hmac)
354359

355360
// start our servers

oauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ func oauthRequestHandler(w http.ResponseWriter, r *http.Request) {
362362

363363
attrs, err := checkAccessToken(r)
364364
// add LogRequest after we set cms headers in HTTP request
365-
defer logging.LogRequest(w, r, start, "CERN-SSO-OAuth2-OICD", &status, tstamp)
365+
defer logging.LogRequest(w, r, start, "CERN-SSO-OAuth2-OICD", &status, tstamp, 0)
366366
if err != nil {
367367
// there is no proper authentication yet, redirect users to auth callback
368368
aurl := OAuth2Config.AuthCodeURL(oauthState)

scitokens.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func scitokensHandler(w http.ResponseWriter, r *http.Request) {
162162
start := time.Now()
163163
status := http.StatusOK
164164
tstamp := int64(start.UnixNano() / 1000000) // use milliseconds for MONIT
165-
defer logging.LogRequest(w, r, start, "scitokens", &status, tstamp)
165+
defer logging.LogRequest(w, r, start, "scitokens", &status, tstamp, 0)
166166

167167
err := r.ParseForm()
168168
if err != nil {

x509.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func x509RequestHandler(w http.ResponseWriter, r *http.Request) {
5555
printHTTPRequest(r, "cms headers")
5656
}
5757
// add LogRequest after we set cms headers in HTTP request
58-
defer logging.LogRequest(w, r, start, "x509", &status, tstamp)
58+
defer logging.LogRequest(w, r, start, "x509", &status, tstamp, 0)
5959
if _, ok := userData["name"]; !ok {
6060
log.Println("unauthorized access, user not found in CRIC DB")
6161
status = http.StatusUnauthorized

0 commit comments

Comments
 (0)