Add fibre.Context to logs on /singup and /signin
This commit is contained in:
parent
add1a11ceb
commit
98f103cbaf
2 changed files with 31 additions and 14 deletions
|
@ -66,6 +66,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"db": d,
|
"db": d,
|
||||||
"sc": s,
|
"sc": s,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Authentication scope does not exist")
|
}).Debugln("Authentication scope does not exist")
|
||||||
|
@ -81,6 +82,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"db": d,
|
"db": d,
|
||||||
"sc": s,
|
"sc": s,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Authentication scope signin was unsuccessful")
|
}).Debugln("Authentication scope signin was unsuccessful")
|
||||||
|
@ -92,6 +94,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"db": d,
|
"db": d,
|
||||||
"sc": s,
|
"sc": s,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Authentication scope signin was unsuccessful")
|
}).Debugln("Authentication scope signin was unsuccessful")
|
||||||
|
@ -120,6 +123,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"db": d,
|
"db": d,
|
||||||
"sc": s,
|
"sc": s,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Problem with signing string")
|
}).Debugln("Problem with signing string")
|
||||||
|
@ -130,6 +134,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"db": d,
|
"db": d,
|
||||||
"sc": s,
|
"sc": s,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Authentication scope signin was successful")
|
}).Debugln("Authentication scope signin was successful")
|
||||||
|
@ -157,6 +162,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
log.WithPrefix("web").WithFields(map[string]interface{}{
|
log.WithPrefix("web").WithFields(map[string]interface{}{
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"nu": u,
|
"nu": u,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Username or password is missing")
|
}).Debugln("Username or password is missing")
|
||||||
|
@ -181,6 +187,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"db": d,
|
"db": d,
|
||||||
"du": u,
|
"du": u,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Database login does not exist")
|
}).Debugln("Database login does not exist")
|
||||||
|
@ -195,6 +202,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"db": d,
|
"db": d,
|
||||||
"du": u,
|
"du": u,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Database signin was unsuccessful")
|
}).Debugln("Database signin was unsuccessful")
|
||||||
|
@ -222,6 +230,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"db": d,
|
"db": d,
|
||||||
"du": u,
|
"du": u,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Problem with signing string")
|
}).Debugln("Problem with signing string")
|
||||||
|
@ -232,6 +241,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"db": d,
|
"db": d,
|
||||||
"du": u,
|
"du": u,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Database signin was successful")
|
}).Debugln("Database signin was successful")
|
||||||
|
@ -259,6 +269,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
log.WithPrefix("web").WithFields(map[string]interface{}{
|
log.WithPrefix("web").WithFields(map[string]interface{}{
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"nu": u,
|
"nu": u,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Username or password is missing")
|
}).Debugln("Username or password is missing")
|
||||||
|
@ -281,6 +292,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
log.WithPrefix("web").WithFields(map[string]interface{}{
|
log.WithPrefix("web").WithFields(map[string]interface{}{
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"nu": u,
|
"nu": u,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Namespace login does not exist")
|
}).Debugln("Namespace login does not exist")
|
||||||
|
@ -316,9 +328,10 @@ func signin(c *fibre.Context) (err error) {
|
||||||
str, err = signr.SignedString(usr.Code)
|
str, err = signr.SignedString(usr.Code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithPrefix("web").WithFields(map[string]interface{}{
|
log.WithPrefix("web").WithFields(map[string]interface{}{
|
||||||
"NS": n,
|
"ns": n,
|
||||||
"NU": u,
|
"nu": u,
|
||||||
"URL": "/signin",
|
"ctx": c,
|
||||||
|
"url": "/signin",
|
||||||
}).Debugln("Problem with signing string")
|
}).Debugln("Problem with signing string")
|
||||||
return fibre.NewHTTPError(403)
|
return fibre.NewHTTPError(403)
|
||||||
}
|
}
|
||||||
|
@ -326,6 +339,7 @@ func signin(c *fibre.Context) (err error) {
|
||||||
log.WithFields(map[string]interface{}{
|
log.WithFields(map[string]interface{}{
|
||||||
"ns": n,
|
"ns": n,
|
||||||
"du": u,
|
"du": u,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signin",
|
"url": "/signin",
|
||||||
"id": c.Get("id"),
|
"id": c.Get("id"),
|
||||||
}).Debugln("Namespace signin was successful")
|
}).Debugln("Namespace signin was successful")
|
||||||
|
|
|
@ -57,9 +57,10 @@ func signup(c *fibre.Context) (err error) {
|
||||||
|
|
||||||
if scp, err = mem.New(txn).GetSC(n, d, s); err != nil {
|
if scp, err = mem.New(txn).GetSC(n, d, s); err != nil {
|
||||||
log.WithFields(map[string]interface{}{
|
log.WithFields(map[string]interface{}{
|
||||||
"NS": n,
|
"ns": n,
|
||||||
"DB": d,
|
"db": d,
|
||||||
"SC": s,
|
"sc": s,
|
||||||
|
"ctx": c,
|
||||||
"url": "/signup",
|
"url": "/signup",
|
||||||
}).Debugln("Authentication scope does not exist")
|
}).Debugln("Authentication scope does not exist")
|
||||||
return fibre.NewHTTPError(403)
|
return fibre.NewHTTPError(403)
|
||||||
|
@ -71,20 +72,22 @@ func signup(c *fibre.Context) (err error) {
|
||||||
|
|
||||||
if res, err = db.Process(c, qury, vars); err != nil {
|
if res, err = db.Process(c, qury, vars); err != nil {
|
||||||
log.WithFields(map[string]interface{}{
|
log.WithFields(map[string]interface{}{
|
||||||
"NS": n,
|
"ns": n,
|
||||||
"DB": d,
|
"db": d,
|
||||||
"SC": s,
|
"sc": s,
|
||||||
"URL": "/signup",
|
"ctx": c,
|
||||||
|
"url": "/signup",
|
||||||
}).Debugln("Authentication scope signup was unsuccessful")
|
}).Debugln("Authentication scope signup was unsuccessful")
|
||||||
return fibre.NewHTTPError(501)
|
return fibre.NewHTTPError(501)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(res) != 1 && len(res[0].Result) != 1 {
|
if len(res) != 1 && len(res[0].Result) != 1 {
|
||||||
log.WithFields(map[string]interface{}{
|
log.WithFields(map[string]interface{}{
|
||||||
"NS": n,
|
"ns": n,
|
||||||
"DB": d,
|
"db": d,
|
||||||
"SC": s,
|
"sc": s,
|
||||||
"URL": "/signup",
|
"ctx": c,
|
||||||
|
"url": "/signup",
|
||||||
}).Debugln("Authentication scope signup was unsuccessful")
|
}).Debugln("Authentication scope signup was unsuccessful")
|
||||||
return fibre.NewHTTPError(403)
|
return fibre.NewHTTPError(403)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue