Skip to content

Commit 76135ce

Browse files
committed
pass in both the encoded and decoded version of the JWT to retrieveUserForJWT
1 parent 0afa163 commit 76135ce

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

build.savant

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ logbackVersion = "1.4.14"
2929
slf4jVersion = "2.0.13"
3030
testngVersion = "7.8.0"
3131

32-
project(group: "org.primeframework", name: "prime-mvc", version: "4.35.1", licenses: ["ApacheV2_0"]) {
32+
project(group: "org.primeframework", name: "prime-mvc", version: "4.36.0", licenses: ["ApacheV2_0"]) {
3333
workflow {
3434
fetch {
3535
// Dependency resolution order:

src/main/java/org/primeframework/mvc/security/BaseJWTRefreshTokenCookiesUserLoginSecurityContext.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public Object getCurrentUser() {
9898
return null;
9999
}
100100

101-
user = retrieveUserForJWT(tokens.jwt);
101+
user = retrieveUserForJWT(tokens.decodedJWT, tokens.jwt);
102102
if (user == null) {
103103
jwtCookie.delete(request, response);
104104
} else {
@@ -207,12 +207,13 @@ protected boolean isRevoked(@SuppressWarnings("unused") JWT jwt) {
207207
protected abstract String refreshTokenCookieName();
208208

209209
/**
210-
* Retrieve a user given an encoded JWT string.
210+
* Retrieve a user with the encoded JWT string or the decoded JWT object.
211211
*
212-
* @param jwt the encoded JWT string
212+
* @param decodedJWT the decoded JWT object
213+
* @param jwt the encoded JWT string
213214
* @return a user object.
214215
*/
215-
protected abstract Object retrieveUserForJWT(String jwt);
216+
protected abstract Object retrieveUserForJWT(JWT decodedJWT, String jwt);
216217

217218
/**
218219
* The JWT that is passed to this method is known to be valid. The signature has been validated, and the JWT is not expired.

src/test/java/org/primeframework/mvc/security/MockOAuthUserLoginSecurityContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import java.util.List;
2121
import java.util.Map;
2222
import java.util.Set;
23-
import java.util.UUID;
2423

2524
import com.google.inject.Inject;
2625
import io.fusionauth.http.server.HTTPRequest;
2726
import io.fusionauth.http.server.HTTPResponse;
27+
import io.fusionauth.jwt.domain.JWT;
2828
import org.primeframework.mvc.security.oauth.OAuthConfiguration;
2929
import org.primeframework.mvc.security.oauth.TokenAuthenticationMethod;
3030
import org.primeframework.mvc.security.oauth.Tokens;
@@ -111,7 +111,7 @@ protected String refreshTokenCookieName() {
111111
}
112112

113113
@Override
114-
protected Object retrieveUserForJWT(String jwt) {
114+
protected Object retrieveUserForJWT(JWT decodedJWT, String jwt) {
115115
return CurrentUser;
116116
}
117117
}

0 commit comments

Comments
 (0)