2012-09-10 4 views
2

저는 Liferay에서 별도의 비밀번호 변경 모듈을 구현합니다. 특히 로그인시 로그인 할 때 비밀번호 변경 권한을 갖도록 확장해야합니다.Liferay의 비밀번호 정책에 기반한 비밀번호 구문 검사

struts 액션 enterprise_admin/edit_user를 호출했지만 작동하지 않지만 해당 사용자의 비밀번호 정책을 확인하고 해당 클래스의 minUpperCase 등을 확인하여 내 자신의 비밀번호 검사기를 구현했지만 그 방법은 있습니다. 암호를 반복하고 minUpperCase 등을 계산하지 않고 구문을 검사 할 수 있습니까?

Liferay에는 암호가 암호 정책에 적용되는지 여부를 확인하는 특정 방법이 있습니까?

답변

0

시도해 볼 수 있습니다. 즉, 당신이 PwdToolkitUtil이이 방법을 시도 할 수 표시되지 않습니다 그들이 UserLocalService

PasswordPolicy passwordPolicy = passwordPolicyLocalService.getDefaultPasswordPolicy(companyId); 
PwdToolkitUtil.validate(companyId, 0, password1, password2, passwordPolicy); 
1

에 뭘 경우 : 당신은 로그인을 사용자 정의한 경우 기능 "로그인시 암호 변경"때문에의

Object[] arguments= {user.getCompanyId(), user.getUserId(), password, password, passwordPolicy}; 
MethodKey methodKey = new MethodKey("com.liferay.portal.security.pwd.PwdToolkitUtil", "validate", long.class, long.class, String.class , String.class, PasswordPolicy.class); 
PortalClassInvoker.invoke(false, methodKey, arguments); 
0

을, 네 번째 매개 변수가 아닌 UserLocalServiceUtil.updatePassword으로 포털의 기본 동작을 사용할 수도 있습니다.

public static User updatePassword(long userId, 
            String password1, 
            String password2, 
            boolean passwordReset, 
            boolean silentUpdate) 
         throws PortalException, 
           SystemException 

Updates the user's password, optionally with tracking and validation of the change. 

Parameters: 
    userId - the primary key of the user 
    password1 - the user's new password 
    password2 - the user's new password confirmation 
    passwordReset - whether the user should be asked to reset their password the next time they login 
    silentUpdate - whether the password should be updated without being tracked, or validated. Primarily used for password imports. 
Returns: 
    the user 
Throws: 
    PortalException - if a user with the primary key could not be found 
    SystemException - if a system exception occurred 
관련 문제