File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,23 @@ public void validateWhenConfiguredWithFixedClockThenValidatesUsingFixedTime() {
129
129
130
130
@ Test
131
131
public void validateWhenNeitherExpiryNorNotBeforeIsSpecifiedThenReturnsSuccessfulResult () {
132
+ Jwt jwt = TestJwts .jwt ().claims ((c ) -> {
133
+ c .remove (JwtClaimNames .EXP );
134
+ c .remove (JwtClaimNames .NBF );
135
+ }).build ();
136
+ JwtTimestampValidator jwtValidator = new JwtTimestampValidator ();
137
+ assertThat (jwtValidator .validate (jwt ).hasErrors ()).isFalse ();
138
+ }
139
+
140
+ @ Test
141
+ public void validateWhenExpiryIsSpecifiedThenReturnsSuccessfulResult () {
142
+ Jwt jwt = TestJwts .jwt ().claims ((c ) -> c .remove (JwtClaimNames .EXP )).build ();
143
+ JwtTimestampValidator jwtValidator = new JwtTimestampValidator ();
144
+ assertThat (jwtValidator .validate (jwt ).hasErrors ()).isFalse ();
145
+ }
146
+
147
+ @ Test
148
+ public void validateWhenNotBeforeIsSpecifiedThenReturnsSuccessfulResult () {
132
149
Jwt jwt = TestJwts .jwt ().claims ((c ) -> c .remove (JwtClaimNames .EXP )).build ();
133
150
JwtTimestampValidator jwtValidator = new JwtTimestampValidator ();
134
151
assertThat (jwtValidator .validate (jwt ).hasErrors ()).isFalse ();
You can’t perform that action at this time.
0 commit comments