Skip to content

Commit

Permalink
Google Java Format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Oct 6, 2023
1 parent 9eb25c6 commit 3c8b2cd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
"/v3/api-docs/**",
"/swagger-ui/**",
"/swagger-ui.html",
"auth/refresh","auth/save","auth/login")
"auth/refresh",
"auth/save",
"auth/login")
.permitAll())
.authorizeHttpRequests(
x -> x.requestMatchers("/test/**").permitAll().anyRequest().authenticated())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public MemberController(MemberService memberService) {
}

@GetMapping("/duplicate/{name}")
public ResponseEntity<DuplicateNicknameDto> duplicateNickname(@PathVariable String name){
public ResponseEntity<DuplicateNicknameDto> duplicateNickname(@PathVariable String name) {
return ResponseEntity.ok(memberService.duplicateNickname(name));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ public interface MemberRepository extends JpaRepository<Member, UUID> {
"SELECT m FROM Member m WHERE m.oAuth2Info.clientId = :oAuthId AND"
+ " m.oAuth2Info.authType = :authType")
Optional<Member> findByOAuthIdAndAuthType(String oAuthId, AuthType authType);


}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
import com.twtw.backend.domain.member.mapper.MemberMapper;
import com.twtw.backend.domain.member.repository.MemberRepository;
import com.twtw.backend.domain.member.repository.RefreshTokenRepository;

import com.twtw.backend.global.exception.EntityNotFoundException;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.rmi.server.UID;
import java.util.Optional;
import java.util.UUID;

Expand Down Expand Up @@ -122,14 +121,14 @@ public TokenDto saveRefreshToken(Authentication authentication, String userName)
return token;
}

public Member getMemberByJwt(){
public Member getMemberByJwt() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

UUID id = UUID.fromString(authentication.getName());
UUID id = UUID.fromString(authentication.getName());

Optional<Member> member = memberRepository.findById(id);

if(member.isPresent()){
if (member.isPresent()) {
return member.get();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.twtw.backend.domain.member.dto.response.DuplicateNicknameDto;
import com.twtw.backend.domain.member.entity.Member;
import com.twtw.backend.domain.member.repository.MemberRepository;

import com.twtw.backend.global.exception.EntityNotFoundException;

import org.springframework.stereotype.Service;

import java.util.Optional;
Expand All @@ -18,17 +18,17 @@ public MemberService(MemberRepository memberRepository) {
this.memberRepository = memberRepository;
}

public DuplicateNicknameDto duplicateNickname(String nickName){
public DuplicateNicknameDto duplicateNickname(String nickName) {
Optional<Member> member = memberRepository.findByNickname(nickName);

if(member.isPresent()){
if (member.isPresent()) {
return new DuplicateNicknameDto(true);
}

return new DuplicateNicknameDto(false);
}

public Member getMemberById(UUID id){
public Member getMemberById(UUID id) {
Member member = memberRepository.findById(id).orElseThrow(EntityNotFoundException::new);

return member;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ void saveMember() throws Exception {
// given
final AfterLoginDto expected =
new AfterLoginDto(
AuthStatus.SIGNIN, new TokenDto("access.token.value", "refresh.token.value"));
AuthStatus.SIGNIN,
new TokenDto("access.token.value", "refresh.token.value"));
given(authService.saveMember(any())).willReturn(expected);

// when
Expand Down Expand Up @@ -120,7 +121,8 @@ void afterSocialLogin() throws Exception {
// given
final AfterLoginDto expected =
new AfterLoginDto(
AuthStatus.SIGNIN, new TokenDto("access.token.value", "refresh.token.value"));
AuthStatus.SIGNIN,
new TokenDto("access.token.value", "refresh.token.value"));
given(authService.getTokenByOAuth(any())).willReturn(expected);

// when
Expand Down

0 comments on commit 3c8b2cd

Please sign in to comment.