Skip to content

Conversation

@roberlander2
Copy link
Contributor

Description

This PR adds a refresh grace period policy to app org login session settings. If the previous refresh token is used to attempt a login session refresh within the grace period defined by the policy, now the refresh attempt will succeed.

Resolves #811

Review Time Estimate

Please give your idea of how soon this pull request needs to be reviewed by selecting one of the options below. This can be based on the criticality of the issue at hand and/or other relevant factors.

  • Immediately
  • Within a week
  • When possible

Type of changes

Please select a relevant option:

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • Other (any another change that does not fall in one of the above categories.)

Checklist:

Please select all applicable options:

  • I have signed the Rokwire Contributor License Agreement (CLA). (Any contributor who is not an employee of the University of Illinois whose official duties include contributing to the Rokwire software, or who is not paid by the Rokwire project, needs to sign the CLA before their contribution can be accepted.)
  • I have updated the CHANGELOG.
  • I have read the Contributor Guidelines.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My change requires updating the documentation.
  • I have made necessary changes to the documentation.
  • I have added tests related to my changes.
  • My changes generate no new warnings.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

@roberlander2 roberlander2 self-assigned this Oct 21, 2025
@roberlander2 roberlander2 linked an issue Oct 21, 2025 that may be closed by this pull request
Copy link
Collaborator

@shurwit shurwit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @roberlander2 looks good! Just a couple of minor comments below!

Copy link
Collaborator

@petyos petyos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roberlander2, @shurwit , this seems like the right approach.
Just a quick note - let’s make sure we also keep the system APIs for create (and especially update) for the application organization up to date, because we recently had an issue where the update API did not reflect the FERPA record, and each call to it was resetting that FERPA field.
Thanks both.

@roberlander2
Copy link
Contributor Author

Thanks @roberlander2 looks good! Just a couple of minor comments below!

Thanks @shurwit I made some additional changes to address the issues you pointed out.

@roberlander2 roberlander2 requested a review from shurwit October 29, 2025 16:37
Copy link
Collaborator

@shurwit shurwit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @roberlander2, this is looking better! Just a couple more questions below.

Comment on lines 32 to 34
if err != nil {
return l.HTTPResponseErrorData(logutils.StatusMissing, model.TypeRefreshToken, nil, err, http.StatusInternalServerError, false)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any risk to adding this check here?

Previously if the login session doesn't have a refresh token we would just send back an empty string in the response, but still send back the other tokens. Now we will return an error instead.

Are there any cases where we don't provide a refresh token (eg. anonymous auth, some setting to disable refresh on app org... etc.)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked on this and the only case where there would be no refresh token here is if we are returning a login session in the MFA state, so I added an additional check for this.

@roberlander2 roberlander2 requested a review from shurwit November 5, 2025 17:12
Copy link
Collaborator

@petyos petyos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. There was just one place where the grace period for the app/org’s API wasn’t set. I added it. Thanks!

@petyos petyos merged commit 7a4c91d into develop Nov 10, 2025
2 checks passed
@petyos petyos deleted the 811-implement-refresh-token-reuse-detection-grace-period branch November 10, 2025 11:32

return nil, nil
return nil, nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @petyos @roberlander2 , just realized that we should probably add some logging here to have a record in the logs when a previous refresh token is used, but is allowed to continue due to the grace period. This will help us evaluate the impact of this change and ensure there aren't any issues resulting from it.

stefanvit pushed a commit that referenced this pull request Nov 14, 2025
…n-accounts

* main:
  update version the version to 1.60.1
  [ID-814] Improve refresh token grace period logging (#815)
  update version to 1.60.0
  [#811] Implement refresh token reuse detection grace period (#812)

# Conflicts:
#	.secrets.baseline
#	CHANGELOG.md
roberlander2 added a commit to rokmetro/core-building-block-fork that referenced this pull request Nov 17, 2025
…okwire#812)

* add refresh grace period [rokwire#811]

* only allow the previous refresh token to be used in the grace period [rokwire#811]

* change grace period from minutes to seconds, return error on missing current or previous refresh token [rokwire#811]

* better error handling [rokwire#811]

* fix secrets

* Set grace period policy in the api when get data

---------

Co-authored-by: Petyo Stoyanov <petyo.stoyanov@inabit.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Implement refresh token reuse detection grace period

4 participants