I have tried using OAuth2 Proxy to manage my SSO authentication directly to ADFS rather than going through an intermediary like Keycloak. I first tried in an older version (7.1.x) with the OIDC provider, then in the brand new version (7.2.0) with the new ADFS provider configured as specified in the OAuth2 Proxy documentation (on ADFS I have an application group set up).
In both cases, I successfully connect to ADFS, and ADFS presents an authentication screen. Everything seems to work on the ADFS side (I type in the credentials, it accepts them and the ADFS login screen disappears). There are no error events in the ADFS logs. However, OAuth2 Proxy fails on the callback (which is correctly sent to https:\myserver\oauth2\callback. The value returned from ADFS in the URL looks like it is formatted as a JWT, but it is garbage (i.e. when I paste it into jwt.io, it says "invalid signature", the header is blank and the payload is utter garbage.) In other words, ADFS redirects to "https:\myserver\oauth2\callback?code=" where the value after "code=" is unintelligible.
I am thinking that ADFS is encrypting the token, but there seems to be no way to specify the certificate ADFS uses to OAuth2 Proxy, nor is there an indication in the documentation that it expects me to do so.
The ADFS in question is from Server 2016, so I assume it is ADFS v4.0.
Any thoughts? Am I missing something? Everything seems to work just fine until it gets back to the OAuth2 Proxy from ADFS.
Based on one answer, I may have used the wrong template when setting up the ADFS Application Group. Is there a specific template that should be used so that OAuth2 Proxy gets the answer it expects?