File tree 1 file changed +9
-4
lines changed
spring-security-modules/spring-security-oauth2-bff/angular-ui/src/app/auth
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -63,11 +63,16 @@ export class UserService {
63
63
: User . ANONYMOUS
64
64
) ;
65
65
}
66
- if ( ! ! user . exp ) {
66
+ if ( typeof user . exp === "number" && user . exp > 0 && user . exp < Number . MAX_SAFE_INTEGER / 1000 ) {
67
67
const now = Date . now ( ) ;
68
- const delay = ( 1000 * user . exp - now ) * 0.8 ;
69
- if ( delay > 2000 ) {
70
- this . refreshSub = interval ( delay ) . subscribe ( ( ) => this . refresh ( ) ) ;
68
+ const expMs = user . exp * 1000 ; // Convert expiration time to milliseconds safely
69
+
70
+ if ( expMs > now ) { // Ensure expiration is in the future
71
+ const delay = ( expMs - now ) * 0.8 ;
72
+
73
+ if ( delay > 2000 && delay < Number . MAX_SAFE_INTEGER ) {
74
+ this . refreshSub = interval ( delay ) . subscribe ( ( ) => this . refresh ( ) ) ;
75
+ }
71
76
}
72
77
}
73
78
} ,
You can’t perform that action at this time.
0 commit comments