public Principal authenticate(String username, String password, XWikiContext context) throws XWikiException { XWikiAuthService authservice = getAuthService(context); if (authservice == null) return super.authenticate(username, password, context); else { try { return authservice.authenticate(username, password, context); } catch (Exception e) { return super.authenticate(username, password, context); } } }
/** * Try both local and global DB login if trylocal is true {@link Principal}. * * @param ldapUid the name of the user to log in. * @param ldapPassword the password of the user to log in. * @param context the XWiki context. * @return the {@link Principal}. * @throws XWikiException error when checking user name and password. */ protected Principal xwikiAuthenticate(String ldapUid, String ldapPassword, XWikiContext context) throws XWikiException { Principal principal = null; XWikiLDAPConfig config = XWikiLDAPConfig.getInstance(); String trylocal = config.getLDAPParam("ldap_trylocal", "0", context); if ("1".equals(trylocal)) { if (LOG.isDebugEnabled()) { LOG.debug("Trying authentication against XWiki DB"); } principal = super.authenticate(ldapUid, ldapPassword, context); } return principal; }
/** * Try both local and global DB login if trylocal is true {@link Principal}. * * @param ldapUid the name of the user to log in. * @param ldapPassword the password of the user to log in. * @param context the XWiki context. * @return the {@link Principal}. * @throws XWikiException error when checking user name and password. */ protected Principal xwikiAuthenticate(String ldapUid, String ldapPassword, XWikiContext context) throws XWikiException { Principal principal = null; XWikiLDAPConfig config = XWikiLDAPConfig.getInstance(); String trylocal = config.getLDAPParam("ldap_trylocal", "0", context); if ("1".equals(trylocal)) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Trying authentication against XWiki DB"); } principal = super.authenticate(ldapUid, ldapPassword, context); } return principal; }