fix: possible nil pointer on userinfo
This commit is contained in:
parent
9943f20215
commit
f40a07feeb
1 changed files with 4 additions and 0 deletions
|
@ -33,6 +33,10 @@ func Userinfo(w http.ResponseWriter, r *http.Request, userinfoProvider UserinfoP
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
splittedToken := strings.Split(tokenIDSubject, ":")
|
splittedToken := strings.Split(tokenIDSubject, ":")
|
||||||
|
if len(splittedToken) != 2 {
|
||||||
|
http.Error(w, "access token invalid", http.StatusUnauthorized)
|
||||||
|
return
|
||||||
|
}
|
||||||
info, err := userinfoProvider.Storage().GetUserinfoFromToken(r.Context(), splittedToken[0], splittedToken[1], r.Header.Get("origin"))
|
info, err := userinfoProvider.Storage().GetUserinfoFromToken(r.Context(), splittedToken[0], splittedToken[1], r.Header.Get("origin"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(http.StatusForbidden)
|
w.WriteHeader(http.StatusForbidden)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue