Subversion Repositories SmartDukaan

Rev

Rev 23780 | Rev 23801 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23780 Rev 23800
Line 76... Line 76...
76
	}
76
	}
77
	
77
	
78
	public static boolean isExpired(String token)
78
	public static boolean isExpired(String token)
79
		throws ProfitMandiBusinessException{
79
		throws ProfitMandiBusinessException{
80
		DecodedJWT decodedJWT = parse(token);
80
		DecodedJWT decodedJWT = parse(token);
-
 
81
		Map<String, Claim> claims = decodedJWT.getClaims();
-
 
82
		if(claims.containsKey(USER_ID)){
-
 
83
			final Claim roleIdsClaim = claims.get(ProfitMandiConstants.ROLE_IDS);
-
 
84
			if(roleIdsClaim.isNull()) {
-
 
85
				return true;
-
 
86
			}
-
 
87
		}
81
		Instant expireTime = decodedJWT.getExpiresAt().toInstant();
88
		Instant expireTime = decodedJWT.getExpiresAt().toInstant();
82
		Instant currentTime = Instant.now();
89
		Instant currentTime = Instant.now();
83
		//LOGGER.info("Checking token Expire time of token {} with currentTime {}, expireTime {}", token, currentTime, expireTime);
90
		//LOGGER.info("Checking token Expire time of token {} with currentTime {}, expireTime {}", token, currentTime, expireTime);
84
		if(currentTime.toEpochMilli() > expireTime.toEpochMilli()){
91
		if(currentTime.toEpochMilli() > expireTime.toEpochMilli()){
85
			return true;
92
			return true;