Comments (5)
Check values of claim constants.
When you create a token you use JwtRegisteredClaimNames.Sub
constant with value "sub"
.
And when you get claim in CurrentUser service you use ClaimTypes.NameIdentifier
and its value is "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"
from cleanarchitecture.
NameIdentifier bind the Sub type value.
Also, more clearify, I added another Claim to jwt which is "uid" claim type.
Here, is my decoded token value in jwt
Little bit change in CurrentUser class
still, user of httpcontext shows null
is there any possibility that when i request with Bearer token, the action can't verify bearer token?
but i get the bearer token in request header.
from cleanarchitecture.
Hello @salmanshafiq00, your solution looks promising, and I'd like to investigate the null issue you encountered. Could you please push your implementation to the repository so that I can clone it and examine the code more closely? This will help me better understand the problem and assist with finding a resolution. Thank you!
from cleanarchitecture.
@salmanshafiq00 I've been wrestling with similar in an effort to implement a more 'vanilla' JWT and I believe it's because the system isn't recognising your DefaultAuthenticationScheme and because of it, is not calling the [Authorize] attribute in the way you'd expect.
I believe you can decorate controllers with:
[Authorize(AuthenticationSchemes = "Bearer")]
I had thought I had set the authentication scheme in the way I set up identity but it doesn't seem to translate. I'll add more when/if
from cleanarchitecture.
@iamcymentho @Chris-Mingay ,
For your concern I push my repo in GitHub and here is the link https://github.com/salmanshafiq00/LMS
from cleanarchitecture.
Related Issues (20)
- Add Web.GrpcServer [gRPC Server] HOT 1
- Can not get Entity.Id on Events (always 0) HOT 1
- Migrations Issues
- Angular 17, standalone HOT 2
- Can't create migrations HOT 2
- Swagger Specifications are incomplete
- FluentValidation not triggered HOT 2
- upgrade angular spa client to 17 HOT 2
- Angular 17 post data to dotnet core8. Json deserialisation of bool failed HOT 1
- Implement Universal Reflection-Driven MappingProfile for Cleaner DTOs HOT 1
- Azure.Identity 1.10.4 moderate severity vulnerability HOT 5
- Default password seeding not working properly
- SqlException: Invalid object name 'Serilogs'. HOT 2
- {"type":"https://tools.ietf.org/html/rfc7231#section-6.6.1","title":"An error occurred while processing your request.","status":500}
- Could I use file .env following ASPNETCORE_ENVIRONMENT ?
- ✨ Add PostgreSQL support
- LoggingBehaviour in the Application project doesn't do anything
- Internal server error if a invalid parameter is sent on the route
- Boilerplate without "test" entities such as TodoListItem, TodoList and WheaterForecast
- Replace AutoMapper with Mapperly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cleanarchitecture.