From b301a3df70232fe00de186b0586dcec8bf0d2559 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Wed, 19 Apr 2023 11:55:22 -0400 Subject: celmatcher: Implement `pkix.Name` conversion to string (#5492) --- modules/caddyhttp/celmatcher.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/caddyhttp/celmatcher.go b/modules/caddyhttp/celmatcher.go index c4635e2..fbc5f5a 100644 --- a/modules/caddyhttp/celmatcher.go +++ b/modules/caddyhttp/celmatcher.go @@ -255,7 +255,10 @@ type celPkixName struct{ *pkix.Name } func (pn celPkixName) ConvertToNative(typeDesc reflect.Type) (any, error) { return pn.Name, nil } -func (celPkixName) ConvertToType(typeVal ref.Type) ref.Val { +func (pn celPkixName) ConvertToType(typeVal ref.Type) ref.Val { + if typeVal.TypeName() == "string" { + return types.String(pn.Name.String()) + } panic("not implemented") } func (pn celPkixName) Equal(other ref.Val) ref.Val { -- cgit v1.2.3