Is there a way for a WordPress plugin to authenticate a user for the current request?
My plan is to authenticate users via a HTTP header containing username and password. Then this information should be used to handle the current request as if this user would be logged in. However no session cookie or anything should be set, so that the authentication is only valid for the current request.
(I know of the security implications, they are taken care of)
The mechanism should work for normal pages, that render HTML and not be limitted to the JSON API.
Background
My WordPress installation is not accessible from the internet, but reverse proxied from an application server. I configured some pages in WordPress to only be available for certain WordPress users.
Now I want to use the permissions used in WordPress with its users to determine what content can be accessed from the application server. The users in WordPress basically resemble the usergroups of the application server. That way I can use a full blown permission system in WordPress without needing to replicate the user database from the application server in the WordPress instance.