oauth2

    스프링 Oauth2 Server jdbc 이용한 토큰 Access 토큰 로그인 마다 새롭게 발급 받기 (커스텀)

    토큰이 만료되었는지 체크해서 발급해주는 서비스인 TokenServices DefaultTokenServices를 상속받아서 CustomTokenServices 를 만들어줍니다. createAccessToken() 이 엑세스 토큰을 만들어 발급해주는 부분입니다. 기존 코드에는 isExpired()를 체크해서 만료되면 재발급해주는 방식입니다. 이 부분을 체크하지 않고 항상 새로 발급하도록 수정해주면 로그인 마다 매번 새로 발급되게 됩니다. package com.coupang.admin.server.coupang_admin_server.common.config; import org.springframework.security.core.AuthenticationException; import org.spring..

    스프링 시큐리티 Oauth2 커스텀 Exception 만들기

    @EnableAuthorizationServer public class OAuthConfig extends AuthorizationServerConfigurerAdapter { @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints. /* 다른 설정 부분 생략 */ .exceptionTranslator(authorizationWebResponseExceptionTranslator()); } public WebResponseExceptionTranslator authorizationWebResponseExceptionTranslator() { return new D..