View | Details | Raw Unified | Return to bug 37588
Collapse All | Expand All

(-)webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/SaveJNDIRealmAction.java (-1 / +7 lines)
Lines 65-70 Link Here
65
     */
65
     */
66
    private String createStandardRealmTypes[] =
66
    private String createStandardRealmTypes[] =
67
    { "java.lang.String",     // parent
67
    { "java.lang.String",     // parent
68
      "java.lang.String", //Connection URL
69
      "java.lang.String", //Connection name
70
      "java.lang.String", //Connection password
68
    };
71
    };
69
72
70
73
Lines 164-171 Link Here
164
                    TomcatTreeBuilder.getMBeanFactory();
167
                    TomcatTreeBuilder.getMBeanFactory();
165
168
166
                // Create a new StandardRealm object
169
                // Create a new StandardRealm object
167
                values = new String[1];
170
                values = new String[4];
168
                values[0] = parent;
171
                values[0] = parent;
172
                values[1] = rform.getConnectionURL();
173
                values[2] = rform.getConnectionName();
174
                values[3] = rform.getConnectionPassword();
169
                operation = "createJNDIRealm";
175
                operation = "createJNDIRealm";
170
                rObjectName = (String)
176
                rObjectName = (String)
171
                    mBServer.invoke(fname, operation,
177
                    mBServer.invoke(fname, operation,
(-)catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java (-2 / +42 lines)
Lines 42-47 Link Here
42
import org.apache.catalina.realm.DataSourceRealm;
42
import org.apache.catalina.realm.DataSourceRealm;
43
import org.apache.catalina.realm.JDBCRealm;
43
import org.apache.catalina.realm.JDBCRealm;
44
import org.apache.catalina.realm.JNDIRealm;
44
import org.apache.catalina.realm.JNDIRealm;
45
import org.apache.catalina.realm.JAASRealm;
45
import org.apache.catalina.realm.MemoryRealm;
46
import org.apache.catalina.realm.MemoryRealm;
46
import org.apache.catalina.realm.UserDatabaseRealm;
47
import org.apache.catalina.realm.UserDatabaseRealm;
47
import org.apache.catalina.session.StandardManager;
48
import org.apache.catalina.session.StandardManager;
Lines 404-415 Link Here
404
     *
405
     *
405
     * @exception Exception if an MBean cannot be created or registered
406
     * @exception Exception if an MBean cannot be created or registered
406
     */
407
     */
407
    public String createJNDIRealm(String parent)
408
    public String createJNDIRealm(String parent,String connectionURL,String connectionName,String connectionPassword)
408
        throws Exception {
409
        throws Exception {
409
410
410
         // Create a new JNDIRealm instance
411
         // Create a new JNDIRealm instance
411
        JNDIRealm realm = new JNDIRealm();
412
        JNDIRealm realm = new JNDIRealm();
413
				realm.setConnectionURL(connectionURL);
414
				realm.setConnectionName(connectionName);
415
				realm.setConnectionPassword(connectionPassword);
416
        // Add the new instance to its parent component
417
        ObjectName pname = new ObjectName(parent);
418
        ContainerBase containerBase = getParentContainerFromParent(pname);
419
        // Add the new instance to its parent component
420
        containerBase.setRealm(realm);
421
        // Return the corresponding MBean name
422
        ObjectName oname = realm.getObjectName();
412
423
424
        if (oname != null) {
425
            return (oname.toString());
426
        } else {
427
            return null;
428
        }   
429
430
431
    }
432
		
433
  /**
434
     * Create a new JAAS Realm.
435
     *
436
     * @param parent MBean Name of the associated parent component
437
     *
438
     * @exception Exception if an MBean cannot be created or registered
439
     */
440
    public String createJAASRealm(String parent,String appName,String userClassNames,String roleClassNames,String useContextClassLoader)
441
        throws Exception {
442
443
         // Create a new JAASRealm instance
444
        JAASRealm realm = new JAASRealm();
445
				realm.setAppName(appName);
446
				realm.setUserClassNames(userClassNames);
447
				realm.setRoleClassNames(roleClassNames);
448
				if("true".equals(useContextClassLoader)||"TRUE".equals(useContextClassLoader)){
449
						realm.setUseContextClassLoader(true);
450
				}
451
				else{
452
						realm.setUseContextClassLoader(false);
453
				}
413
        // Add the new instance to its parent component
454
        // Add the new instance to its parent component
414
        ObjectName pname = new ObjectName(parent);
455
        ObjectName pname = new ObjectName(parent);
415
        ContainerBase containerBase = getParentContainerFromParent(pname);
456
        ContainerBase containerBase = getParentContainerFromParent(pname);
Lines 427-433 Link Here
427
468
428
    }
469
    }
429
470
430
431
    /**
471
    /**
432
     * Create a new Memory Realm.
472
     * Create a new Memory Realm.
433
     *
473
     *
(-)catalina/src/share/org/apache/catalina/mbeans/mbeans-descriptors.xml (-1 / +30 lines)
Lines 119-126 Link Here
119
           returnType="java.lang.String">
119
           returnType="java.lang.String">
120
      <parameter name="parent"
120
      <parameter name="parent"
121
          description="MBean Name of the associated parent component"
121
          description="MBean Name of the associated parent component"
122
                 type="java.lang.String"/>
122
					type="java.lang.String"/>
123
	    <parameter name="connectionURL"
124
          description="Jndi Connection URL"
125
					type="java.lang.String"/>
126
	    <parameter name="connectionName"
127
          description="Connection name"
128
					type="java.lang.String"/>
129
	    <parameter name="connectionPassword"
130
          description="Connection password"
131
					type="java.lang.String"/>
123
    </operation>
132
    </operation>
133
    <operation   name="createJAASRealm"
134
          description="Create a new Jaas Realm"
135
               impact="ACTION"
136
           returnType="java.lang.String">
137
      <parameter name="parent"
138
          description="MBean Name of the associated parent component"
139
					type="java.lang.String"/>
140
	    <parameter name="appName"
141
          description="App name"
142
					type="java.lang.String"/>
143
	    <parameter name="userClassNames"
144
          description="Users class names."
145
					type="java.lang.String"/>
146
	    <parameter name="roleClassNames"
147
          description="Role classNames"
148
					type="java.lang.String"/>
149
	    <parameter name="useContextClassLoader"
150
          description="Whether use context classloader"
151
					type="java.lang.String"/>
152
    </operation>
124
153
125
    <operation   name="createMemoryRealm"
154
    <operation   name="createMemoryRealm"
126
          description="Create a new Memory Realm"
155
          description="Create a new Memory Realm"

Return to bug 37588