Commit 4a412e7
authored
Use expirationDurationInSeconds for token refresh window (#243)
The 55-minute refresh window was hardcoded inline in `nextValidToken` while the
named `expirationDurationInSeconds` constant sat unused — so changing the
constant silently had no effect. Reference the constant directly so it is the
single source of truth.
Also strengthen the token-manager tests:
- `testTokenReusedJustBeforeBoundaryAndRefreshedAtBoundary` pins the `[0, 55min)`
reuse window at the exact boundary.
- `testRefreshedTokenIsStructurallyValid` decodes the refreshed JWT and asserts
the header/claims, rather than relying solely on string inequality (ECDSA
signatures are randomized, so a different string alone proves little).1 parent 356534b commit 4a412e7
2 files changed
Lines changed: 46 additions & 2 deletions
File tree
- Sources/APNSCore
- Tests/APNSTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
109 | 153 | | |
110 | 154 | | |
111 | 155 | | |
| |||
0 commit comments