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 support for last active timestamp for identities #797

Closed sbryzak closed 5 years ago

sbryzak commented 5 years ago

This pull request adds a new timestamp column to the identities table:

ALTER TABLE identities ADD COLUMN last_active timestamp with time zone;

Upon any of the following the events, this timestamp will be updated to the current time:

Fixes #796

codecov[bot] commented 5 years ago

Codecov Report

Merging #797 into master will decrease coverage by 0.14%. The diff coverage is 48.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #797      +/-   ##
==========================================
- Coverage   78.67%   78.52%   -0.15%     
==========================================
  Files          94       94              
  Lines        8852     8882      +30     
==========================================
+ Hits         6964     6975      +11     
- Misses       1385     1392       +7     
- Partials      503      515      +12
Impacted Files Coverage Δ
...rovider/service/authentication_provider_service.go 72.89% <0%> (-1.15%) :arrow_down:
authorization/token/service/token_service.go 72.74% <100%> (-1%) :arrow_down:
migration/migration.go 65.86% <100%> (+0.2%) :arrow_up:
authentication/account/repository/identity.go 76.74% <40%> (-0.73%) :arrow_down:
authentication/logout/service/logout_service.go 52.45% <41.66%> (-1.25%) :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 79d8f98...8c9b4fa. Read the comment docs.

alexeykazakov commented 5 years ago

Upon any of the following the events, this timestamp will be updated to the current time

I was thinking of updating such a timestamp in our JWT middleware. Basically if there is a user token used in any request then we mark it as user activity. Token refresh still needs to be handled separately because it doesn't require a user token in the header.