Changes for page User Authentication

Last modified by Simon Urli on 2023/12/11

From version 64.2
edited by Manuel Smeria
on 2012/12/17
Change comment: Rewording, updated links
To version 64.4
edited by Sorin Burjan
on 2013/04/18
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ManuelSmeria
1 +XWiki.Sorin
Content
... ... @@ -186,6 +186,8 @@
186 186  
187 187  The specific packages to track for LDAP are ##com.xpn.xwiki.plugin.ldap## and ##com.xpn.xwiki.user.impl.LDAP##.
188 188  
189 +Starting with XWiki 4.2 we added a new [[Logging UI>>extensions:Extension.Logging Application]] from the Administration section, which allows logging to be enabled at runtime, directly from the UI, without the need to restart the wiki.
190 +
189 189  In XWiki 3.4 you need to add the following in ##WEB-INF/classes/logback.xml##:
190 190  
191 191  {{code}}
... ... @@ -387,54 +387,54 @@
387 387   private static final Log LOG = LogFactory.getLog(SSOLdapAuthenicationImpl.class);
388 388  
389 389  
390 - public XWikiUser checkAuth(XWikiContext context) throws XWikiException {
391 - String user = getRemoteUser(context);
392 - if ((user != null) || !user.equals("")) {
393 - if (LOG.isInfoEnabled())
394 - LOG.info("Launching create user for " + user);
395 - if ( authenticate(user, context) != null ) {
396 - if (LOG.isInfoEnabled())
397 - LOG.info("Create user done for " + user);
398 - user = "XWiki." + user;
399 - context.setUser(user);
400 - System.out.println("User is set to:" + user);
401 - return new XWikiUser(user);
402 - } else {
403 - LOG.error( "User " + user + " can't be authenticated against ldap" );
404 - }
405 - }
406 - return super.checkAuth(context);
407 - }
392 + public XWikiUser checkAuth(XWikiContext context) throws XWikiException {
393 + String user = getRemoteUser(context);
394 + if ((user != null) || !user.equals("")) {
395 + if (LOG.isInfoEnabled())
396 + LOG.info("Launching create user for " + user);
397 + if ( authenticate(user, context) != null ) {
398 + if (LOG.isInfoEnabled())
399 + LOG.info("Create user done for " + user);
400 + user = "XWiki." + user;
401 + context.setUser(user);
402 + System.out.println("User is set to:" + user);
403 + return new XWikiUser(user);
404 + } else {
405 + LOG.error( "User " + user + " can't be authenticated against ldap" );
406 + }
407 + }
408 + return super.checkAuth(context);
409 + }
408 408  
409 - /**
410 - * We cannot authenticate locally since we need to trust the app server for
411 - * authentication
412 - *
413 - * @param username
414 - * @param password
415 - * @param context
416 - * @return
417 - * @throws XWikiException
418 - */
419 - public XWikiUser checkAuth(String username, String password,
420 - String rememberme, XWikiContext context) throws XWikiException {
421 - String user = getRemoteUser(context);
422 - if ((user == null) || user.equals("")) {
423 - return super.checkAuth(username, password, rememberme, context);
424 - }
425 - return checkAuth(context);
426 - }
411 + /**
412 + * We cannot authenticate locally since we need to trust the app server for
413 + * authentication
414 + *
415 + * @param username
416 + * @param password
417 + * @param context
418 + * @return
419 + * @throws XWikiException
420 + */
421 + public XWikiUser checkAuth(String username, String password,
422 + String rememberme, XWikiContext context) throws XWikiException {
423 + String user = getRemoteUser(context);
424 + if ((user == null) || user.equals("")) {
425 + return super.checkAuth(username, password, rememberme, context);
426 + }
427 + return checkAuth(context);
428 + }
427 427  
428 - private String getRemoteUser(XWikiContext context) {
429 - String userName = context.getRequest().getHttpServletRequest()
430 - .getRemoteUser();
431 - if (userName != null) {
432 - // only take the front of the username@domain
433 - String[] elements = userName.split("@", 2);
434 - userName = elements[0];
435 - }
436 - return userName;
437 - }
430 + private String getRemoteUser(XWikiContext context) {
431 + String userName = context.getRequest().getHttpServletRequest()
432 + .getRemoteUser();
433 + if (userName != null) {
434 + // only take the front of the username@domain
435 + String[] elements = userName.split("@", 2);
436 + userName = elements[0];
437 + }
438 + return userName;
439 + }
438 438  
439 439   public Principal authenticate(String login, XWikiContext context) throws XWikiException
440 440   {

Get Connected