Repository: wso2/product-microgateway
Issue: Cannot invoke non secured resource

### Description:
<!-- Describe the issue -->
gets 500 error with following log
```
java.lang.NullPointerException
choreo-connect-with-apim-enforcer-1  | 	at com.google.protobuf.Value$Builder.setStringValue(Value.java:1063)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.choreo.connect.enforcer.grpc.ExtAuthService.lambda$buildResponse$3(ExtAuthService.java:155)
choreo-connect-with-apim-enforcer-1  | 	at java.base/java.util.HashMap.forEach(Unknown Source)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.choreo.connect.enforcer.grpc.ExtAuthService.buildResponse(ExtAuthService.java:154)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.choreo.connect.enforcer.grpc.ExtAuthService.check(ExtAuthService.java:74)
choreo-connect-with-apim-enforcer-1  | 	at io.envoyproxy.envoy.service.auth.v3.AuthorizationGrpc$MethodHandlers.invoke(AuthorizationGrpc.java:245)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:180)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:331)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:814)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
choreo-connect-with-apim-enforcer-1  | 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
choreo-connect-with-apim-enforcer-1  | 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
choreo-connect-with-apim-enforcer-1  | 	at java.base/java.lang.Thread.run(Unknown Source)
```

### Steps to reproduce:
create an api
disable security on a resource
invoke the resource

### analyse
this is due to new metadata added by https://github.com/wso2/product-microgateway/pull/2330/ and they are being null for non secured resource
raw token is null when resource is unsecured
https://github.com/wso2/product-microgateway/blob/d66797c2a2b056b594cb1b4708820c80d504f635/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java#L273

### Affected Product Version:
<!-- Members can use Affected/*** labels -->

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java

diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java
index a2ce09436..c6b8813bb 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java
@@ -43,6 +43,7 @@ import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * This is the filter handling the authentication for the requests flowing through the gateway.
@@ -129,7 +130,7 @@ public class AuthFilter implements Filter {
                 canAuthenticated = true;
                 AuthenticationResponse authenticateResponse = authenticate(authenticator, requestContext);
                 if (authenticateResponse.isAuthenticated() && !authenticateResponse.isContinueToNextAuthenticator()) {
-                    setInterceptorAuthContext(authenticator, requestContext);
+                    setInterceptorAuthContextMetadata(authenticator, requestContext);
                     return true;
                 }
             }
@@ -266,11 +267,14 @@ public class AuthFilter implements Filter {
                 StringUtils.join(retryConfig.getStatusCodes(), ","));
     }
 
-    private void setInterceptorAuthContext(Authenticator authenticator, RequestContext requestContext) {
+    private void setInterceptorAuthContextMetadata(Authenticator authenticator, RequestContext requestContext) {
         // add auth context to metadata, lua script will add it to the auth context of the interceptor
         AuthenticationContext authContext = requestContext.getAuthenticationContext();
-        requestContext.addMetadataToMap(InterceptorConstants.AuthContextFields.TOKEN_TYPE, authenticator.getName());
-        requestContext.addMetadataToMap(InterceptorConstants.AuthContextFields.TOKEN, authContext.getRawToken());
-        requestContext.addMetadataToMap(InterceptorConstants.AuthContextFields.KEY_TYPE, authContext.getKeyType());
+        requestContext.addMetadataToMap(InterceptorConstants.AuthContextFields.TOKEN_TYPE,
+                Objects.toString(authenticator.getName(), ""));
+        requestContext.addMetadataToMap(InterceptorConstants.AuthContextFields.TOKEN,
+                Objects.toString(authContext.getRawToken(), ""));
+        requestContext.addMetadataToMap(InterceptorConstants.AuthContextFields.KEY_TYPE,
+                Objects.toString(authContext.getKeyType(), ""));
     }
 }