Author: andreas
Date: Mon Oct 1 03:11:28 2007
New Revision: 580913
URL: http://svn.apache.org/viewvc?rev=580913&view=rev
Log:
Make redirect to WAYF server configurable
Modified:
lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethAuthenticator.java
lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl
Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethAuthenticator.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethAuthenticator.java?rev=580913&r1=580912&r2=580913&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethAuthenticator.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethAuthenticator.java Mon Oct 1 03:11:28 2007
@@ -25,6 +25,9 @@
import javax.servlet.http.HttpServletRequest;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.cocoon.environment.Request;
@@ -51,14 +54,24 @@
import org.opensaml.SAMLBrowserProfile.BrowserProfileResponse;
/**
- * Shibboleth-based authenticator.
+ * <p>Shibboleth-based authenticator.<p>
+ * <p>Configuration:</p>
+ * <ul>
+ * <li>
+ * <code><redirect-to-wayf>true|false</redirect-to-wayf></code>
+ * - if the application should redirect to the WAYF server instead of the login screen
+ * if a resource is protected only via group rules
+ * </li>
+ * </pre>
*/
-public class ShibbolethAuthenticator extends UserAuthenticator {
+public class ShibbolethAuthenticator extends UserAuthenticator implements Configurable {
protected static final String ERROR_MISSING_UID_ATTRIBUTE = "Unable to get unique identifier for subject. "
+ "Make sure you are listed in the metadata.xml "
+ "file and your resources your are trying to access "
+ "are available and your are allowed to see them. (Resourceregistry).";
+
+ private boolean redirectToWayf = false;
public boolean authenticate(AccreditableManager accreditableManager, Request request,
ErrorHandler handler) throws AccessControlException {
@@ -207,9 +220,8 @@
}
public String getLoginUri(Request request) {
- if (isOnlyShibbolethProtected(request)) {
+ if (this.redirectToWayf && isOnlyShibbolethProtected(request)) {
return request.getRequestURI() + "?lenya.usecase=shibboleth&lenya.step=wayf";
-
}
else {
return super.getLoginUri(request);
@@ -270,6 +282,13 @@
}
manager.release(selector);
}
+ }
+ }
+
+ public void configure(Configuration config) throws ConfigurationException {
+ Configuration redirectConfig = config.getChild("redirect-to-wayf", false);
+ if (redirectConfig != null) {
+ this.redirectToWayf = redirectConfig.getValueAsBoolean();
}
}
Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl?rev=580913&r1=580912&r2=580913&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl Mon Oct 1 03:11:28 2007
@@ -215,7 +215,9 @@
<component logger="lenya.ac.authenticator"
class="org.apache.lenya.ac.shibboleth.ShibbolethAuthenticator"
- role="org.apache.lenya.ac.Authenticator"/>
+ role="org.apache.lenya.ac.Authenticator">
+ <redirect-to-wayf>true</redirect-to-wayf>
+ </component>
<!--
<component logger="lenya.ac.authenticator"
class="org.apache.lenya.ac.impl.UserAuthenticator"
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.