问题描述
我正在将Google App Engine与Java配合使用.我想知道如何在Google App Engine中集成基于自定义JWT的身份验证.
I am using Google App Engine with Java.I would like to know, how to integrate custom JWT based authentication in Google App Engine.
我见过 https://developers.google.com/identity/choose-auth,但我不希望用户与Google帐户关联.我还希望用户登录时不要输入电子邮件地址,而要输入用户名.
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.
我在互联网上进行搜索,但是无论到哪里我都在谈论基于Google的身份验证.
I searched on the internet but everywhere I looked, it is talking about the Google based authentication.
谢谢.
推荐答案
目前似乎没有可用的库.
我也找不到任何文档来执行此操作.
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.
- 客户端在Authorization标头中传递JWT.
- 在API端点(不在Filter中,它将无法工作),我提取了标头并验证了JWT.我从验证函数本身抛出了异常,因此不必重复很多代码.
这篇关于使用Java对Google App Engine进行基于JWT的自定义身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!