added realm-name
authormaxcooper <maxcooper>
Mon, 14 Jul 2003 18:53:46 +0000 (18:53 +0000)
committermaxcooper <maxcooper>
Mon, 14 Jul 2003 18:53:46 +0000 (18:53 +0000)
src/share/org/securityfilter/config/SecurityConfig.java
web/basic/WEB-INF/securityfilter-config.xml

index 9720ad3..dcfb88f 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * $Header: /cvsroot/securityfilter/securityfilter/src/share/org/securityfilter/config/SecurityConfig.java,v 1.9 2003/07/14 11:44:31 maxcooper Exp $
- * $Revision: 1.9 $
- * $Date: 2003/07/14 11:44:31 $
+ * $Header: /cvsroot/securityfilter/securityfilter/src/share/org/securityfilter/config/SecurityConfig.java,v 1.10 2003/07/14 18:53:46 maxcooper Exp $
+ * $Revision: 1.10 $
+ * $Date: 2003/07/14 18:53:46 $
  *
  * ====================================================================
  * The SecurityFilter Software License, Version 1.1
@@ -73,7 +73,7 @@ import java.util.List;
  * @author Torgeir Veimo (torgeir@pobox.com)
  * @author Max Cooper (max@maxcooper.com)
  * @author Daya Sharma (iamdaya@yahoo.com, billydaya@sbcglobal.net)
- * @version $Revision: 1.9 $ $Date: 2003/07/14 11:44:31 $
+ * @version $Revision: 1.10 $ $Date: 2003/07/14 18:53:46 $
  */
 public class SecurityConfig {
 
@@ -84,7 +84,8 @@ public class SecurityConfig {
    private SecurityRealmInterface realm = null;
    private Object lastRealm = null;
    private boolean validating;
-       private String authMethod;
+   private String authMethod;
+   private String realmName;
 
    /**
     * Constructor that takes the validating flag and debug level to be used while parsing.
@@ -144,20 +145,47 @@ public class SecurityConfig {
       this.defaultPage = defaultPage;
    }
 
+   /**
+    * Get the authentication method being used to challenge the user.
+    * Currently, only BASIC and FORM based are supported.
+    *
+    * @return BASIC or FORM
+    */
        public String getAuthMethod() {
            return authMethod;
        }
 
-       /**
-        * Set the authentication method being used to challenge the user. As of now only BASIC and FORM based are supported.
-        *
-        * @param authMethod The authentication method to be used by the filter
-        */
-       public void setAuthMethod(String authMethod) {
-           this.authMethod = authMethod;
+   /**
+    * Set the authentication method being used to challenge the user.
+    * Currently, only BASIC and FORM based are supported.
+    *
+    * @param authMethod The authentication method to be used by the filter
+    */
+   public void setAuthMethod(String authMethod) {
+       this.authMethod = authMethod;
+   }
+
+   /**
+    * Get the authentication realm name.
+    * This is used for BASIC authentication.
+    *
+    * @return the realm-name configured by the application developer
+    */
+       public String getRealmName() {
+           return realmName;
        }
 
    /**
+    * Set the authentication realm name.
+    * This is used for BASIC authentication.
+    *
+    * @param realmName the realm name to be used for BASIC authentication
+    */
+   public void setRealmName(String realmName) {
+       this.realmName = realmName;
+   }
+
+   /**
     * Return the realm to use for authentication. This is the outer-most realm if nested realms are used.
     * The outer-most realm must be listed first in the configuration file.
     */
@@ -221,7 +249,7 @@ public class SecurityConfig {
       Digester digester = new Digester();
 
       registerLocalDTDs(digester);
-      
+
       digester.push(this);
       digester.setValidating(validating);
 
@@ -231,10 +259,15 @@ public class SecurityConfig {
       digester.addSetNext("securityfilter-config/realm", "addRealm", "java.lang.Object");
 
       // login and error pages
-          digester.addCallMethod("securityfilter-config/login-config/auth-method", "setAuthMethod", 0);
+      digester.addCallMethod("securityfilter-config/login-config/auth-method", "setAuthMethod", 0);
+      digester.addCallMethod("securityfilter-config/login-config/realm-name", "setRealmName", 0);
       digester.addCallMethod("securityfilter-config/login-config/form-login-config/form-login-page", "setLoginPage", 0);
       digester.addCallMethod("securityfilter-config/login-config/form-login-config/form-error-page", "setErrorPage", 0);
-      digester.addCallMethod("securityfilter-config/login-config/form-login-config/form-default-page", "setDefaultPage", 0);
+      digester.addCallMethod(
+         "securityfilter-config/login-config/form-login-config/form-default-page",
+         "setDefaultPage",
+         0
+      );
 
       // security-constraint
       digester.addObjectCreate(
index 7451583..ae54bd9 100644 (file)
@@ -28,6 +28,7 @@
 
    <login-config>
       <auth-method>BASIC</auth-method>
+      <realm-name>SecurityFilter BASIC Example Application: username=username, password=password</realm-name>
    </login-config>
 
    <realm className="org.securityfilter.example.realm.TrivialSecurityRealm">