chore: 사용하지 않는 패키지 정리

This commit is contained in:
liquidjoo
2020-08-04 14:10:10 +09:00
parent 6457af3084
commit f83a3ab606
15 changed files with 49 additions and 64 deletions

View File

@@ -2,10 +2,6 @@ package io.bluemoon.authorizationserver;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import java.util.Date;
@SpringBootApplication @SpringBootApplication
public class AuthorizationServerApplication { public class AuthorizationServerApplication {

View File

@@ -1,11 +1,10 @@
package io.bluemoon.authorizationserver.config; package io.bluemoon.authorizationserver.config;
import io.bluemoon.authorizationserver.service.user.CustomUserDetailsServiceImpl; import io.bluemoon.authorizationserver.service.user.CustomUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
@@ -21,10 +20,8 @@ import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeSe
import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.security.KeyPair;
@@ -47,7 +44,7 @@ public class OAuth2SsoServerConfig extends AuthorizationServerConfigurerAdapter
private ClientDetailsService clientDetailsService; private ClientDetailsService clientDetailsService;
private AuthenticationManager authenticationManager; private AuthenticationManager authenticationManager;
private DataSource dataSource; private DataSource dataSource;
private CustomUserDetailsServiceImpl customUserDetailsService; private CustomUserDetailsService customUserDetailsService;
public OAuth2SsoServerConfig( public OAuth2SsoServerConfig(
// AuthorizationCodeServices authorizationCodeServices, // AuthorizationCodeServices authorizationCodeServices,
@@ -55,7 +52,7 @@ public class OAuth2SsoServerConfig extends AuthorizationServerConfigurerAdapter
ClientDetailsService clientDetailsService, ClientDetailsService clientDetailsService,
AuthenticationManager authenticationManager, AuthenticationManager authenticationManager,
DataSource dataSource, DataSource dataSource,
CustomUserDetailsServiceImpl customUserDetailsService CustomUserDetailsService customUserDetailsService
) { ) {
// this.authorizationCodeServices = authorizationCodeServices; // this.authorizationCodeServices = authorizationCodeServices;
// this.approvalStore = approvalStore; // this.approvalStore = approvalStore;
@@ -78,6 +75,7 @@ public class OAuth2SsoServerConfig extends AuthorizationServerConfigurerAdapter
* OAuth2 서버가 작동하기 위한 Endpoint에 대한 정보를 설정 * OAuth2 서버가 작동하기 위한 Endpoint에 대한 정보를 설정
* 권한 부여 및 토큰 엔드 포인트와 토큰 서비스를 설정. * 권한 부여 및 토큰 엔드 포인트와 토큰 서비스를 설정.
* AuhorizationEndpoint가 지원하는 부여 유형을 정할 수 있음. * AuhorizationEndpoint가 지원하는 부여 유형을 정할 수 있음.
*
* @param endpoints * @param endpoints
* @throws Exception * @throws Exception
*/ */
@@ -108,6 +106,7 @@ public class OAuth2SsoServerConfig extends AuthorizationServerConfigurerAdapter
* 클라리언트 세부 사항 서비스의 메모리 내 or JDBC구현을 정의 * 클라리언트 세부 사항 서비스의 메모리 내 or JDBC구현을 정의
* JdbcClientDetailsService를 활용해 데이터베이스 테이블로 세부 정보를 업데이트 가능 * JdbcClientDetailsService를 활용해 데이터베이스 테이블로 세부 정보를 업데이트 가능
* AuthorizationServerConfigurer의 콜백 * AuthorizationServerConfigurer의 콜백
*
* @param clients * @param clients
* @throws Exception * @throws Exception
*/ */
@@ -123,6 +122,7 @@ public class OAuth2SsoServerConfig extends AuthorizationServerConfigurerAdapter
* 액세스 토큰을 만들 때 액세스 토콘을 수락하는 리소스가 나중에 참조 할 수 있도록 인증을 저장해야함 * 액세스 토큰을 만들 때 액세스 토콘을 수락하는 리소스가 나중에 참조 할 수 있도록 인증을 저장해야함
* 액세스 토콘을 생성 권한 부여에 사용 된 인증을 로드하는데 사용됨. * 액세스 토콘을 생성 권한 부여에 사용 된 인증을 로드하는데 사용됨.
* 서버간에 데이터베이스를 공유 할 수 있는 경우!! * 서버간에 데이터베이스를 공유 할 수 있는 경우!!
*
* @param dataSource * @param dataSource
* @return * @return
*/ */

View File

@@ -4,7 +4,6 @@ package io.bluemoon.authorizationserver.config;
import io.bluemoon.authorizationserver.config.handler.CustomAccessDeniedHandler; import io.bluemoon.authorizationserver.config.handler.CustomAccessDeniedHandler;
import io.bluemoon.authorizationserver.config.handler.CustomHttp403ForbiddenEntryPoint; import io.bluemoon.authorizationserver.config.handler.CustomHttp403ForbiddenEntryPoint;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;

View File

@@ -6,7 +6,6 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.web.filter.ForwardedHeaderFilter; import org.springframework.web.filter.ForwardedHeaderFilter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;

View File

@@ -1,7 +1,7 @@
package io.bluemoon.authorizationserver.config; package io.bluemoon.authorizationserver.config;
import io.bluemoon.authorizationserver.config.handler.CustomAuthFailureHandler; import io.bluemoon.authorizationserver.config.handler.CustomAuthFailureHandler;
import io.bluemoon.authorizationserver.service.user.CustomUserDetailsServiceImpl; import io.bluemoon.authorizationserver.service.user.CustomUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@@ -14,15 +14,10 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.security.web.csrf.CsrfFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.web.filter.CharacterEncodingFilter;
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client;
@Configuration @Configuration
@EnableWebSecurity @EnableWebSecurity
@@ -32,18 +27,25 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired @Autowired
CustomAuthFailureHandler customAuthFailureHandler; CustomAuthFailureHandler customAuthFailureHandler;
private CustomUserDetailsServiceImpl customUserDetailsService; private CustomUserDetailsService customUserDetailsService;
public WebSecurityConfig( public WebSecurityConfig(
CustomUserDetailsServiceImpl customUserDetailsService CustomUserDetailsService customUserDetailsService
) { ) {
this.customUserDetailsService = customUserDetailsService; this.customUserDetailsService = customUserDetailsService;
} }
@Bean
public static PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
/** /**
* authentication processing * authentication processing
* if success -> Authentication in info object return * if success -> Authentication in info object return
* els fail -> Exception * els fail -> Exception
* impl 구현체 -> authentication provider 에서 구현해서 authentication object를 던져줌 * impl 구현체 -> authentication provider 에서 구현해서 authentication object를 던져줌
*
* @return AuthenticationManager * @return AuthenticationManager
* @throws Exception * @throws Exception
*/ */
@@ -59,7 +61,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
// --------------------------------- sso test // --------------------------------- sso test
http.formLogin().loginPage("/login").permitAll().failureHandler(customAuthFailureHandler) http.formLogin().loginPage("/login").permitAll().failureHandler(customAuthFailureHandler)
.and() .and()
.requestMatchers().antMatchers("/login/**","/oauth/authorize") .requestMatchers().antMatchers("/login/**", "/oauth/authorize")
.and() .and()
.authorizeRequests().anyRequest().authenticated() .authorizeRequests().anyRequest().authenticated()
.and() .and()
@@ -72,7 +74,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
} }
/** /**
* authentication Object managing * authentication Object managing
* *
@@ -84,6 +85,12 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
auth.authenticationProvider(daoAuthenticationProvider()); auth.authenticationProvider(daoAuthenticationProvider());
} }
// @Bean
// @SuppressWarnings("deprecation")
// public static NoOpPasswordEncoder passwordEncoder() {
// return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
// }
/** /**
* user info at database for make authentication object * user info at database for make authentication object
* *
@@ -97,17 +104,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
return daoAuthenticationProvider; return daoAuthenticationProvider;
} }
// @Bean
// @SuppressWarnings("deprecation")
// public static NoOpPasswordEncoder passwordEncoder() {
// return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
// }
@Bean
public static PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
// social login // social login
// @Bean // @Bean

View File

@@ -29,6 +29,6 @@ public class CustomOAuthExceptionSerializer extends StdSerializer<CustomOAuthExc
gen.writeStringField(key, add); gen.writeStringField(key, add);
} }
} }
gen.writeEndObject();; gen.writeEndObject();
} }
} }

View File

@@ -7,7 +7,10 @@ import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices; import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices;
import org.springframework.security.oauth2.provider.token.ConsumerTokenServices; import org.springframework.security.oauth2.provider.token.ConsumerTokenServices;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -57,7 +60,7 @@ public class SsoController {
httpSession.invalidate(); httpSession.invalidate();
Cookie[] cookies = request.getCookies(); Cookie[] cookies = request.getCookies();
if (cookies != null) { if (cookies != null) {
for (Cookie cookie: cookies) { for (Cookie cookie : cookies) {
cookie.setPath("/"); cookie.setPath("/");
cookie.setSecure(true); cookie.setSecure(true);
cookie.setMaxAge(0); cookie.setMaxAge(0);
@@ -69,9 +72,6 @@ public class SsoController {
} }
// @GetMapping(value = "/{facebook|google|kakao}/complete") // @GetMapping(value = "/{facebook|google|kakao}/complete")
// public String loginComplete(HttpSession session) { // public String loginComplete(HttpSession session) {
// OAuth2Authentication authentication = (OAuth2Authentication) SecurityContextHolder.getContext().getAuthentication(); // OAuth2Authentication authentication = (OAuth2Authentication) SecurityContextHolder.getContext().getAuthentication();

View File

@@ -1,7 +1,6 @@
package io.bluemoon.authorizationserver.domain.oauth.accesstoken; package io.bluemoon.authorizationserver.domain.oauth.accesstoken;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;

View File

@@ -1,7 +1,5 @@
package io.bluemoon.authorizationserver.domain.social; package io.bluemoon.authorizationserver.domain.social;
import lombok.Getter;
public enum SocialType { public enum SocialType {
FACEBOOK("facebook"), FACEBOOK("facebook"),
GOOGLE("google"), GOOGLE("google"),

View File

@@ -12,7 +12,6 @@ import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken; import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.support.WebDataBinderFactory; import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
@@ -58,6 +57,7 @@ public class UserArgumentResolver implements HandlerMethodArgumentResolver {
/** /**
* 인증된 User 객체를 만드는 메인 메서드 * 인증된 User 객체를 만드는 메인 메서드
*
* @param user * @param user
* @param session * @param session
* @return * @return
@@ -104,6 +104,7 @@ public class UserArgumentResolver implements HandlerMethodArgumentResolver {
/** /**
* 사용자의 인증된 소셜 미디어 타입에 따라 빌더를 사용하여 User 객체를 만들어 주는 가교 역할 * 사용자의 인증된 소셜 미디어 타입에 따라 빌더를 사용하여 User 객체를 만들어 주는 가교 역할
*
* @param authority * @param authority
* @param map * @param map
* @return * @return
@@ -117,6 +118,7 @@ public class UserArgumentResolver implements HandlerMethodArgumentResolver {
/** /**
* 페이스북이나 구글 같이 공통되는 명명규칙을 가진 그룹을 맵핑 * 페이스북이나 구글 같이 공통되는 명명규칙을 가진 그룹을 맵핑
*
* @param socialType * @param socialType
* @param map * @param map
* @return * @return
@@ -156,6 +158,7 @@ public class UserArgumentResolver implements HandlerMethodArgumentResolver {
/** /**
* 인증된 authentication이 권한을 갖고 있는지 체크하는 용도 * 인증된 authentication이 권한을 갖고 있는지 체크하는 용도
* 만약 저장된 User 권한이 없으면 SecurityContextHolder를 사용하여 해당 소셜미디어 타입으로 권한을 저장 * 만약 저장된 User 권한이 없으면 SecurityContextHolder를 사용하여 해당 소셜미디어 타입으로 권한을 저장
*
* @param user * @param user
* @param authentication * @param authentication
* @param map * @param map

View File

@@ -1,6 +1,5 @@
package io.bluemoon.authorizationserver.domain.user; package io.bluemoon.authorizationserver.domain.user;
import io.bluemoon.authorizationserver.domain.social.SocialType;
import lombok.Data; import lombok.Data;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
@@ -29,7 +28,7 @@ public class CustomUserDetails implements UserDetails {
@Override @Override
public Collection<? extends GrantedAuthority> getAuthorities() { public Collection<? extends GrantedAuthority> getAuthorities() {
List<GrantedAuthority> authorities = new ArrayList<>(); List<GrantedAuthority> authorities = new ArrayList<>();
for (String role: userRole) { for (String role : userRole) {
authorities.add(new SimpleGrantedAuthority(role)); authorities.add(new SimpleGrantedAuthority(role));
} }
return authorities; return authorities;

View File

@@ -6,7 +6,6 @@ import lombok.*;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection; import java.util.Collection;
import java.util.Date;
@Entity @Entity
@Getter @Getter
@@ -47,7 +46,6 @@ public class User {
private LocalDateTime updatedAt; private LocalDateTime updatedAt;
// //1:수퍼관리자, 2:관리자, 3:사용자 // //1:수퍼관리자, 2:관리자, 3:사용자
// @Column // @Column
// private String userType; // private String userType;

View File

@@ -1,9 +1,9 @@
package io.bluemoon.authorizationserver.domain.user; package io.bluemoon.authorizationserver.domain.user;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
public interface UserRepository extends JpaRepository<User, Long> { public interface UserRepository extends JpaRepository<User, Long> {
User findByUsername(String username); User findByUsername(String username);
User findByEmail(String email); User findByEmail(String email);
} }

View File

@@ -9,6 +9,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.math.BigInteger; import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.HashMap; import java.util.HashMap;
@@ -17,11 +18,11 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
@Service @Service
public class SsoServiceImpl implements SsoService{ public class DefaultSsoService implements SsoService {
private AccessTokenRepository accessTokenRepository; private AccessTokenRepository accessTokenRepository;
private ClientRepository clientRepository; private ClientRepository clientRepository;
public SsoServiceImpl( public DefaultSsoService(
AccessTokenRepository accessTokenRepository, AccessTokenRepository accessTokenRepository,
ClientRepository clientRepository ClientRepository clientRepository
) { ) {
@@ -44,13 +45,11 @@ public class SsoServiceImpl implements SsoService{
try { try {
MessageDigest digest = MessageDigest.getInstance("MD5"); MessageDigest digest = MessageDigest.getInstance("MD5");
byte[] bytes = digest.digest(value.getBytes("UTF-8")); byte[] bytes = digest.digest(value.getBytes(StandardCharsets.UTF_8));
return String.format("%032x", new BigInteger(1, bytes)); return String.format("%032x", new BigInteger(1, bytes));
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("MD5 algorithm not avilable. Fatal (should be in the JDK)."); throw new IllegalStateException("MD5 algorithm not avilable. Fatal (should be in the JDK).");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 encoding not available. Fatal (should be in the JDK).");
} }
} }

View File

@@ -7,17 +7,16 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@Service @Service
public class CustomUserDetailsServiceImpl implements UserDetailsService { public class CustomUserDetailsService implements UserDetailsService {
// User Info // User Info
private UserRepository userRepository; private UserRepository userRepository;
private UserRoleRepository userRoleRepository; private UserRoleRepository userRoleRepository;
public CustomUserDetailsServiceImpl( public CustomUserDetailsService(
UserRepository userRepository, UserRepository userRepository,
UserRoleRepository userRoleRepository UserRoleRepository userRoleRepository
) { ) {
@@ -27,7 +26,7 @@ public class CustomUserDetailsServiceImpl implements UserDetailsService {
@Override @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
System.out.println("why?????????????"+username); System.out.println("why?????????????" + username);
User user = userRepository.findByUsername(username); User user = userRepository.findByUsername(username);
System.out.println(user); System.out.println(user);
List<UserRole> userRole = userRoleRepository.findByUser(user); List<UserRole> userRole = userRoleRepository.findByUser(user);