我一直在使用JSON令牌,并阅读如何使应用程序更加安全。当用户被授权时,将对令牌进行签名,并将一个令牌放置在授权头中。然后,可以将此令牌放置在localStorage、sessionStorage或cookieStorage中。最后一个选项是最安全的选项,但我想知道是否有任何JSON web令牌的特性,或者任何中间件,或者JSON Web加密(不太确定这是如何工作的),以防止恶意攻击者拦截/获取该令牌,并将其用于对应用程序的API的未来请求,因为所需的只是一个带有该令牌的请求,以便一个哑服务器响应所请求的信息。
发布于 2016-11-23 08:49:36
发布于 2016-12-22 21:15:30
保护用户凭据-会话Cookies Vs。JWTs:-在服务器上实现HTTPS,登录表单在此安全通道上发布--将会话ID存储在只能通过安全通道发送到服务器的只允许HTTPS的cookie中--防止恶意代码(XSS):不要使用本地存储--使用JSON Web令牌来保护Web应用程序UI: 3部分:
Header:
{
"typ":"JWT",
"alg":"HS256"//ALGORITHM HS256 are specifically designed to PREVENT alteration of the payload
}
JWT: should be signed with a private signing key
Body:
{
"iss":"your site"//Who issued this token,
"exp": //timestamp,//set the good expiration time
"sub": "users/105898"//user ID,
"scope": "self api/comment"//What this user can do
}备注:
https://security.stackexchange.com/questions/105898
复制相似问题