저는 Java EE, Spring 보안 프레임 워크 및 Oracle 11g 데이터베이스를 사용하는 응용 프로그램에서 작업하고 있습니다. 스프링 보안에 MD5 해시를 추가해야하며이 작업을 성공하지 못했습니다. 내가 지금까지했던 어떤봄 보안에 MD5 또는 SHA 해시를 추가하는 방법은 무엇입니까?
:
1에서 첫 주 내가 springsecuritycontext.xml하는 코드를 추가하지 않고 내 응용 프로그램에 MD5 해시를 추가하려고 내가 성공했다.
이 내가 한 일이다라는 패키지에서
두 classes.The 첫 번째가 PolicyManager라고있다 ma.dyaralmansour.zkgui.policy이 클래스는 스프링 보안 UserDetailService을 구현합니다. 두 번째는 LoginLoggingPolicyService이며이 클래스는 Spring AOP에서 애스펙트로 호출되며 로깅 용입니다. 내 모든 암호는 MD5 해시 해시
하지만 난을 사용할 때 더 이상 응용 프로그램에 액세스 할 수 없습니다
*** I added an MD5Password class to the ma.dyaralmansour.zkgui.policy and I added some code to the PolicyManager class to activate the hash and it's working.
내 문제는 지금 :
그래서 이것은 내가 한 일이다 일반 암호.
는 지금은 2 가지 옵션이 있습니다,하지만 난을 구현하는 방법을 전혀 생각이 없다 다음 MD5password 클래스의
1
이 testPassword이다 (문자열 clearTextTestPassword, 문자열 encodedActualPassword)라는 메서드그것은 비교가 데이터베이스에 저장된 해시 된 암호가있는 일반 암호이지만 내 policymanager 클래스에 암호를 추가하는 방법을 이해할 수 없습니다.
2 - 내가했던 모든 것을 완전히 제거하고 정상적인 암호를 사용할 때 응용 프로그램에 암호와 해시를 해시하기 위해 스프링 보안 구성에만 초점을 맞 춥니 다.
다른 해결책이 있습니까?
http://www.mediafire.com/download/gxgda63wyhkpehn/DamPromoZK4.rar
<!-- Spring namespace-based configuration -->
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:zksp="http://www.zkoss.org/2008/zkspring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<!-- Enable the @Secured annotation to secure service layer methods -->
<global-method-security secured-annotations="enabled" />
<http auto-config="true">
<!-- ### If we have our own LoginPage. So we must ### -->
<!-- ### tell Spring the name and the place. ### -->
<!-- ### In our case we take the same page ### -->
<!-- ### for a error message by a failure. ### -->
<!-- ### Further the page after a successfully login. ### -->
<form-login login-page="/index.zul"
authentication-failure-url="/index.zul?login_error=1"
default-target-url="/AccueilIntranet.zul" />
<!-- ### Tell Spring where it goes after logout. ### -->
<!-- ### logout-url is a action url. ### -->
<logout logout-url="/j_spring_logout" logout-success-url="/index.zul" />
<!-- ### Define the pages that are to be intercepted ### -->
<!-- ### It is parsed from top to bottom. Means that ### -->
<!-- ### the most specific pattern is standing on TOP ### -->
<!-- ### and the CATCH ALL is on BOTTOM! ### -->
<intercept-url pattern="/pages/**" access="IS_AUTHENTICATED_REMEMBERED" filters="none" />
<intercept-url pattern="/WEB-INF/pages/**" access="IS_AUTHENTICATED_REMEMBERED" filters="none"/>
<!-- ### The root page is accessible by everyone but ### -->
<!-- ### internally spring makes a login and ### -->
<!-- ### this user becames a UserDetails ### -->
<!-- ### (in there are the ip-address and others) ### -->
<intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" filters="none"/>
<!-- ### Per user one session !! ### -->
<concurrent-session-control max-sessions="1" />
</http>
<!-- ### We define the kind of authentification with a ### -->
<!-- ### so called authentication-provider ### -->
<!-- ### So we have our users stored in a DB we use ### -->
<!-- ### our own user-service class and point to her. ### -->
<authentication-provider user-service-ref="myUserDetailsService">
</authentication-provider>
<!-- ### The Implementation of the Interface ### -->
<!-- ### UserDetailService for the logged in ### -->
<!-- ### user and his rights ### -->
<beans:bean id="myUserDetailsService" class="ma.dyaralmansour.zkgui.policy.PolicyManager">
<beans:property name="userService" ref="userService" />
</beans:bean>
<authentication-provider user-service-ref="myUserDetailsService">
<password-encoder hash="md5"/>
</authentication-provider>
<!-- ### This aspect call automatically the methode ### -->
<!-- ### 'loginLogging' which is for writing a log for ### -->
<!-- ### all successfully and failed logins, if a ### -->
<!-- ### methode is called that handles the ### -->
<!-- ### Authentication. ### -->
<beans:bean id="LoginLoggingPolicyService"
class="ma.dyaralmansour.zkgui.policy.LoginLoggingPolicyService">
<beans:property name="loginLoggingService" ref="loginLoggingService" />
</beans:bean>
<aop:config>
<aop:aspect id="LoginLoggingAspect" ref="LoginLoggingPolicyService">
<aop:pointcut id="authPointcut"
expression="execution(public org.springframework.security.Authentication org.springframework.security.providers.AuthenticationProvider.authenticate(org.springframework.security.Authentication))" />
<aop:around pointcut-ref="authPointcut" method="loginLogging" />
</aop:aspect>
</aop:config>
</beans:beans>
이 코드를 springsecuritycontext.xml에 추가했는데 MD5password 클래스와 코드를 policymanager 클래스에서 제거했지만 응용 프로그램을 실행할 때 일반 암호를 사용하면 해당 암호가 해시되지 않습니다. 코드의 라인은 어쩌면 내가 더 설명해 줄 수 있을까? – user2644068
어떻게 응용 프로그램에 연결하려면 내 데이터베이스에서 읽고 해시 암호를 사용하도록 봄을 말할 수 있습니까? – user2644068
위와 같이 구성을 추가하면됩니다. '정상적인 암호를 사용하여 해시되지 않는'것은 무엇을 의미합니까? 어느 암호를 해시해야합니까? 현재 설정 (구성 및 코드)으로 질문을 업데이트하십시오. –