Lines 250-261
Link Here
|
250 |
*/ |
250 |
*/ |
251 |
public void setRoleClassNames(String roleClassNames) { |
251 |
public void setRoleClassNames(String roleClassNames) { |
252 |
this.roleClassNames = roleClassNames; |
252 |
this.roleClassNames = roleClassNames; |
253 |
parseClassNames(roleClassNames, roleClasses); |
|
|
254 |
} |
253 |
} |
255 |
|
254 |
|
256 |
/** |
255 |
/** |
257 |
* Parses a comma-delimited list of class names, and store the class names |
256 |
* Parses a comma-delimited list of class names, and store the class names |
258 |
* in the provided List. Each class must implement <codejava.security.Principal</code>. |
257 |
* in the provided List. Each class must implement <code>java.security.Principal</code>. |
259 |
* |
258 |
* |
260 |
* @param classNamesString a comma-delimited list of fully qualified class names. |
259 |
* @param classNamesString a comma-delimited list of fully qualified class names. |
261 |
* @param classNamesList the list in which the class names will be stored. |
260 |
* @param classNamesList the list in which the class names will be stored. |
Lines 264-275
Link Here
|
264 |
protected void parseClassNames(String classNamesString, List<String> classNamesList) { |
263 |
protected void parseClassNames(String classNamesString, List<String> classNamesList) { |
265 |
classNamesList.clear(); |
264 |
classNamesList.clear(); |
266 |
if (classNamesString == null) return; |
265 |
if (classNamesString == null) return; |
|
|
266 |
|
267 |
ClassLoader loader = this.getClass().getClassLoader(); |
268 |
if (isUseContextClassLoader()) |
269 |
loader = Thread.currentThread().getContextClassLoader(); |
267 |
|
270 |
|
268 |
String[] classNames = classNamesString.split("[ ]*,[ ]*"); |
271 |
String[] classNames = classNamesString.split("[ ]*,[ ]*"); |
269 |
for (int i=0; i<classNames.length; i++) { |
272 |
for (int i=0; i<classNames.length; i++) { |
270 |
if (classNames[i].length()==0) continue; |
273 |
if (classNames[i].length()==0) continue; |
271 |
try { |
274 |
try { |
272 |
Class principalClass = Class.forName(classNames[i]); |
275 |
Class principalClass = Class.forName(classNames[i], false, loader); |
273 |
if (Principal.class.isAssignableFrom(principalClass)) { |
276 |
if (Principal.class.isAssignableFrom(principalClass)) { |
274 |
classNamesList.add(classNames[i]); |
277 |
classNamesList.add(classNames[i]); |
275 |
} else { |
278 |
} else { |
Lines 302-308
Link Here
|
302 |
*/ |
305 |
*/ |
303 |
public void setUserClassNames(String userClassNames) { |
306 |
public void setUserClassNames(String userClassNames) { |
304 |
this.userClassNames = userClassNames; |
307 |
this.userClassNames = userClassNames; |
305 |
parseClassNames(userClassNames, userClasses); |
|
|
306 |
} |
308 |
} |
307 |
|
309 |
|
308 |
|
310 |
|
Lines 335-341
Link Here
|
335 |
// What if the LoginModule is in the container class loader ? |
337 |
// What if the LoginModule is in the container class loader ? |
336 |
ClassLoader ocl = null; |
338 |
ClassLoader ocl = null; |
337 |
|
339 |
|
338 |
if (isUseContextClassLoader()) { |
340 |
if ( !isUseContextClassLoader()) { |
339 |
ocl=Thread.currentThread().getContextClassLoader(); |
341 |
ocl=Thread.currentThread().getContextClassLoader(); |
340 |
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); |
342 |
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); |
341 |
} |
343 |
} |
Lines 348-354
Link Here
|
348 |
log.error(sm.getString("jaasRealm.unexpectedError"), e); |
350 |
log.error(sm.getString("jaasRealm.unexpectedError"), e); |
349 |
return (null); |
351 |
return (null); |
350 |
} finally { |
352 |
} finally { |
351 |
if( isUseContextClassLoader()) { |
353 |
if( !isUseContextClassLoader()) { |
352 |
Thread.currentThread().setContextClassLoader(ocl); |
354 |
Thread.currentThread().setContextClassLoader(ocl); |
353 |
} |
355 |
} |
354 |
} |
356 |
} |
Lines 547-552
Link Here
|
547 |
// Perform normal superclass initialization |
549 |
// Perform normal superclass initialization |
548 |
super.start(); |
550 |
super.start(); |
549 |
|
551 |
|
|
|
552 |
// These need to be called after loading configuration, in case |
553 |
// useContextClassLoader appears after them in xml config |
554 |
parseClassNames(userClassNames, userClasses); |
555 |
parseClassNames(roleClassNames, roleClasses); |
550 |
} |
556 |
} |
551 |
|
557 |
|
552 |
|
558 |
|