Skip to content

Commit

Permalink
feat : 인증 테스트용 API
Browse files Browse the repository at this point in the history
  • Loading branch information
ywj9811 committed Feb 5, 2025
1 parent 0f347b2 commit c536d9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,11 @@ public ResponseEntity regenerate(@AuthenticationPrincipal Admin admin, HttpServl
adminManageUseCase.regenerate(admin, request, response);
return ResponseEntity.ok().build();
}

@GetMapping("/test")
public ResponseEntity test(@AuthenticationPrincipal Admin admin) {
if (admin == null)
throw new IllegalArgumentException();
return ResponseEntity.ok("인증에 성공하였습니다.");
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.yedu.backend.global.config.security;

import com.yedu.backend.global.config.security.jwt.constant.Role;
import com.yedu.backend.global.config.security.jwt.filter.CustomAccessDeniedHandler;
import com.yedu.backend.global.config.security.jwt.filter.CustomAuthenticationEntryPoint;
import com.yedu.backend.global.config.security.jwt.filter.JwtFilter;
Expand Down Expand Up @@ -54,6 +55,7 @@ protected SecurityFilterChain config(HttpSecurity http) throws Exception {
.logout(logout -> logout.disable());
http
.authorizeHttpRequests(authorize -> authorize
.requestMatchers("/admin/test").hasAuthority(Role.ADMIN.name())
.anyRequest().permitAll()
)
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
Expand Down

0 comments on commit c536d9c

Please sign in to comment.