Comments (4)
Yes, I can see that this is an issue with the TokenSigner
struct.
Nonetheless, you still can create your own cookie using the value provided from TokenSigner::create_signed_token
.
Something like this should work for you:
let token = token_signer.create_signed_token(claims, token_lifetime)?;
let cookie = Cookie::build("access_token".to_string(), token)
.path("/")
.secure(true)
.finish();
The TokenSigner::create_access_cookie
method is just a convenience wrapper around the above that ensures that the name
of the cookie is set correctly.
Maybe it would be better to just return a builder that allows you to set further options on the cookie.
from actix-jwt-auth-middleware.
I found that your workaround only partially addresses my issue. My goal is to enable users to log in and gain full access to the /app/ directory. I want to allow cookies to refresh properly. When a user refreshes the page at /app/foo, the new access cookie is set with the path /app/foo, which causes problems as it cannot be overwritten through a new login process. I have no idea about to modify the cookie gotten from refresh_authorizer
.
from actix-jwt-auth-middleware.
I had the same problem with access_token refreshing. I propose to add a method to TokenSigner builder, that would accept closure with CookieBuilder parameter. PR #26 This would allow us to set Path and other settings.
from actix-jwt-auth-middleware.
I suggested to @ovalek that rather than adding a new method that would accept a closure to modify the CookieBuilder
before it gets built, we should add an initial CookieBuilder
as a user-controllable parameter.
Please speak out if you have a use case where a function is required; it could be that I don't see the full picture here.
from actix-jwt-auth-middleware.
Related Issues (14)
- Example `use_jwt` clarification HOT 1
- Example simple.rs is not up to date
- Use utoipa_swagger_ui HOT 2
- Implement clear and easy rest API Functionality
- exonum-crypto is a forced feature on jwt-compact, against this crate's documentation HOT 1
- examples/simple.rs does not work on linux HOT 6
- jwt_compact::traits::Algorithm is not implemented for Ed25519 HOT 10
- Time Crate for token signer is not very up to date HOT 5
- error: failed to run custom build command for exonum-proto v1.0.0 HOT 11
- enable_authorization_header not available in version 0.3.0 of published crate HOT 5
- allowing specific endpoints to be authorized by JWT HOT 11
- It will be better to cache introspected user locally
- Authorization Header "Error: invalid base64 decoding" HOT 1
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 actix-jwt-auth-middleware.