Revert "Jwts.parser().build() refactored for a newer version"
This reverts commit 1f5c95a375ab694ff08709cf9096dd773e0b90c7.
This commit is contained in:
parent
df08a94bee
commit
bdf9da8bab
@ -183,7 +183,7 @@ public class JwtTokenFactory {
|
||||
|
||||
UserPrincipal principal = securityUser.getUserPrincipal();
|
||||
|
||||
Claims claims = Jwts.claims().setSubject(principal.getValue()).build();
|
||||
Claims claims = Jwts.claims().setSubject(principal.getValue());
|
||||
claims.put(USER_ID, securityUser.getId().getId().toString());
|
||||
claims.put(SCOPES, scopes);
|
||||
if (securityUser.getSessionId() != null) {
|
||||
@ -204,7 +204,6 @@ public class JwtTokenFactory {
|
||||
try {
|
||||
return Jwts.parser()
|
||||
.setSigningKey(jwtSettingsService.getJwtSettings().getTokenSigningKey())
|
||||
.build()
|
||||
.parseClaimsJws(token);
|
||||
} catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException ex) {
|
||||
log.debug("Invalid JWT Token", ex);
|
||||
|
||||
@ -40,7 +40,7 @@ public class OAuth2AppTokenFactory {
|
||||
public String validateTokenAndGetCallbackUrlScheme(String appPackage, String appToken, String appSecret) {
|
||||
Jws<Claims> jwsClaims;
|
||||
try {
|
||||
jwsClaims = Jwts.parser().setSigningKey(appSecret).build().parseClaimsJws(appToken);
|
||||
jwsClaims = Jwts.parser().setSigningKey(appSecret).parseClaimsJws(appToken);
|
||||
}
|
||||
catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException | SignatureException ex) {
|
||||
throw new IllegalArgumentException("Invalid Application token: ", ex);
|
||||
|
||||
@ -563,7 +563,7 @@ public abstract class AbstractWebTest extends AbstractInMemoryStorageTest {
|
||||
int i = token.lastIndexOf('.');
|
||||
Assert.assertTrue(i > 0);
|
||||
String withoutSignature = token.substring(0, i + 1);
|
||||
Jwt<Header, Claims> jwsClaims = Jwts.parser().build().parseClaimsJwt(withoutSignature);
|
||||
Jwt<Header, Claims> jwsClaims = Jwts.parser().parseClaimsJwt(withoutSignature);
|
||||
Claims claims = jwsClaims.getBody();
|
||||
String subject = claims.getSubject();
|
||||
Assert.assertEquals(username, subject);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user