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 |
* |