fabric8-services / fabric8-auth

Identity and Access Management for fabric8 services
https://auth.openshift.io/api/status
Apache License 2.0
14 stars 26 forks source link

add worker to cleanup old OAuth State References #866

Closed xcoulon closed 4 years ago

xcoulon commented 4 years ago

The worker is configured to run every hour (configurable) and delete all OAuth state references older than 24hrs (hard-coded).

The worker is based on the same implementation as the other workers (for user deactivation) and thus runs in a go routine and uses a lock to prevent concurrent executions (although, in this case, it's not a big deal)

Also, include a migration step to remove all OAuth state refs older than 24hrs during startup, using a DB migration script.

Fixes https://issues.redhat.com/browse/CRT-539

Signed-off-by: Xavier Coulon xcoulon@redhat.com

codecov[bot] commented 4 years ago

Codecov Report

Merging #866 into master will decrease coverage by 0.10%. The diff coverage is 60.60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #866      +/-   ##
==========================================
- Coverage   78.46%   78.35%   -0.11%     
==========================================
  Files         100      101       +1     
  Lines        9443     9499      +56     
==========================================
+ Hits         7409     7443      +34     
- Misses       1494     1512      +18     
- Partials      540      544       +4     
Impacted Files Coverage Δ
authentication/provider/repository/state.go 45.71% <28.57%> (-1.91%) :arrow_down:
configuration/configuration.go 81.25% <33.33%> (-0.66%) :arrow_down:
...entication/provider/worker/state_cleanup_worker.go 78.94% <78.94%> (ø)
migration/migration.go 67.61% <100.00%> (+0.18%) :arrow_up:
...rovider/service/authentication_provider_service.go 65.78% <0.00%> (-7.55%) :arrow_down:

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 f63d718...d273a1f. Read the comment docs.

xcoulon commented 4 years ago

Very nice!

thanks ;)