Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get cookies from FilterRequestContext #98

Open
JianbaoTao opened this issue Oct 14, 2018 · 1 comment
Open

Cannot get cookies from FilterRequestContext #98

JianbaoTao opened this issue Oct 14, 2018 · 1 comment
Labels
proposal Proposals for new features or functionality

Comments

@JianbaoTao
Copy link

JianbaoTao commented Oct 14, 2018

The current FilterRequestContext interface doesn't offer an easy way to access cookies of the current request. This causes trouble if someone needs to implement an authentication filter based on cookies. For example, suppose I have an annotation @AuthRequired and it is applied to some resource methods (eg, all create methods) to indicate that these methods require authentication. It is natural to use a filter to support this kind of use case. However, if the authentication is cookie based, which is still common nowadays, then current FilterRequestContext interface is troublesome because it doesn't provide easy cookie access. One may argue that I could use the RestFilter interface. True, RestFilter interface allows you to access cookies easily. However, it doesn't give you access to the requested java method so that you can check if it is annotated with @AuthRequired. It would be much simpler if FilterRequestContext can allow cookie access.

@evanw555 evanw555 added the proposal Proposals for new features or functionality label Aug 3, 2019
@volezheng
Copy link

Is the following a workaround for this issue?
Object value = requestContext.getRequestContextLocalAttrs().get("httpCookies");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Proposals for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants