-
Notifications
You must be signed in to change notification settings - Fork 146
Description
So, after a week of pulling my hair out, I’ve learned this:
set up an app service with integrated easy auth
the Java web app hosted in it doesn’t do any authentication itself, the user is authenticated first and dumped into the app
What the app does have is a request header X-MS-TOKEN-AAD-ACCESS-TOKEN, and in that header is a nice token
that magical token can then be used to call the graph api directly, “Bearer “ + request.getHeader(X-MS-…) But it can only be used for the oidc/userinfo endpoint, NOT the me endpoint
Now if you do this step you can now use it for the me endpoint.
So if in the above linked step you give app service easy auth the scope https://sql.azuresynapse-dogfood.net/user_impersonation instead of https://graph.microsoft.com/User.Read (you can’t use both) you can use the X-MS… header directly with Java class SQLServerDataSource.setAccessToken and query the db as your logged in user (hooray row level security)
BUT that token cannot be passed to MSAL to be converted into anything. It’s already been converted (hence me banging my head against the wall for a week until I realized this). so you can’t use any of the authenticationProviders this client supports.
my feature request: Instead of GraphServiceClient.authenticationProvider let me use GraphServiceClient.accessToken
ok, I’m done now