inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링 프레임워크는 내 손에 [스프1탄]

82.추가 보충 설명하기(SimpleGrantedAuthority)

UsernamePasswordAuthenticationToken 생성에 대해서 질문이 있습니다.

해결된 질문

222

신민기는위대해요

작성한 질문수 3

0

새로운 Authentication 생성시에,

public Authentication createNewAuthentication(Authentication currentAuth, String username) {
UserDetails newPrincipal = this.loadUserByUsername(username);
UsernamePasswordAuthenticationToken newAuth = new UsernamePasswordAuthenticationToken(newPrincipal, currentAuth.getCredentials(), newPrincipal.getAuthorities());
newAuth.setDetails(currentAuth.getDetails());
return newAuth;
}

위 코드에 관하여 질문드립니다.
currentAuth.getCredentials()는 현재 SecurityContext에 있는 Authentication의 비밀번호를 가져와서 newAuth생성에 쓰임으로 알고있는데요.
이 때, 비밀번호를 수정한 경우에는..
newPrincipal.getCredentials() 라고 고친 메서드를 써야할까요?
아니면 Authentication을 바꿔서 유지해주기보다
로그아웃시켜서 다시 로그인해주는 방식이 옳을까요?

jsp spring mvc spring-security

답변 1

1

박매일

이런 경우는 기존 세션을 끊고 로그아웃을 시킨 후 다시 로그인을 해주는 것이 더 좋을듯하겠습니다.

재생이 안되요

0

113

0

404 HTTP 상태 코드

0

164

2

lombok api 등록 후

0

174

2

@RequestBody에 관해서 질문이요.

0

181

1

MVC06에 회원정보수정, 이미지등록수정 강의 영상이 없습니다

2

207

1

namespace 칸이 없습니다.

0

279

2

프로젝트 생성시 Srping MVC Project 없음

0

354

1

spring security 이후 Spring MVC06

0

222

1

Lomkob API 관련

0

201

1

깃허브 주소

0

264

1

포워딩오류? 인거 같습니다

0

336

1

css바꾸고 싶을때

0

306

1

git 연결할때 오류

0

265

1

프로젝트 생성시 Srping MVC Project 없음

0

1060

1

Oracle을 연결하고 싶은데, sql파일을 만들고나면...

0

281

1

프로젝트 생성시 Srping MVC Project 없음

0

4719

6

43강 age 0오류

0

298

1

Controller의 BoardMapper 쪽에서 문제가 있습니다.

0

382

1

Spring05 버전에서 이미지를 설정했을 때 권한이 보이지 않습니다

0

239

1

스프링 시큐리티 로그인 후 모달창 질문드립니다

0

625

0

아이디 중복확인 NullPointerException

0

361

2

새로고침해야만 등록한 글이 리스트에 뜹니다.

0

245

1

회원테이블과 권한테이블 간 관계

0

469

1

MVC02에서 List 화면이 나오지 않습니다

0

244

1