MadAppGang / identifo

Universal authentication framework for web, created with go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Identifo Admin: Federated Identity enable toggle doesn't work

kazemisoroush opened this issue · comments

When I try to enable the "Federated Identity" via API or the UI I get this error

PANIC: runtime error: invalid memory address or nil pointer dereference
goroutine 24991 [running]:
github.com/urfave/negroni.(*Recovery).ServeHTTP.func1(0x7fb29eae51f8, 0xc0000ba0b0, 0xc0001b1680, 0xc000204100)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/recovery.go:159 +0xd2
panic(0x10355c0, 0x1a725e0)
	/usr/local/go/src/runtime/panic.go:965 +0x1b9
github.com/madappgang/identifo/web/admin.(*Router).UpdateLoginSettings.func1(0x7fb29eae51f8, 0xc0000ba0c0, 0xc000204b00)
	/go/src/github.com/madappgang/identifo/web/admin/settings.go:232 +0xb4
net/http.HandlerFunc.ServeHTTP(0xc0005aa070, 0x7fb29eae51f8, 0xc0000ba0c0, 0xc000204b00)
	/usr/local/go/src/net/http/server.go:2049 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0001f0b40, 0x7fb29eae51f8, 0xc0000ba0c0, 0xc000204900)
	/go/pkg/mod/github.com/gorilla/mux@v1.7.3/mux.go:212 +0xd3
github.com/urfave/negroni.Wrap.func1(0x7fb29eae51f8, 0xc0000ba0c0, 0xc000204900, 0xc0008ac460)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46 +0x4d
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0xc000160630, 0x7fb29eae51f8, 0xc0000ba0c0, 0xc000204900, 0xc0008ac460)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0x14145e0, 0xc000160630, 0xc000160660, 0x7fb29eae51f8, 0xc0000ba0c0, 0xc000204900)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/madappgang/identifo/web/admin.(*Router).Session.func1(0x7fb29eae51f8, 0xc0000ba0c0, 0xc000204900, 0xc0008ac400)
	/go/src/github.com/madappgang/identifo/web/admin/middleware.go:23 +0xe6
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0xc0002f00b0, 0x7fb29eae51f8, 0xc0000ba0c0, 0xc000204900, 0xc0008ac400)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0x14145e0, 0xc0002f00b0, 0xc000160648, 0x7fb29eae51f8, 0xc0000ba0c0, 0xc000204900)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc000637200, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204900)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96 +0xf1
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0001f0900, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100)
	/go/pkg/mod/github.com/gorilla/mux@v1.7.3/mux.go:212 +0xd3
github.com/urfave/negroni.Wrap.func1(0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100, 0xc0008ac3e0)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46 +0x4d
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0xc000160d38, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100, 0xc0008ac3e0)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0x14145e0, 0xc000160d38, 0xc000160df8, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/rs/cors.(*Cors).ServeHTTP(0xc00042ad20, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100, 0xc0008ac3c0)
	/go/pkg/mod/github.com/rs/cors@v1.6.0/cors.go:240 +0x18f
github.com/urfave/negroni.middleware.ServeHTTP(0x1412c20, 0xc00042ad20, 0xc000160de0, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
net/http.HandlerFunc.ServeHTTP(...)
	/usr/local/go/src/net/http/server.go:2049
github.com/madappgang/identifo/web/admin.(*Router).RemoveTrailingSlash.func1(0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100, 0xc0008ac3a0)
	/go/src/github.com/madappgang/identifo/web/admin/middleware.go:86 +0x82
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x11d5938, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100, 0xc0008ac3a0)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0x14145e0, 0x11d5938, 0xc000160d98, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Static).ServeHTTP(0xc0002f5410, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100, 0xc0008ac380)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/static.go:34 +0x7c
github.com/urfave/negroni.middleware.ServeHTTP(0x1412cc0, 0xc0002f5410, 0xc000160d80, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Logger).ServeHTTP(0xc0002f4db0, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100, 0xc0008ac360)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/logger.go:62 +0x8a
github.com/urfave/negroni.middleware.ServeHTTP(0x1412c60, 0xc0002f4db0, 0xc000160d68, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Recovery).ServeHTTP(0xc0001b1680, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100, 0xc0008ac340)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/recovery.go:193 +0x8c
github.com/urfave/negroni.middleware.ServeHTTP(0x1412ca0, 0xc0001b1680, 0xc000160d50, 0x7fb29eae51f8, 0xc0000ba0b0, 0xc000204100)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc0002f5470, 0x1423830, 0xc00080a000, 0xc000204100)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96 +0xf1
github.com/madappgang/identifo/web/admin.(*Router).ServeHTTP(0xc0004f5c70, 0x1423830, 0xc00080a000, 0xc000204100)
	/go/src/github.com/madappgang/identifo/web/admin/router.go:153 +0x4d
net/http.StripPrefix.func1(0x1423830, 0xc00080a000, 0xc00061bf00)
	/usr/local/go/src/net/http/server.go:2092 +0x234
net/http.HandlerFunc.ServeHTTP(0xc000183050, 0x1423830, 0xc00080a000, 0xc00061bf00)
	/usr/local/go/src/net/http/server.go:2049 +0x44
net/http.(*ServeMux).ServeHTTP(0xc000078340, 0x1423830, 0xc00080a000, 0xc00061bf00)
	/usr/local/go/src/net/http/server.go:2428 +0x1ad
github.com/madappgang/identifo/web.(*Router).ServeHTTP(0xc00073c900, 0x1423830, 0xc00080a000, 0xc00061bf00)
	/go/src/github.com/madappgang/identifo/web/router.go:95 +0x4d
net/http.serverHandler.ServeHTTP(0xc00080a2a0, 0x1423830, 0xc00080a000, 0xc00061bf00)
	/usr/local/go/src/net/http/server.go:2867 +0xa3
net/http.(*conn).serve(0xc0000c3220, 0x1428620, 0xc0007a4c00)
	/usr/local/go/src/net/http/server.go:1932 +0x8cd
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2993 +0x39b

And here is the payload object:

{
    "login_with": {
        "username": true,
        "phone": true,
        "federated": true
    },
    "tfa_type": "sms"
}

And here is the API spec:

PUT {adminPanelUrl}/admin/settings/login

Also, please have a look at this video explaining the situation:
https://www.loom.com/share/2a30ef4575e843509cd3219471ed4b56

Just wanted to note that the same issue happens when I try enabling login with "Email and Password":

PANIC: runtime error: invalid memory address or nil pointer dereference
goroutine 25608 [running]:
github.com/urfave/negroni.(*Recovery).ServeHTTP.func1(0x7fb29eae51f8, 0xc00058e028, 0xc0001b1680, 0xc000205500)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/recovery.go:159 +0xd2
panic(0x10355c0, 0x1a725e0)
	/usr/local/go/src/runtime/panic.go:965 +0x1b9
github.com/madappgang/identifo/web/admin.(*Router).UpdateLoginSettings.func1(0x7fb29eae51f8, 0xc00058e038, 0xc000205900)
	/go/src/github.com/madappgang/identifo/web/admin/settings.go:232 +0xb4
net/http.HandlerFunc.ServeHTTP(0xc0005aa070, 0x7fb29eae51f8, 0xc00058e038, 0xc000205900)
	/usr/local/go/src/net/http/server.go:2049 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0001f0b40, 0x7fb29eae51f8, 0xc00058e038, 0xc000205700)
	/go/pkg/mod/github.com/gorilla/mux@v1.7.3/mux.go:212 +0xd3
github.com/urfave/negroni.Wrap.func1(0x7fb29eae51f8, 0xc00058e038, 0xc000205700, 0xc0008ac060)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46 +0x4d
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0xc000160630, 0x7fb29eae51f8, 0xc00058e038, 0xc000205700, 0xc0008ac060)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0x14145e0, 0xc000160630, 0xc000160660, 0x7fb29eae51f8, 0xc00058e038, 0xc000205700)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/madappgang/identifo/web/admin.(*Router).Session.func1(0x7fb29eae51f8, 0xc00058e038, 0xc000205700, 0xc000219fc0)
	/go/src/github.com/madappgang/identifo/web/admin/middleware.go:23 +0xe6
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0xc0002f00b0, 0x7fb29eae51f8, 0xc00058e038, 0xc000205700, 0xc000219fc0)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0x14145e0, 0xc0002f00b0, 0xc000160648, 0x7fb29eae51f8, 0xc00058e038, 0xc000205700)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc000637200, 0x7fb29eae51f8, 0xc00058e028, 0xc000205700)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96 +0xf1
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0001f0900, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500)
	/go/pkg/mod/github.com/gorilla/mux@v1.7.3/mux.go:212 +0xd3
github.com/urfave/negroni.Wrap.func1(0x7fb29eae51f8, 0xc00058e028, 0xc000205500, 0xc000219fa0)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46 +0x4d
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0xc000160d38, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500, 0xc000219fa0)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0x14145e0, 0xc000160d38, 0xc000160df8, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/rs/cors.(*Cors).ServeHTTP(0xc00042ad20, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500, 0xc000219f40)
	/go/pkg/mod/github.com/rs/cors@v1.6.0/cors.go:240 +0x18f
github.com/urfave/negroni.middleware.ServeHTTP(0x1412c20, 0xc00042ad20, 0xc000160de0, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
net/http.HandlerFunc.ServeHTTP(...)
	/usr/local/go/src/net/http/server.go:2049
github.com/madappgang/identifo/web/admin.(*Router).RemoveTrailingSlash.func1(0x7fb29eae51f8, 0xc00058e028, 0xc000205500, 0xc000219f20)
	/go/src/github.com/madappgang/identifo/web/admin/middleware.go:86 +0x82
github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x11d5938, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500, 0xc000219f20)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x4e
github.com/urfave/negroni.middleware.ServeHTTP(0x14145e0, 0x11d5938, 0xc000160d98, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Static).ServeHTTP(0xc0002f5410, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500, 0xc000219ec0)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/static.go:34 +0x7c
github.com/urfave/negroni.middleware.ServeHTTP(0x1412cc0, 0xc0002f5410, 0xc000160d80, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Logger).ServeHTTP(0xc0002f4db0, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500, 0xc000219ea0)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/logger.go:62 +0x8a
github.com/urfave/negroni.middleware.ServeHTTP(0x1412c60, 0xc0002f4db0, 0xc000160d68, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Recovery).ServeHTTP(0xc0001b1680, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500, 0xc000219e80)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/recovery.go:193 +0x8c
github.com/urfave/negroni.middleware.ServeHTTP(0x1412ca0, 0xc0001b1680, 0xc000160d50, 0x7fb29eae51f8, 0xc00058e028, 0xc000205500)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x9c
github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc0002f5470, 0x1423830, 0xc00080a540, 0xc000205500)
	/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96 +0xf1
github.com/madappgang/identifo/web/admin.(*Router).ServeHTTP(0xc0004f5c70, 0x1423830, 0xc00080a540, 0xc000205500)
	/go/src/github.com/madappgang/identifo/web/admin/router.go:153 +0x4d
net/http.StripPrefix.func1(0x1423830, 0xc00080a540, 0xc000205400)
	/usr/local/go/src/net/http/server.go:2092 +0x234
net/http.HandlerFunc.ServeHTTP(0xc000183050, 0x1423830, 0xc00080a540, 0xc000205400)
	/usr/local/go/src/net/http/server.go:2049 +0x44
net/http.(*ServeMux).ServeHTTP(0xc000078340, 0x1423830, 0xc00080a540, 0xc000205400)
	/usr/local/go/src/net/http/server.go:2428 +0x1ad
github.com/madappgang/identifo/web.(*Router).ServeHTTP(0xc00073c900, 0x1423830, 0xc00080a540, 0xc000205400)
	/go/src/github.com/madappgang/identifo/web/router.go:95 +0x4d
net/http.serverHandler.ServeHTTP(0xc00080a2a0, 0x1423830, 0xc00080a540, 0xc000205400)
	/usr/local/go/src/net/http/server.go:2867 +0xa3
net/http.(*conn).serve(0xc0000c30e0, 0x1428620, 0xc000789140)
	/usr/local/go/src/net/http/server.go:1932 +0x8cd
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2993 +0x39b