JetBrains / teamcity-azure-active-directory

TeamCity plugin which supports authentication via Microsoft Azure Active Directory
Apache License 2.0
26 stars 19 forks source link

Issue 3 - MalformedJsonException after login #5

Closed erikbra closed 9 years ago

erikbra commented 9 years ago

I added padding indicators to the claims token of the base64 encoded JWT string if the length was not a multiple of 4. Added unit tests as well to demonstrate the problem and fix it, but I am not sure if you want such a "big change" (adding unit tests) in the same pull request.

I could reproduce the problem with an example JWT token found here: https://developer.atlassian.com/static/connect/docs/latest/concepts/understanding-jwt.html

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEzODY4OTkxMzEsImlzcyI6ImppcmE6MTU0ODk1OTUiLCJxc2giOiI4MDYzZmY0Y2ExZTQxZGY3YmM5MGM4YWI2ZDBmNjIwN2Q0OTFjZjZkYWQ3YzY2ZWE3OTdiNDYxNGI3MTkyMmU5IiwiaWF0IjoxMzg2ODk4OTUxfQ.uKqU9dTB6gKwG6jQCuXYAiMNdfNRw98Hw_IWuA5MaMo

Without the fix, we get an exception. With the fix, the exception is gone.

mshish commented 9 years ago

@erikbra I believe I'm seeing a similar error, "HTTP Status 400 - Marked request as unauthenticated since failed to parse JWT from retrieved id_token", correct?

erikbra commented 9 years ago

That's the one, @mshish. I have fixed it, and created a pull request. But I haven't got any feedback from the repo owners. (utter silence....)