jwt

Restrict URL access control by id in jhipster

蓝咒 提交于 2021-02-08 04:44:25
问题 I have a problem that each user can retrieve other users data from URL. For instance, I have a rest api like this: @GetMapping("/getFindByPersonId/{perId}") @Timed public List<ComboVahedAmoozeshi> getFindBySkhsIdCombo(@PathVariable Long perId){ return comboVahedAmoozeshiRepository.getFindBySkhsIdCombo(perId); } After authorization, each user can change id and get other users data like the image below: Is there any suggestion to restrict each user to don`t have access to call the method? Or

Client authentication in microservices using JWT and OpenID Connect

故事扮演 提交于 2021-02-08 02:37:39
问题 I've some questions regarding authentication in a microservices architecture. I've right now a monolithic application and my goal is to split the application in small microservices. My bigest problem is for authentication (for now). After reading a LOT a documentation, It seems that the best solution is to use OpenID Connect to authenticate an user to retrieve a JWT that can by passed with the request to the microservices. Also, to avoid having multiple endpoints, you can deploy and API

Why in React, my axios API call has Authorization Header which contains Bearer <token> but not being authorized and gives 401 error

梦想与她 提交于 2021-02-08 02:01:39
问题 I'm making axios call to my php API (which shows user data when a valid token is sent back to API server) and sending a valid jwt token in request header (along with Bearer as prefix) and in the Network's tab its showing that my token is being sent in the header but still it gives me 401 error and returns the Error msg of API that "jwt is empty"... my API to fetch user data (when valid token is provided) is on http://localhost/Auth/api/validate.php and client side is on http://localhost:3000

Why in React, my axios API call has Authorization Header which contains Bearer <token> but not being authorized and gives 401 error

一个人想着一个人 提交于 2021-02-08 02:01:19
问题 I'm making axios call to my php API (which shows user data when a valid token is sent back to API server) and sending a valid jwt token in request header (along with Bearer as prefix) and in the Network's tab its showing that my token is being sent in the header but still it gives me 401 error and returns the Error msg of API that "jwt is empty"... my API to fetch user data (when valid token is provided) is on http://localhost/Auth/api/validate.php and client side is on http://localhost:3000

Decrypting signature and Veryifying JWT

南笙酒味 提交于 2021-02-07 23:25:34
问题 I understand that there exist other libraries which make my life easier to work with JWT (in node.js). In this case, I am using "crypto-js" to learn JWT in a manual way. The following gives me the token: var header = { "alg": "HS256", "typ": "JWT" }; var wordArrayHeader = CryptoJS.enc.Utf8.parse(JSON.stringify(header)); var base64Header = CryptoJS.enc.Base64.stringify(wordArrayHeader); var payload = { "sub": "1234567890", "name": "John Doe", "admin": true }; var wordArrayPayload = CryptoJS

Where to store JWT Token in .net core web api?

旧城冷巷雨未停 提交于 2021-02-07 19:30:15
问题 I am using web api for accessing data and I want to authenticate and authorize web api.For that I am using JWT token authentication. But I have no idea where should I store access tokens? What I want to do? 1)After login store the token 2)if user want to access any method of web api, check the token is valid for this user,if valid then give access. I know two ways 1)using cookies 2)sql server database which one is the better way to store tokens from above? 回答1: Alternatively, if you just

How to send JWT to React client from a callback?

Deadly 提交于 2021-02-07 19:25:11
问题 I am trying to create an application with passwordless authentication, with social medias like Facebook and by mail. I'm stupidly stuck a one point, maybe I have not understand something. Lets name my project MyApp: If a user try to log to facebook from myapp.com/ , he will be redirected to facebook.com/login , then facebook redirect him to myapp.com/callback . So, on my server, the route / and /callback are quite the same: they just send my React app to he user, but /callback generate a JWT

How to send JWT to React client from a callback?

≡放荡痞女 提交于 2021-02-07 19:24:26
问题 I am trying to create an application with passwordless authentication, with social medias like Facebook and by mail. I'm stupidly stuck a one point, maybe I have not understand something. Lets name my project MyApp: If a user try to log to facebook from myapp.com/ , he will be redirected to facebook.com/login , then facebook redirect him to myapp.com/callback . So, on my server, the route / and /callback are quite the same: they just send my React app to he user, but /callback generate a JWT

JWT UnauthorizedError: No authorization token was found (GET request with cookie)

百般思念 提交于 2021-02-07 18:16:24
问题 I have a strange problem, or maybe I don't understand how JWT works in Express context. var express = require('express') var app = express(); var expressJWT = require('express-jwt'); var jwt = require('jsonwebtoken'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var unless = require('express-unless'); app.set('secret', 'some secret'); app.use(cookieParser()); app.use(bodyParser.urlencoded({ extended: false })); app.use("/", expressJWT({secret:app.get(

Prevent users to have multiple sessions with JWT Tokens

爷,独闯天下 提交于 2021-02-07 10:15:38
问题 I am building an application which uses JWT bearer authentication in ASP.NET Core. I need to prevent users to have multiple sessions open at the same time. I am wondering if there is way using Microsoft.AspNetCore.Authentication.JwtBearer middleware to list out all the tokens of an user and then verify if there are other tokens issued for that user in order to invalidate the incoming authentication request. If the claims are able to be validated on the server, I guess that in order to do that