oidc
                                
                                 oidc copied to clipboard
                                
                                    oidc copied to clipboard
                            
                            
                            
                        GetClaim() returning interface is awkward to use. Use output parameter instead?
Is your feature request related to a problem? Please describe.
The following code is awkward as I need to guess that the structure that GetClaim() returns is map[string]string.
		val, ok := introspectionResponse.GetClaim("cnf").(map[string]string)
		if !ok {
			http.Error(rw, "", http.StatusUnauthorized)
			return
		}
		expectedClientCertificateHash, err := base64.URLEncoding.DecodeString(val["x5t#S256"])
		if err != nil {
			http.Error(rw, "", http.StatusUnauthorized)
			return
		}
		if !bytes.Equal(clientCertificateHash[:], expectedClientCertificateHash) {
			http.Error(rw, "", http.StatusUnauthorized)
			return
		}
Describe the solution you'd like
I'd prefer GetClaim() to take an output parameter instead. so that I can marshal safely to my own struct type:
func (r IntrospectionResponse) GetClaim(key string, out interface{}) error {...}
type ConfirmationClaim struct {
        CertificateThumbprint string `json:"x5t#S256"`
}
var cnf ConfirmationClaim
err := introspectionResponse.GetClaim("cnf", &cnf)
if err != nil { ... }
expectedClientCertificateHash, err := base64.URLEncoding.DecodeString(cnf.CertificateThumbprint)
if err != nil { ... }
if !bytes.Equal(clientCertificateHash[:], cnf.CertificateThumbprint {
	http.Error(rw, "", http.StatusUnauthorized)
	return
}
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
Hi @arianvp - I agree that this can be improved 😁
Currently all hands are in the version 2 prepwork for ZITADEL, so it might take 2-4 weeks before someone can get a hold of this issue. Hope thats not too bad for you.
No rush. The code works as is. It's just awkward.
#283 should improve this. If you have any other feedback, please let us know