validate
Sets a validation function that will check the given API key retrieved from the headerName header and return an arbitrary principal object (for example, a user or service identity) if authentication succeeds, or null if authentication fails.
Parameters
body
the validation function that receives the API key as a String parameter and returns an arbitrary principal object or null.