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

Move CORS filter to Shiro #2855

Merged
merged 1 commit into from
Feb 21, 2020

Conversation

lorthirk
Copy link

This PR moves the CORSResponseFilter from the Jersey logic to the Shiro logic. This is because when a request fails with 401 Unauthorized error code, Shiro stops the request processing before reaching Jersey and the CORS filter and returns a response without the needed headers. The browser will then complain because it receives a response without such headers.

Related Issue
No related issue

Description of the solution adopted
CORSResponseFilter inherits now from Shiro OncePerRequestFilter and is added in the chain before KapuaTokenAuthenticationFilter

@lorthirk lorthirk added Bug This is a bug or an unexpected behaviour. Fix it! REST API We hope to REST everyday labels Feb 14, 2020
@lorthirk lorthirk requested a review from Coduz February 14, 2020 11:22
@lorthirk lorthirk changed the title Move CORS filter so Shiro Move CORS filter to Shiro Feb 14, 2020
Signed-off-by: Claudio Mezzasalma <claudio.mezzasalma@eurotech.com>
@lorthirk lorthirk force-pushed the change-shiroCorsFilter branch from 10283b9 to 7ef2270 Compare February 14, 2020 11:45
@codecov
Copy link

codecov bot commented Feb 14, 2020

Codecov Report

Merging #2855 into develop will decrease coverage by 13.55%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop   #2855       +/-   ##
=============================================
- Coverage      48.86%   35.3%   -13.56%     
+ Complexity      2315    1593      -722     
=============================================
  Files           1009    1009               
  Lines          21800   21800               
  Branches        1976    1976               
=============================================
- Hits           10652    7697     -2955     
- Misses         10331   13503     +3172     
+ Partials         817     600      -217
Impacted Files Coverage Δ Complexity Δ
...atastore/internal/model/StorableIdFactoryImpl.java 0% <0%> (-100%) 0% <0%> (-2%)
...rvice/datastore/internal/model/MetricsIndexBy.java 0% <0%> (-100%) 0% <0%> (-2%)
...device/call/message/kura/data/KuraDataPayload.java 0% <0%> (-100%) 0% <0%> (-1%)
...store/client/embedded/EmbeddedNodeSettingsKey.java 0% <0%> (-100%) 0% <0%> (-3%)
.../service/datastore/internal/model/DataIndexBy.java 0% <0%> (-100%) 0% <0%> (-2%)
...vice/datastore/internal/mediator/MessageField.java 0% <0%> (-100%) 0% <0%> (-3%)
...ua/service/datastore/internal/schema/Metadata.java 0% <0%> (-100%) 0% <0%> (-4%)
...pse/kapua/kura/simulator/GatewayConfiguration.java 0% <0%> (-100%) 0% <0%> (ø)
...e/datastore/internal/mediator/ClientInfoField.java 0% <0%> (-100%) 0% <0%> (-6%)
.../kapua/service/tag/internal/TagListResultImpl.java 0% <0%> (-100%) 0% <0%> (-1%)
... and 204 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d9ca1f...7ef2270. Read the comment docs.

@Coduz Coduz merged commit 1d44848 into eclipse-kapua:develop Feb 21, 2020
@lorthirk lorthirk deleted the change-shiroCorsFilter branch March 24, 2020 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug or an unexpected behaviour. Fix it! REST API We hope to REST everyday
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants