com.xpn.xwiki.user.impl.xwiki
Class XWikiAuthServiceImpl

java.lang.Object
  extended by com.xpn.xwiki.user.impl.xwiki.AbstractXWikiAuthService
      extended by com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl
All Implemented Interfaces:
XWikiAuthService
Direct Known Subclasses:
AppServerTrustedAuthServiceImpl, AppServerTrustedKerberosAuthServiceImpl, GroovyAuthServiceImpl, LDAPAuthServiceImpl, XWikiLDAPAuthServiceImpl

public class XWikiAuthServiceImpl
extends AbstractXWikiAuthService

Default implementation of XWikiAuthService.


Field Summary
protected  Map<String,XWikiAuthenticator> authenticators
          Each wiki has its own authenticator.
 
Constructor Summary
XWikiAuthServiceImpl()
           
 
Method Summary
 Principal authenticate(String username, String password, XWikiContext context)
           
 XWikiUser checkAuth(String username, String password, String rememberme, XWikiContext context)
          Method to authenticate and set the cookie from a username and password passed as parameters
 XWikiUser checkAuth(XWikiContext context)
           
protected  boolean checkPassword(String username, String password, XWikiContext context)
           
protected  String createUser(String user, XWikiContext context)
           
protected  String findUser(String username, XWikiContext context)
           
protected  XWikiAuthenticator getAuthenticator(XWikiContext context)
           
protected  String getParam(String name, XWikiContext context)
           
 void showLogin(XWikiContext context)
           
protected  String stripContextPathFromURL(URL url, XWikiContext context)
          The authentication library we are using (SecurityFilter) requires that its URLs do not contain the context path, in order to be usable with RequestDispatcher.forward.
 
Methods inherited from class com.xpn.xwiki.user.impl.xwiki.AbstractXWikiAuthService
authenticateSuperAdmin, isSuperAdmin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

authenticators

protected Map<String,XWikiAuthenticator> authenticators
Each wiki has its own authenticator.

Constructor Detail

XWikiAuthServiceImpl

public XWikiAuthServiceImpl()
Method Detail

getAuthenticator

protected XWikiAuthenticator getAuthenticator(XWikiContext context)
                                       throws XWikiException
Throws:
XWikiException

checkAuth

public XWikiUser checkAuth(XWikiContext context)
                    throws XWikiException
Throws:
XWikiException

checkAuth

public XWikiUser checkAuth(String username,
                           String password,
                           String rememberme,
                           XWikiContext context)
                    throws XWikiException
Method to authenticate and set the cookie from a username and password passed as parameters

Parameters:
username - the user name for the user to authenticate
password - the password of the user to authenticate
context - the XWiki context object
Returns:
null if the user is not authenticated properly
Throws:
XWikiException - in case of authentication error

showLogin

public void showLogin(XWikiContext context)
               throws XWikiException
Throws:
XWikiException

authenticate

public Principal authenticate(String username,
                              String password,
                              XWikiContext context)
                       throws XWikiException
Returns:
a null Principal Object if the user hasn't been authenticated or a valid Principal Object if the user is correctly authenticated
Throws:
XWikiException

findUser

protected String findUser(String username,
                          XWikiContext context)
                   throws XWikiException
Throws:
XWikiException

checkPassword

protected boolean checkPassword(String username,
                                String password,
                                XWikiContext context)
                         throws XWikiException
Throws:
XWikiException

getParam

protected String getParam(String name,
                          XWikiContext context)

createUser

protected String createUser(String user,
                            XWikiContext context)
                     throws XWikiException
Throws:
XWikiException

stripContextPathFromURL

protected String stripContextPathFromURL(URL url,
                                         XWikiContext context)
The authentication library we are using (SecurityFilter) requires that its URLs do not contain the context path, in order to be usable with RequestDispatcher.forward. Since our URL factory include the context path in the generated URLs, we use this method to remove (if needed) the context path.

Parameters:
url - The URL to process.
context - The ubiquitous XWiki request context.
Returns:
A String representation of the contextpath-free URL.