GithubHelp home page GithubHelp logo

Comments (7)

ottokruse avatar ottokruse commented on July 19, 2024

Hi @thertzelle . How sure are you it is not your browser's cache?

from cloudfront-authorization-at-edge.

thertzelle avatar thertzelle commented on July 19, 2024

If I visit the page in a new window, and visit the cookies tab, I have an old cookie. It seems like it would be hard to visit the page and it to not have requested the default endpoint and refresh the tokens?

from cloudfront-authorization-at-edge.

ottokruse avatar ottokruse commented on July 19, 2024

If I visit the page in a new window, and visit the cookies tab, I have an old cookie.

Yeah, cookies are shared by all tabs. If the cookie is old in the new tab, it will be old in all tabs.

It seems like it would be hard to visit the page and it to not have requested the default endpoint and refresh the tokens?

Yeah, if a refresh token is there that is still valid, the solution of this repo would use it to refresh the tokens. (Which is intended behavior)

If the user clicks "sign-out" explicitly, the cookies are thrown away. If the user doesn't do that, but just closes the browser, the cookies might be thrown away but this depends on:

  • If the cookiesettings you use in your Lambda@Edge-Auth setup include a max-age or expires, then the cookies will remain in your browser until that time

  • If the cookiesettings you use in your Lambda@Edge-Auth setup do not include a max-age or expires, then the cookies are session cookies, that depending on your browser setup get deleted when you close the browser. Many browsers nowadays do not do that, it is a browser setting that users can alter.

Another factor coming into play, is that the refresh token itself has an expiry date, that can be set in the Cognito User Pool config (defaults to 30 days).

from cloudfront-authorization-at-edge.

ottokruse avatar ottokruse commented on July 19, 2024

Closing for now, as I do not believe there is an action for this repo.

from cloudfront-authorization-at-edge.

yashsharma04 avatar yashsharma04 commented on July 19, 2024

Hi @ottokruse
Quick question: For scenarios, where we logout and we remove the cookies from the browser. But if we copy the id token before and use it to make further request from postman, it would still work.
What would be your recommendation to solve such use cases. (to invalidate the logged out id token since its stateless)

from cloudfront-authorization-at-edge.

ottokruse avatar ottokruse commented on July 19, 2024

Best strategy I think is to have short token expiration so this risk becomes low enough to be acceptable.

Otherwise what you could do is call eg Cognito GetUser with the access token and if that fails you know the user is logged out. But it's not ideal to call that on every request (in checkauth lambda) because it adds latency and there is a max rps to it.

from cloudfront-authorization-at-edge.

yashsharma04 avatar yashsharma04 commented on July 19, 2024

Having a short token expiration is still flagged by our info-sec team. And making a n/w call as you mentioned adds latency. Any other approach that would be practical enough to implement? @ottokruse

from cloudfront-authorization-at-edge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.