diff --git a/pom.xml b/pom.xml index 883df2e98..d8d593d9f 100644 --- a/pom.xml +++ b/pom.xml @@ -1277,7 +1277,7 @@ org.codelibs spnego - 1.0 + 1.1-SNAPSHOT commons-codec diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java index 37918d247..4403c2bd0 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java @@ -1372,7 +1372,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. none */ String SSO_TYPE = "sso.type"; - /** The key of the configuration. e.g. 0 */ + /** The key of the configuration. e.g. */ String SPNEGO_LOGGER_LEVEL = "spnego.logger.level"; /** The key of the configuration. e.g. krb5.conf */ @@ -1408,6 +1408,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. false */ String SPNEGO_ALLOW_DELEGATION = "spnego.allow.delegation"; + /** The key of the configuration. e.g. */ + String SPNEGO_EXCLUDE_DIRS = "spnego.exclude.dirs"; + /** The key of the configuration. e.g. __CLIENT_ID__ */ String OIC_CLIENT_ID = "oic.client.id"; @@ -5819,14 +5822,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** * Get the value for the key 'spnego.logger.level'.
- * The value is, e.g. 0
+ * The value is, e.g.
* @return The value of found property. (NotNull: if not found, exception but basically no way) */ String getSpnegoLoggerLevel(); /** * Get the value for the key 'spnego.logger.level' as {@link Integer}.
- * The value is, e.g. 0
+ * The value is, e.g.
* @return The value of found property. (NotNull: if not found, exception but basically no way) * @throws NumberFormatException When the property is not integer. */ @@ -5944,6 +5947,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction */ boolean isSpnegoAllowDelegation(); + /** + * Get the value for the key 'spnego.exclude.dirs'.
+ * The value is, e.g.
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getSpnegoExcludeDirs(); + + /** + * Get the value for the key 'spnego.exclude.dirs' as {@link Integer}.
+ * The value is, e.g.
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + * @throws NumberFormatException When the property is not integer. + */ + Integer getSpnegoExcludeDirsAsInteger(); + /** * Get the value for the key 'oic.client.id'.
* The value is, e.g. __CLIENT_ID__
@@ -8393,6 +8411,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction return is(FessConfig.SPNEGO_ALLOW_DELEGATION); } + public String getSpnegoExcludeDirs() { + return get(FessConfig.SPNEGO_EXCLUDE_DIRS); + } + + public Integer getSpnegoExcludeDirsAsInteger() { + return getAsInteger(FessConfig.SPNEGO_EXCLUDE_DIRS); + } + public String getOicClientId() { return get(FessConfig.OIC_CLIENT_ID); } @@ -8851,7 +8877,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction defaultMap.put(FessConfig.LDAP_ATTR_GID_NUMBER, "gidNumber"); defaultMap.put(FessConfig.LDAP_ATTR_HOME_DIRECTORY, "homeDirectory"); defaultMap.put(FessConfig.SSO_TYPE, "none"); - defaultMap.put(FessConfig.SPNEGO_LOGGER_LEVEL, "0"); + defaultMap.put(FessConfig.SPNEGO_LOGGER_LEVEL, ""); defaultMap.put(FessConfig.SPNEGO_KRB5_CONF, "krb5.conf"); defaultMap.put(FessConfig.SPNEGO_LOGIN_CONF, "auth_login.conf"); defaultMap.put(FessConfig.SPNEGO_PREAUTH_USERNAME, "username"); @@ -8863,6 +8889,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction defaultMap.put(FessConfig.SPNEGO_PROMPT_NTLM, "true"); defaultMap.put(FessConfig.SPNEGO_ALLOW_LOCALHOST, "true"); defaultMap.put(FessConfig.SPNEGO_ALLOW_DELEGATION, "false"); + defaultMap.put(FessConfig.SPNEGO_EXCLUDE_DIRS, ""); defaultMap.put(FessConfig.OIC_CLIENT_ID, "__CLIENT_ID__"); defaultMap.put(FessConfig.OIC_CLIENT_SECRET, "__CLIENT_SECRET__"); defaultMap.put(FessConfig.OIC_AUTH_SERVER_URL, "https://accounts.google.com/o/oauth2/auth"); diff --git a/src/main/java/org/codelibs/fess/sso/spnego/SpnegoAuthenticator.java b/src/main/java/org/codelibs/fess/sso/spnego/SpnegoAuthenticator.java index b3d25f1ae..dfc9a323a 100644 --- a/src/main/java/org/codelibs/fess/sso/spnego/SpnegoAuthenticator.java +++ b/src/main/java/org/codelibs/fess/sso/spnego/SpnegoAuthenticator.java @@ -24,6 +24,7 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletResponse; import org.codelibs.core.io.ResourceUtil; +import org.codelibs.core.lang.StringUtil; import org.codelibs.fess.app.web.base.login.ActionResponseCredential; import org.codelibs.fess.app.web.base.login.SpnegoCredential; import org.codelibs.fess.exception.FessSystemException; @@ -126,7 +127,19 @@ public class SpnegoAuthenticator implements SsoAuthenticator { @Override public String getInitParameter(final String name) { if (SpnegoHttpFilter.Constants.LOGGER_LEVEL.equals(name)) { - return fessConfig.getSpnegoLoggerLevel(); + if (StringUtil.isNotBlank(fessConfig.getSpnegoLoggerLevel())) { + return fessConfig.getSpnegoLoggerLevel(); + } else if (logger.isDebugEnabled()) { + return "3"; + } else if (logger.isInfoEnabled()) { + return "5"; + } else if (logger.isWarnEnabled()) { + return "6"; + } else if (logger.isErrorEnabled()) { + return "7"; + } else { + return "0"; + } } else if (SpnegoHttpFilter.Constants.LOGIN_CONF.equals(name)) { return getResourcePath(fessConfig.getSpnegoLoginConf()); } else if (SpnegoHttpFilter.Constants.KRB5_CONF.equals(name)) { @@ -149,6 +162,8 @@ public class SpnegoAuthenticator implements SsoAuthenticator { return fessConfig.getSpnegoAllowLocalhost(); } else if (SpnegoHttpFilter.Constants.ALLOW_DELEGATION.equals(name)) { return fessConfig.getSpnegoAllowDelegation(); + } else if (SpnegoHttpFilter.Constants.EXCLUDE_DIRS.equals(name)) { + return fessConfig.getSpnegoExcludeDirs(); } return null; } diff --git a/src/main/resources/fess_config.properties b/src/main/resources/fess_config.properties index bb9bdc91d..2db545545 100644 --- a/src/main/resources/fess_config.properties +++ b/src/main/resources/fess_config.properties @@ -673,7 +673,7 @@ ldap.attr.homeDirectory=homeDirectory # SSO # ------ sso.type=none -spnego.logger.level=0 +spnego.logger.level= spnego.krb5.conf=krb5.conf spnego.login.conf=auth_login.conf spnego.preauth.username=username @@ -685,6 +685,7 @@ spnego.allow.unsecure.basic=true spnego.prompt.ntlm=true spnego.allow.localhost=true spnego.allow.delegation=false +spnego.exclude.dirs= oic.client.id=__CLIENT_ID__ oic.client.secret=__CLIENT_SECRET__