Groups are objects, try to debug it
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
dabc01ea11
commit
986c7e4c64
18
auth_oidc.go
18
auth_oidc.go
@ -84,34 +84,34 @@ func OIDC_CRI_complete(w http.ResponseWriter, r *http.Request, ps httprouter.Par
|
||||
if err != nil {
|
||||
http.Error(w, "Failed to exchange token: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
}
|
||||
rawIDToken, ok := oauth2Token.Extra("id_token").(string)
|
||||
if !ok {
|
||||
http.Error(w, "No id_token field in oauth2 token.", http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
}
|
||||
idToken, err := oidcVerifier.Verify(context.Background(), rawIDToken)
|
||||
if err != nil {
|
||||
http.Error(w, "Failed to verify ID Token: "+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
var claims struct {
|
||||
Firstname string `json:"given_name"`
|
||||
Lastname string `json:"family_name"`
|
||||
Nickname string `json:"nickname"`
|
||||
Username string `json:"preferred_username"`
|
||||
Email string `json:"email"`
|
||||
Groups []string `json:"groups"`
|
||||
Firstname string `json:"given_name"`
|
||||
Lastname string `json:"family_name"`
|
||||
Nickname string `json:"nickname"`
|
||||
Username string `json:"preferred_username"`
|
||||
Email string `json:"email"`
|
||||
Groups []interface{} `json:"groups"`
|
||||
}
|
||||
if err := idToken.Claims(&claims); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
// Try to debug Groups
|
||||
log.Println(claims.Groups)
|
||||
|
||||
if err := completeAuth(w, claims.Username, claims.Email, claims.Firstname, claims.Lastname, &session); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
Reference in New Issue
Block a user