fix #690 FORM auth support

This commit is contained in:
Shinsuke Sugaya 2016-09-17 20:49:45 +09:00
parent 2431965ab0
commit 197f5990f2
8 changed files with 18 additions and 4 deletions

View file

@ -57,7 +57,7 @@
<utflute.version>0.6.0F</utflute.version>
<!-- Crawler -->
<crawler.version>1.0.10</crawler.version>
<crawler.version>1.0.11-SNAPSHOT</crawler.version>
<!-- Suggest -->
<suggest.version>2.3.0</suggest.version>

View file

@ -232,6 +232,8 @@ public class Constants extends CoreLibConstants {
public static final String NTLM = "NTLM";
public static final String FORM = "FORM";
public static final String SAMBA = "SAMBA";
public static final String FTP = "FTP";

View file

@ -228,6 +228,7 @@ public class DataConfig extends BsDataConfig implements CrawlingConfig {
} else if (Constants.NTLM.equals(scheme)) {
authScheme = new NTLMScheme(new JcifsEngine());
}
// TODO FORM
AuthScope authScope;
if (StringUtil.isBlank(hostname)) {

View file

@ -29,6 +29,7 @@ import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.service.WebConfigService;
import org.codelibs.fess.crawler.client.http.Authentication;
import org.codelibs.fess.crawler.client.http.form.FormScheme;
import org.codelibs.fess.crawler.client.http.impl.AuthenticationImpl;
import org.codelibs.fess.crawler.client.http.ntlm.JcifsEngine;
import org.codelibs.fess.crawler.exception.CrawlerSystemException;
@ -54,12 +55,16 @@ public class WebAuthentication extends BsWebAuthentication {
}
private AuthScheme getAuthScheme() {
if (Constants.BASIC.equals(getProtocolScheme())) {
final String scheme = getProtocolScheme();
if (Constants.BASIC.equals(scheme)) {
return new BasicScheme();
} else if (Constants.DIGEST.equals(getProtocolScheme())) {
} else if (Constants.DIGEST.equals(scheme)) {
return new DigestScheme();
} else if (Constants.NTLM.equals(getProtocolScheme())) {
} else if (Constants.NTLM.equals(scheme)) {
return new NTLMScheme(new JcifsEngine());
} else if (Constants.FORM.equals(scheme)) {
final Map<String, String> parameterMap = ParameterUtil.parse(getParameters());
return new FormScheme(parameterMap);
}
return null;
}

View file

@ -1214,6 +1214,9 @@ public class FessLabels extends UserMessages {
/** The key of the message: NTLM */
public static final String LABELS_webauth_scheme_ntlm = "{labels.webauth_scheme_ntlm}";
/** The key of the message: Form */
public static final String LABELS_webauth_scheme_form = "{labels.webauth_scheme_form}";
/** The key of the message: Log Files */
public static final String LABELS_log_configuration = "{labels.log_configuration}";

View file

@ -395,6 +395,7 @@ labels.webauth_web_crawling_config=Web Config
labels.webauth_scheme_basic=Basic
labels.webauth_scheme_digest=Digest
labels.webauth_scheme_ntlm=NTLM
labels.webauth_scheme_form=Form
labels.log_configuration=Log Files
labels.log_file_name=File Name
labels.log_file_date=Timestamp

View file

@ -395,6 +395,7 @@ labels.webauth_web_crawling_config=Web Config
labels.webauth_scheme_basic=Basic
labels.webauth_scheme_digest=Digest
labels.webauth_scheme_ntlm=NTLM
labels.webauth_scheme_form=Form
labels.log_configuration=Log Files
labels.log_file_name=File Name
labels.log_file_date=Timestamp

View file

@ -391,6 +391,7 @@ labels.webauth_web_crawling_config=\u30a6\u30a7\u30d6\u8a2d\u5b9a
labels.webauth_scheme_basic=Basic
labels.webauth_scheme_digest=Digest
labels.webauth_scheme_ntlm=NTLM
labels.webauth_scheme_form=Form
labels.log_configuration=\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb
labels.log_file_name=\u30d5\u30a1\u30a4\u30eb\u540d
labels.log_file_date=\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7