I've been looking into GCP API Gateway to be the entrypoint of our back-end system, composed of some Cloud Run, Pub/Sub and Firestore instances. I thought the gateway would be good for, among other things, being a central place for validating authenticated requests.
GCP offers some methods but none of them allows the developer to build a code implementation of what their authorization proccess should be. The idea would be to check for a secret on the header we give each of our clients and check some information about it on our database, like expiration date and some other things.
I'd like to know if there is a way to set a custom authentication by code and configure the API Gateway to handle it normally as it seems to do with the other options they provide.