Groups are objects, try to debug it
continuous-integration/drone/push Build is passing Details

This commit is contained in:
nemunaire 2021-01-09 15:06:26 +01:00
parent dabc01ea11
commit 986c7e4c64
1 changed files with 9 additions and 9 deletions

View File

@ -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