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();
 | 
					        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(USER_ID, securityUser.getId().getId().toString());
 | 
				
			||||||
        claims.put(SCOPES, scopes);
 | 
					        claims.put(SCOPES, scopes);
 | 
				
			||||||
        if (securityUser.getSessionId() != null) {
 | 
					        if (securityUser.getSessionId() != null) {
 | 
				
			||||||
@ -204,7 +204,6 @@ public class JwtTokenFactory {
 | 
				
			|||||||
        try {
 | 
					        try {
 | 
				
			||||||
            return Jwts.parser()
 | 
					            return Jwts.parser()
 | 
				
			||||||
                    .setSigningKey(jwtSettingsService.getJwtSettings().getTokenSigningKey())
 | 
					                    .setSigningKey(jwtSettingsService.getJwtSettings().getTokenSigningKey())
 | 
				
			||||||
                    .build()
 | 
					 | 
				
			||||||
                    .parseClaimsJws(token);
 | 
					                    .parseClaimsJws(token);
 | 
				
			||||||
        } catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException ex) {
 | 
					        } catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException ex) {
 | 
				
			||||||
            log.debug("Invalid JWT Token", ex);
 | 
					            log.debug("Invalid JWT Token", ex);
 | 
				
			||||||
 | 
				
			|||||||
@ -40,7 +40,7 @@ public class OAuth2AppTokenFactory {
 | 
				
			|||||||
    public String validateTokenAndGetCallbackUrlScheme(String appPackage, String appToken, String appSecret) {
 | 
					    public String validateTokenAndGetCallbackUrlScheme(String appPackage, String appToken, String appSecret) {
 | 
				
			||||||
        Jws<Claims> jwsClaims;
 | 
					        Jws<Claims> jwsClaims;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            jwsClaims = Jwts.parser().setSigningKey(appSecret).build().parseClaimsJws(appToken);
 | 
					            jwsClaims = Jwts.parser().setSigningKey(appSecret).parseClaimsJws(appToken);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException | SignatureException ex) {
 | 
					        catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException | SignatureException ex) {
 | 
				
			||||||
            throw new IllegalArgumentException("Invalid Application token: ", ex);
 | 
					            throw new IllegalArgumentException("Invalid Application token: ", ex);
 | 
				
			||||||
 | 
				
			|||||||
@ -563,7 +563,7 @@ public abstract class AbstractWebTest extends AbstractInMemoryStorageTest {
 | 
				
			|||||||
        int i = token.lastIndexOf('.');
 | 
					        int i = token.lastIndexOf('.');
 | 
				
			||||||
        Assert.assertTrue(i > 0);
 | 
					        Assert.assertTrue(i > 0);
 | 
				
			||||||
        String withoutSignature = token.substring(0, i + 1);
 | 
					        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();
 | 
					        Claims claims = jwsClaims.getBody();
 | 
				
			||||||
        String subject = claims.getSubject();
 | 
					        String subject = claims.getSubject();
 | 
				
			||||||
        Assert.assertEquals(username, subject);
 | 
					        Assert.assertEquals(username, subject);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user