package com.icontrols.oauth.controller; import java.io.UnsupportedEncodingException; import java.security.GeneralSecurityException; import java.security.NoSuchAlgorithmException; import java.time.Duration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.icontrols.oauth.utils.JWTUtils; @RestController @RequestMapping(value = "/api/oauth2") public class ViewController { private static final Logger logger = LoggerFactory.getLogger(ViewController.class); @Autowired RedisTemplate redisTemplate; // redis 테스트 @RequestMapping(value = "/check", method = RequestMethod.GET) public String validTest(@RequestParam(value = "token", required = false) String token) throws UnsupportedEncodingException, NoSuchAlgorithmException, GeneralSecurityException { JWTUtils jwt = new JWTUtils(); Boolean bool = jwt.validateToken(token, "accessToken"); logger.info("validate :" + bool.toString()); String cmpIp = jwt.getCmpIpFromToken(token); logger.info("cmpIp :" + cmpIp); String homeId = jwt.getHomeIdFromToken(token); logger.info("homeId :" + homeId); return bool.toString(); } }