|
|
@ -33,7 +33,7 @@ type PublicJWK struct { |
|
|
|
} |
|
|
|
|
|
|
|
type InspectableToken struct { |
|
|
|
Public keypairs.PublicKey `json:"public"` |
|
|
|
Public keypairs.PublicKey `json:"jwk"` |
|
|
|
Protected map[string]interface{} `json:"protected"` |
|
|
|
Payload map[string]interface{} `json:"payload"` |
|
|
|
Signature string `json:"signature"` |
|
|
@ -47,7 +47,7 @@ func (t *InspectableToken) MarshalJSON() ([]byte, error) { |
|
|
|
payload, _ := json.Marshal(t.Payload) |
|
|
|
errs, _ := json.Marshal(t.Errors) |
|
|
|
return []byte(fmt.Sprintf( |
|
|
|
`{"public":%s,"protected":%s,"payload":%s,"signature":%q,"verified":%t,"errors":%s}`, |
|
|
|
`{"jwk":%s,"protected":%s,"payload":%s,"signature":%q,"verified":%t,"errors":%s}`, |
|
|
|
pub, header, payload, t.Signature, t.Verified, errs, |
|
|
|
)), nil |
|
|
|
} |
|
|
@ -217,14 +217,11 @@ func Route(jwksPrefix string, privkey keypairs.PrivateKey) { |
|
|
|
Errors: errors, |
|
|
|
} |
|
|
|
|
|
|
|
tokenB, err := json.MarshalIndent(inspected, "", " ") |
|
|
|
tokenB, _ := json.MarshalIndent(inspected, "", " ") |
|
|
|
if nil != err { |
|
|
|
fmt.Println("couldn't serialize inpsected token:") |
|
|
|
fmt.Println(err) |
|
|
|
http.Error(w, "Bad Format: malformed token, or malformed jwk at issuer url", http.StatusInternalServerError) |
|
|
|
return |
|
|
|
} |
|
|
|
fmt.Println("serialized inpsected token") |
|
|
|
fmt.Println(inspected) |
|
|
|
fmt.Println(string(tokenB)) |
|
|
|
fmt.Fprintf(w, string(tokenB)) |
|
|
|
}) |
|
|
|
|
|
|
|