use of org.lastaflute.web.login.credential.UserPasswordCredential in project fess by codelibs.
the class FessLoginAssist method resolveCredential.
// ===================================================================================
// Login Extention
// ==============
@Override
protected void resolveCredential(final CredentialResolver resolver) {
resolver.resolve(UserPasswordCredential.class, credential -> {
final UserPasswordCredential userCredential = credential;
final String username = userCredential.getUser();
final String password = userCredential.getPassword();
if (!fessConfig.isAdminUser(username)) {
final OptionalEntity<FessUser> ldapUser = ComponentUtil.getLdapManager().login(username, password);
if (ldapUser.isPresent()) {
return ldapUser;
}
}
return doFindLoginUser(username, encryptPassword(password));
});
resolver.resolve(SpnegoCredential.class, credential -> {
final String username = credential.getUsername();
if (!fessConfig.isAdminUser(username)) {
return ComponentUtil.getLdapManager().login(username);
}
return OptionalEntity.empty();
});
resolver.resolve(OpenIdConnectCredential.class, credential -> {
return OptionalEntity.of(credential.getUser());
});
}
use of org.lastaflute.web.login.credential.UserPasswordCredential in project fess by codelibs.
the class LoginAction method login.
@Execute
public HtmlResponse login(final LoginForm form) {
validate(form, messages -> {
}, () -> asIndexPage(form));
verifyToken(() -> asIndexPage(form));
final String username = form.username;
final String password = form.password;
form.clearSecurityInfo();
try {
return fessLoginAssist.loginRedirect(new UserPasswordCredential(username, password), op -> {
}, () -> {
activityHelper.login(getUserBean());
userInfoHelper.deleteUserCodeFromCookie(request);
return getHtmlResponse();
});
} catch (final LoginFailureException lfe) {
throwValidationError(messages -> messages.addErrorsLoginError(GLOBAL), () -> asIndexPage(form));
}
return redirect(getClass());
}
Aggregations