본문 바로가기
오류처리

스프링시큐리티) There is no PasswordEncoder mapped for the id "null" 500 오류

by 으노으뇨 2022. 1. 13.
728x90
반응형
SMALL

사이드 프로젝트 진행중 오류를 겪었다.

사진과 같다.

이는 현재 

기존 프로젝트에서 스프링시큐리티를 적용하는 과정중에 발생한 것이다.

지금 현재 저의 

sercurity-context.xml 은 이렇습니다.(저는 스프링시큐리티를 따로 xml로 만들어 사용합니다.)

	<security:http>
		<security:form-login />
		<security:intercept-url pattern="/all" access="permitAll" />
		<security:intercept-url pattern="/member" access="hasRole('101')" />

	</security:http>
	<security:authentication-manager>
		<security:authentication-provider>
			<security:user-service>
				<security:user name="qwe" password="qwe" authorities="101"/>
			</security:user-service>
		</security:authentication-provider>
	</security:authentication-manager>

위 코드처럼  패스워드가 그냥 선언되어있으면 발생하는 오류이다. 

만일 여러웁늬 스프링 시큐리티 버전이 5버전 이상이라면 PasswordEncoder라는 존재를 이용해야합니다.

'{noop}' 을 붙여주어야한다.

붙여주고 실행을 해보도록하겠습니다.

로그인을 해주었더니 되었다.

	<security:authentication-manager>
		<security:authentication-provider>
			<security:user-service>
				<security:user name="qwe" password="{noop}qwe" authorities="ROLE_MEMBER"/>
			</security:user-service>
		</security:authentication-provider>
	</security:authentication-manager>

 

728x90
반응형
LIST

댓글