Custom JWT based authentication for Google App Eng

2019-08-13 01:20发布

问题:

I am using Google App Engine with Java. I would like to know, how to integrate custom JWT based authentication in Google App Engine.

I have seen https://developers.google.com/identity/choose-auth but I dont want the users connected with Google Account. I also want the users to sign in without an email address, but a username.

I searched on the internet but everywhere I looked, it is talking about the Google based authentication.

Thanks in advance.

回答1:

It seems at the moment, there is no library available for doing this.
Also I was unable to find any documentation to do this.

Here is how I implemented it.

  1. The client passes JWT in the Authorization header.
  2. At the API endpoint (not in Filter, it wont work), I extracted the header and validated the JWT. I throws Exceptions from the validation function itself, so that I don't have to repeat a lot of code.