[Bug] OIDC - Optional alg field being required in Pulsar causes OIDC authentication to fail #22419
Closed
2 of 3 tasks
Labels
type/bug
The PR fixed a bug or issue reported a bug
Search before asking
Read release policy
Version
Pulsar v3.1.1
Minimal reproduce step
Goal is to enable OIDC in a standalone Pulsar instance via Azure App Registrations.
What did you expect to see?
listed tenants
What did you see instead?
A 401/unauthorized on the client/shell side.
![image](https://private-user-images.githubusercontent.com/151540338/319300682-4b4b96fe-16d8-4890-a9f8-7b431f39d9d6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NTMxNzgsIm5iZiI6MTczOTQ1Mjg3OCwicGF0aCI6Ii8xNTE1NDAzMzgvMzE5MzAwNjgyLTRiNGI5NmZlLTE2ZDgtNDg5MC1hOWY4LTdiNDMxZjM5ZDlkNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxM1QxMzIxMThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xOTUxMzMzNGVmNDk3NTE5YTMzZDcyNjUwNDYwZDcwODI3ZDg0ZmNhMDA2MjM1NTcxYzE2NWQ2MGEzOTgwYmY1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.rN1cEVlTMENgrBL5IYIk6oDgxfL49a-ZO35eFdt2TyQ)
An error on the Pulsar broker/instance side: Failed to authenticate HTTP request:
Failed to authenticate HTTP request: JWK's alg [null] does not match JWT's alg [RS256]
Anything else?
The 'alg' header is optional, as per the JWK spec:
![image](https://private-user-images.githubusercontent.com/151540338/319296681-ead0f329-ea94-45b3-a0ef-f7fc8bb0ec10.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NTMxNzgsIm5iZiI6MTczOTQ1Mjg3OCwicGF0aCI6Ii8xNTE1NDAzMzgvMzE5Mjk2NjgxLWVhZDBmMzI5LWVhOTQtNDViMy1hMGVmLWY3ZmM4YmIwZWMxMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxM1QxMzIxMThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zNjkwMmIyYzI5MWQ5MWYwNDJmZDMwZGYxOTdkYzZiOTBmMWIzNTFmMGFkOTk4ZWNiZGRkZTU5NmExNzFiY2NkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.iG8gTVRTNFf7GG_KYBKiazhI576Fm9cNg9HRHvWBOTk)
Azure does not return this as field as part of the well known config, but the Pulsar OIDC implementation requires this. This validation is failing and results in the error I saw in the Pulsar instance logs:
It's also possible I've screwed up the OIDC configuration, but my suspicion above seems to make sense... I can share more of my config if needed.
I'll be glad to do anything I can to help fix this; my guess is this behavior would prevent it from functioning with Azure (if the alg field is missing globally). Short of creating a custom OIDC implementation/authorizer myself, is there anything else I can do in the interim to get around this?
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: