Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Commit

Permalink
[#163] feat: spring security 에 어드민 관련 설정을 추가한다
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDevLuffy committed May 22, 2020
1 parent 69fcace commit 9db3248
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ protected void configure(HttpSecurity http) throws Exception {
.antMatchers("/", "/login", "/oauth2/authorization/**", "/static/**").permitAll()

.antMatchers("/api/librarybook/**").hasAuthority(AdminRole.ROLE_ADMIN.name())
.antMatchers("/api/admin/**").hasAuthority(AdminRole.ROLE_ADMIN.name())

.anyRequest().authenticated()
.and().logout().logoutSuccessUrl("/").invalidateHttpSession(true)
.and().oauth2Login().userInfoEndpoint().userService(userSecurityService);

if (environment.acceptsProfiles(Profiles.of("local"))) {
if (environment.acceptsProfiles(Profiles.of("local"))
|| environment.acceptsProfiles(Profiles.of("localdev"))) {
http.oauth2Login()
.defaultSuccessUrl(DEVELOP_ORIGIN)
.loginPage(DEVELOP_ORIGIN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public Admin extract(OAuth2User oAuth2User) {
Admin admin = adminRepository.findByEmail(email)
.orElseThrow(() -> new IllegalArgumentException("등록된 유저가 아닙니다."));

return admin.updateUserInfo(name, picture);
return adminRepository.save(admin.updateUserInfo(name, picture));
}
}

0 comments on commit 9db3248

Please sign in to comment.