659168fe32
- Implemented authz-adapter deployment and service for Envoy gRPC authorization. - Created PowerShell script to generate JWK for JWT authentication. - Documented the integration of ext_authz with user-rpc.ValidateToken in ENVOY_EXT_AUTHZ_ADAPTER.md. - Added comprehensive Envoy Gateway configuration guide with JWT authentication and access control in ENVOY_GATEWAY_GUIDE.md.
24 lines
385 B
Go
24 lines
385 B
Go
package utils
|
|
|
|
import "encoding/json"
|
|
|
|
type ErrorResponse struct {
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
}
|
|
|
|
func (e *ErrorResponse) Error() string {
|
|
marshal, err := json.Marshal(e)
|
|
if err != nil {
|
|
return err.Error()
|
|
}
|
|
return string(marshal)
|
|
}
|
|
|
|
func NewErrorResp(code int, msg error) *ErrorResponse {
|
|
return &ErrorResponse{
|
|
Code: code,
|
|
Msg: msg.Error(),
|
|
}
|
|
}
|