use of com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl in project xwiki-platform by xwiki.
the class XWiki method getAuthService.
// added some log statements to make debugging easier - LBlaze 2005.06.02
public XWikiAuthService getAuthService() {
synchronized (this.AUTH_SERVICE_LOCK) {
if (this.authService == null) {
LOGGER.info("Initializing AuthService...");
String authClass = getConfiguration().getProperty("xwiki.authentication.authclass");
if (StringUtils.isNotEmpty(authClass)) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Using custom AuthClass " + authClass + ".");
}
} else {
if (isLDAP()) {
authClass = "com.xpn.xwiki.user.impl.LDAP.XWikiLDAPAuthServiceImpl";
} else {
authClass = "com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl";
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Using default AuthClass " + authClass + ".");
}
}
try {
// Get the current ClassLoader
@SuppressWarnings("deprecation") ClassLoaderManager clManager = Utils.getComponent(ClassLoaderManager.class);
ClassLoader classloader = null;
if (clManager != null) {
classloader = clManager.getURLClassLoader("wiki:xwiki", false);
}
// Get the class
if (classloader != null) {
this.authService = (XWikiAuthService) Class.forName(authClass, true, classloader).newInstance();
} else {
this.authService = (XWikiAuthService) Class.forName(authClass).newInstance();
}
LOGGER.debug("Initialized AuthService using Relfection.");
} catch (Exception e) {
LOGGER.warn("Failed to initialize AuthService " + authClass + " using Reflection, trying default implementations using 'new'.", e);
this.authService = new XWikiAuthServiceImpl();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Initialized AuthService " + this.authService.getClass().getName() + " using 'new'.");
}
}
}
return this.authService;
}
}
Aggregations