@@ -26,16 +26,17 @@ import (
2626const (
2727 extAuthzFilterNamespace = "envoy.filters.http.ext_authz"
2828
29- headerAuthorized = "x-apigee-authorized"
30- headerAccessToken = "x-apigee-accesstoken"
31- headerAPI = "x-apigee-api"
32- headerAPIProducts = "x-apigee-apiproducts"
33- headerApplication = "x-apigee-application"
34- headerClientID = "x-apigee-clientid"
35- headerDeveloperEmail = "x-apigee-developeremail"
36- headerEnvironment = "x-apigee-environment"
37- headerOrganization = "x-apigee-organization"
38- headerScope = "x-apigee-scope"
29+ headerAuthorized = "x-apigee-authorized"
30+ headerAccessToken = "x-apigee-accesstoken"
31+ headerAPI = "x-apigee-api"
32+ headerAPIProducts = "x-apigee-apiproducts"
33+ headerApplication = "x-apigee-application"
34+ headerClientID = "x-apigee-clientid"
35+ headerDeveloperEmail = "x-apigee-developeremail"
36+ headerEnvironment = "x-apigee-environment"
37+ headerOrganization = "x-apigee-organization"
38+ headerScope = "x-apigee-scope"
39+ headerCustomAttributes = "x-apigee-customattributes"
3940)
4041
4142// encodeExtAuthzMetadata encodes given api and auth context into
@@ -56,6 +57,11 @@ func encodeExtAuthzMetadata(api string, ac *auth.Context, authorized bool) *stru
5657 headerOrganization : stringValueFrom (ac .Organization ()),
5758 headerScope : stringValueFrom (strings .Join (ac .Scopes , " " )),
5859 }
60+
61+ if ac .CustomAttributes != "" {
62+ fields [headerCustomAttributes ] = stringValueFrom (ac .CustomAttributes )
63+ }
64+
5965 if authorized {
6066 fields [headerAuthorized ] = stringValueFrom ("true" )
6167 }
@@ -119,12 +125,13 @@ func (h *Handler) decodeExtAuthzMetadata(fields map[string]*structpb.Value) (str
119125 }
120126
121127 return api , & auth.Context {
122- Context : rootContext ,
123- AccessToken : fields [headerAccessToken ].GetStringValue (),
124- APIProducts : strings .Split (fields [headerAPIProducts ].GetStringValue (), "," ),
125- Application : fields [headerApplication ].GetStringValue (),
126- ClientID : fields [headerClientID ].GetStringValue (),
127- DeveloperEmail : fields [headerDeveloperEmail ].GetStringValue (),
128- Scopes : strings .Split (fields [headerScope ].GetStringValue (), " " ),
128+ Context : rootContext ,
129+ AccessToken : fields [headerAccessToken ].GetStringValue (),
130+ APIProducts : strings .Split (fields [headerAPIProducts ].GetStringValue (), "," ),
131+ Application : fields [headerApplication ].GetStringValue (),
132+ ClientID : fields [headerClientID ].GetStringValue (),
133+ DeveloperEmail : fields [headerDeveloperEmail ].GetStringValue (),
134+ Scopes : strings .Split (fields [headerScope ].GetStringValue (), " " ),
135+ CustomAttributes : fields [headerCustomAttributes ].GetStringValue (),
129136 }
130137}
0 commit comments