스프링의 JAAS 인증 제공자에 대한 오류 읽기 구성 파일
문제
이 머리카락을 정말 찢어 버립니다. Spring WebApp에 대한 JAAS 인증 제공 업체가 있습니다. 다음과 같이 Bean 정의를 만들었습니다.
<beans:bean id="jaasAuthenticationProvider"
class="org.springframework.security.providers.jaas.JaasAuthenticationProvider">
<custom-authentication-provider />
<beans:property name="loginConfig" value="file:webapps/mywebapp/WEB-INF/login.conf"/>
<beans:property name="loginContextName" value="myWebapp"/>
<beans:property name="callbackHandlers">
<beans:list>
<beans:bean class="org.springframework.security.providers.jaas.JaasNameCallbackHandler"/>
<beans:bean class="org.springframework.security.providers.jaas.JaasPasswordCallbackHandler"/>
</beans:list>
</beans:property>
</beans:bean>
jaas 용 로그인 .conf 파일 :
myWebapp {
com.sun.security.auth.module.Krb5LoginModule
required
doNotPrompt=false
useTicketCache=true
debug=true;
};
com.sun.security.jgss.initiate {
com.sun.security.auth.module.Krb5LoginModule
required;
};
스프링이 초기화되면 콩을 올바르게 구성합니다. 그러나 웹 app에 로그인하면 다음과 같은 오류가 발생합니다.
DEBUG webapp.AuthenticationProcessingFilter - Authentication request failed: org.springframework.security.AuthenticationServiceException: I/O error while reading configuration file.; nested exception is javax.security.auth.login.LoginException: I/O error while reading configuration file.
스프링 소스 코드의 어느 곳 에서나이 오류 메시지를 찾을 수 없으며 오류 메시지 자체가 전혀 도움이되지 않습니다. 이것을 일으킬 수있는 이유는 무엇입니까?
해결책 2
답을 찾았습니다. JAAS는 실제로 구성 파일을 올바르게로드하고 있었지만 로컬 JDK에 krb5.conf 파일이 누락되었습니다. 이 파일은 다음에 살아야합니다.
$JAVA_HOME/lib/security
예시:
[libdefaults]
default_realm = DOMAIN.NET
dns_lookup_kdc = true
[domain_realm]
.domain.net = DOMAIN.NET
여기서 domain.net은 Kerberos 도메인의 이름이며 Domain.net은 동일하게 대문자입니다.
다른 팁
Web-Inf 디렉토리에서 파일을 읽고 읽으십시오. /webapps/myapp/web-inf/classes/login.conf- 그런 다음 스프링 구성에서 라인을 다음으로 변경하십시오.
<beans:property name="loginConfig" value="classpath:login.conf"/>
나는 당신이 스프링 오류를 받고 있다고 생각하지 않지만 파일 시스템/Java 오류를 받으면 디렉토리 웹 -INF에서 읽을 수 없습니다.
제휴하지 않습니다 StackOverflow