Skip to content

Commit 1bd9846

Browse files
committed
The isLoggedIn() method now makes sure that a jwt is in place and valid, before determining if you are logged in or not.
1 parent bc64156 commit 1bd9846

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
### Added
1818

19+
* The `isLoggedIn()` method now makes sure that a jwt is in place and valid, before determining if you are logged in or not.
1920
* Migrated all automated tests to `focal` and `mysql8` in preparation for latest updates
2021
* Add support for JSON/XML/model rules source when loading rules from modules. Each module can now load rules not only inline but from the documented external sources.
2122
* Ensure non-configured `rules` default to empty array

models/jwt/JwtService.cfc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ component accessors="true" singleton {
166166
* Shortcut function to our authentication services to check if we are logged in
167167
*/
168168
boolean function isLoggedIn(){
169+
// We try to authenticate because we need the JWT to be validated for the request
170+
// There are ocassions where the user could have logged out but the token is still active
171+
// Or the inverse, where there is no more token passed and user still logged in in session.
172+
try{
173+
authenticate();
174+
} catch( any e ){
175+
return false;
176+
}
177+
169178
return variables.cbSecurity.getAuthService().isLoggedIn();
170179
}
171180

0 commit comments

Comments
 (0)