Changeset 518 for trunk/core/data/TWiki/UserAuthentication.txt
- Timestamp:
- 11/10/08 12:36:51 (4 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/data/TWiki/UserAuthentication.txt
r490 r518 1 1 %META:TOPICINFO{author="ProjectContributor" date="1176971123" format="1.0" version="$Rev: 15969 $"}% 2 2 %STARTINCLUDE% 3 ---+ TWikiUser Authentication4 5 _ TWiki site access control and user activity tracking options_3 ---+ User Authentication 4 5 _Controlling who can access your site_ 6 6 7 7 %TOC% … … 9 9 ---++ Overview 10 10 11 Authentication, or "login", is the process by which a user lets TWikiknow who they are.12 13 Authentication isn't just to do with access control. TWiki uses authentication to identify users, so it can keep track of who made changes, and manage a wide range of personal settings. With authentication enabled, users can personalise TWikiand contribute as recognised individuals, instead of shadows.14 15 TWiki authentication is very flexible, and can either stand alone or integrate with existing authentication schemes. You can set up TWikito require authentication for every access, or only for changes. Authentication is also essential for access control.11 Authentication, or "login", is the process by which a user lets %WIKITOOLNAME% know who they are. 12 13 Authentication isn't just to do with [[access control]]. %WIKITOOLNAME% uses authentication to keep track of who made changes, and manage a wide range of personal settings. With authentication enabled, users can personalise %WIKITOOLNAME% and contribute as recognised individuals, instead of shadows. 14 15 %WIKITOOLNAME% authentication is very flexible, and can either stand alone or integrate with existing authentication schemes. You can set up %WIKITOOLNAME% to require authentication for every access, or only for changes. Authentication is also essential for access control. 16 16 17 17 *Quick Authentication Test* - Use the %<nop>USERINFO% variable to return your current identity: 18 18 * You are %USERINFO% 19 19 20 TWikiuser authentication is split into four sections; password management, user mapping, user registration, and login management. Password management deals with how users personal data is stored. Registration deals with how new users are added to the wiki. Login management deals with how users log in.20 %WIKITOOLNAME% user authentication is split into four sections; password management, user mapping, user registration, and login management. Password management deals with how users personal data is stored. Registration deals with how new users are added to the wiki. Login management deals with how users log in. 21 21 22 22 Once a user is logged on, they can be remembered using a _Client Session_ stored in a cookie in the browser (or by other less elegant means if the user has disabled cookies). This avoids them having to log on again and again. 23 23 24 TWikiuser authentication is configured through the Security Settings pane in the [[%SCRIPTURLPATH{"configure"}%][configure]] interface.25 26 Please note FileAttachments are not protected by TWikiUser Authentication.27 28 __%T% Tip:__ TWiki:TWiki.TWikiUserAuthenticationSupplementon TWiki.org has supplemental documentation on user authentication.24 %WIKITOOLNAME% user authentication is configured through the Security Settings pane in the [[%SCRIPTURLPATH{"configure"}%][configure]] interface. 25 26 Please note FileAttachments are not protected by %WIKITOOLNAME% User Authentication. 27 28 __%T% Tip:__ NextWiki:Support.UserAuthenticationFAQ on TWiki.org has supplemental documentation on user authentication. 29 29 30 30 #PasswordManagement 31 31 ---++ Password Management 32 32 33 As shipped, TWiki supports the Apache 'htpasswd' password manager. This manager supports the use of =.htpasswd= files on the server. These files can be unique to TWiki, or can be shared with other applications (such as an Apache webserver). A variety of password encodings are supported for flexibility when re-using existing files. See the descriptive comments in the Security Settings section of the [[%SCRIPTURLPATH{"configure"}%][configure]] interface for more details.33 As shipped, %WIKITOOLNAME% supports the Apache 'htpasswd' password manager. This manager supports the use of =.htpasswd= files on the server. These files can be unique to %WIKITOOLNAME%, or can be shared with other applications (such as an Apache webserver). A variety of password encodings are supported for flexibility when re-using existing files. See the descriptive comments in the Security Settings section of the [[%SCRIPTURLPATH{"configure"}%][configure]] interface for more details. 34 34 35 35 You can easily plug in alternate password management modules to support interfaces to other third-party authentication databases. 36 37 The password manager is selected using the {PasswordManager} setting in =configure=. 36 38 37 39 #UserMapping 38 40 ---++ User Mapping 39 41 40 Often when you are using an external authentication method, you want to map from an unfriendly "login name" to a more friendly WikiName. Also, an external authentication database may well have user information you want to import to TWiki, such as user groups. 41 42 By default, TWiki supports mapping of usernames to wikinames, and supports TWiki groups internal to TWiki. If you want, you can plug in an alternate user mapping module to support import of groups etc. 42 Usually when you are using an external authentication method, you want to map from an unfriendly "login name" to a more friendly WikiName. Also, an external authentication database may well have user information you want to import to %WIKITOOLNAME%, such as user groups. 43 44 By default, %WIKITOOLNAME% supports mapping of usernames to wikinames, and supports %WIKITOOLNAME% groups internal to %WIKITOOLNAME%. If you want, you can plug in an alternate user mapping module to support import of groups etc. 45 46 The user mapping manager is selected using the {UserMappingManager} setting in =configure=. 43 47 44 48 #UserRegistration … … 49 53 The registration process is also responsible for creating user topics, and setting up the mapping information used by the User Mapping support. 50 54 51 __%X% Note:__ If you are restricting the entire <nop>%USERSWEB% web to !TWikiGuest, you are required to add !TWikiRegistrationAgent to ALLOWWEBCHANGE in your =%USERSWEB%/WebPreferences=. By doing so, new users are able to register without any errors.55 __%X% Note:__ You *must* allow the pseudo-user !TWikiRegistrationAgent to ALLOWWEBCHANGE in your =%USERSWEB%= web. If you block this user, then new users will see errors when they try to register. 52 56 53 57 #LoginManagement 54 58 ---++ Login Management 55 59 56 Login management controls the way users have to log in. There are three basic options; no login, login via a TWiki login page, and login using the webserver authentication support.60 Login management controls the way users have to log in. There are three basic options; no login, login via a %WIKITOOLNAME% login page, and login using the webserver authentication support. the login manager is selected using the {LoginManager} setting in =configure=. 57 61 58 62 #NoLogin 59 ---+++ No Login (select =none= in configure)63 ---+++ No Login (select =none=) 60 64 61 65 Does exactly what it says on the tin. Forget about authentication to make your site completely public - anyone can browse and edit freely, in classic Wiki style. All visitors are given the %USERSWEB%.TWikiGuest default identity, so you can't track individual user activity. … … 64 68 65 69 #TemplateLogin 66 ---+++ Template Login (select =TWiki::LoginManager::TemplateLogin= in configure)70 ---+++ Template Login (select =TWiki::LoginManager::TemplateLogin=) 67 71 68 72 Template Login asks for a username and password in a web page, and processes them using whatever Password Manager you choose. Users can log in and log out. Client Sessions are used to remember users. Users can choose to have their session remembered so they will automatically be logged in the next time they start their browser. … … 77 81 1 Create a new topic to check if authentication works. 78 82 1 *Edit the %USERSWEB%.TWikiAdminGroup topic in the %USERSWEB% web to include users with system administrator status.* 79 <br /> %X% *This is a very important step*, as users in this group can access _all_ topics, independent of TWikiaccess controls.83 <br /> %X% *This is a very important step*, as users in this group can access _all_ topics, independent of %WIKITOOLNAME% access controls. 80 84 81 85 TWikiAccessControl has more information on setting up access controls. … … 83 87 %X% At this time TWikiAccessControls cannot control access to files in the =pub= area, unless they are only accessed through the =viewfile= script. If your =pub= directory is set up in the webserver to allow open access you may want to add =.htaccess= files in there to restrict access. 84 88 85 %T% You can create a custom version of the TWikiRegistration form by copying the topic, and then deleting or adding input tags in your copy. The =name=""= parameter of the input tags must start with: ="Twk0..."= (if this is an optional entry), or ="Twk1..."= (if this is a required entry). This ensures that the fields are carried over into the user home page correctly. Do *not* modify the version of TWikiRegistration shipped with TWiki, as your changes will be overwritten next time you upgrade.89 %T% You can create a custom version of the TWikiRegistration form by copying the topic, and then deleting or adding input tags in your copy. The =name=""= parameter of the input tags must start with: ="Twk0..."= (if this is an optional entry), or ="Twk1..."= (if this is a required entry). This ensures that the fields are carried over into the user home page correctly. Do *not* modify the version of TWikiRegistration shipped with %WIKITOOLNAME%, as your changes will be overwritten next time you upgrade. 86 90 87 91 %T% The default new user template page is in [[%SYSTEMWEB%.NewUserTemplate][%SYSTEMWEB%.NewUserTemplate]]. The same variables get expanded as in the [[template topics]]. You can create a custom new user home page by creating the [[%USERSWEB%.NewUserTemplate][%USERSWEB%.NewUserTemplate]] topic, which will then override the default. 88 92 89 93 #ApacheLogin 90 ---+++ Apache Login (select =TWiki::LoginManager::ApacheLogin= in configure)91 92 Using this method TWikidoes not authenticate users internally. Instead it depends on the =REMOTE_USER= environment variable, which is set when you enable authentication in the webserver.94 ---+++ Apache Login (select =TWiki::LoginManager::ApacheLogin=) 95 96 Using this method %WIKITOOLNAME% does not authenticate users internally. Instead it depends on the =REMOTE_USER= environment variable, which is set when you enable authentication in the webserver. 93 97 94 98 The advantage of this scheme is that if you have an existing website authentication scheme using Apache modules such as =mod_auth_ldap= or =mod_auth_mysql= you can just plug in directly to them. … … 96 100 The disadvantage is that because the user identity is cached in the browser, you can log in, but you can't log out again unless you restart the browser. 97 101 98 TWikimaps the =REMOTE_USER= that was used to log in to the webserver to a WikiName using the table in %USERSWEB%.TWikiUsers. This table is updated whenever a user registers, so users can choose not to register (in which case their webserver login name is used for their signature) or register (in which case that login name is mapped to their WikiName).99 100 The same private =.htpasswd= file used in TWikiTemplate Login can be used to authenticate Apache users, using the Apache Basic Authentication support.101 102 *Warning:* Do *not* use the Apache =htpasswd= program with =.htpasswd= files generated by TWiki! =htpasswd= wipes out email addresses that TWikiplants in the info fields of this file.102 %WIKITOOLNAME% maps the =REMOTE_USER= that was used to log in to the webserver to a WikiName using the table in %USERSWEB%.TWikiUsers. This table is updated whenever a user registers, so users can choose not to register (in which case their webserver login name is used for their signature) or register (in which case that login name is mapped to their WikiName). 103 104 The same private =.htpasswd= file used in %WIKITOOLNAME% Template Login can be used to authenticate Apache users, using the Apache Basic Authentication support. 105 106 *Warning:* Do *not* use the Apache =htpasswd= program with =.htpasswd= files generated by %WIKITOOLNAME%! =htpasswd= wipes out email addresses that %WIKITOOLNAME% plants in the info fields of this file. 103 107 104 108 ---++++ Enabling Apache Login using =mod_auth= 105 109 You can use any other Apache authentication module that sets REMOTE_USER. 106 110 1 Use [[%SCRIPTURLPATH{"configure"}%#LoginManager][configure]] to select the =TWiki::LoginManager::ApacheLogin= login manager. 107 1 Use [[%SCRIPTURLPATH{"configure"}%#PasswordManager][configure]] to set up TWikito create the right kind of =.htpasswd= entries.111 1 Use [[%SCRIPTURLPATH{"configure"}%#PasswordManager][configure]] to set up %WIKITOOLNAME% to create the right kind of =.htpasswd= entries. 108 112 1 Create a =.htaccess= file in the =twiki/bin= directory.<br />%H% There is an template for this file in =twiki/bin/.htaccess.txt= that you can copy and change. The comments in the file explain what need to be done.<br />%H% If you got it right, the browser should now ask for login name and password when you click on the <u>Edit</u>. If =.htaccess= does not have the desired effect, you may need to "AllowOverride All" for the directory in =httpd.conf= (if you have root access; otherwise, e-mail web server support) 109 113 <br /> %X% At this time TWikiAccessControls do not control access to files in the =pub= area, unless they are only accessed through the =viewfile= script. If your =pub= directory is set up to allow open access you may want to add =.htaccess= files in there as well to restrict access 110 1 You can create a custom version of the TWikiRegistration form by copying the default topic, and then deleting or adding input tags in your copy. The =name=""= parameter of the input tags must start with: ="Twk0..."= (if this is an optional entry), or ="Twk1..."= (if this is a required entry). This ensures that the fields are carried over into the user home page correctly. Do *not* modify the version of TWikiRegistration shipped with TWiki, as your changes will be overwritten next time you upgrade.114 1 You can create a custom version of the TWikiRegistration form by copying the default topic, and then deleting or adding input tags in your copy. The =name=""= parameter of the input tags must start with: ="Twk0..."= (if this is an optional entry), or ="Twk1..."= (if this is a required entry). This ensures that the fields are carried over into the user home page correctly. Do *not* modify the version of TWikiRegistration shipped with %WIKITOOLNAME%, as your changes will be overwritten next time you upgrade. 111 115 <br />The default new user template page is in [[%SYSTEMWEB%.NewUserTemplate][%SYSTEMWEB%.NewUserTemplate]]. The same variables get expanded as in the [[template topics]]. You can create a custom new user home page by creating the [[%USERSWEB%.NewUserTemplate][%USERSWEB%.NewUserTemplate]] topic, which will then override the default. 112 116 1 Register yourself in the TWikiRegistration topic. … … 114 118 1 Create a new topic to check if authentication works. 115 119 1 *Edit the %USERSWEB%.TWikiAdminGroup topic in the %USERSWEB% web to include users with system administrator status.* 116 <br /> %X% *This is a very important step*, as users in this group can access _all_ topics, independent of TWikiaccess controls.120 <br /> %X% *This is a very important step*, as users in this group can access _all_ topics, independent of %WIKITOOLNAME% access controls. 117 121 TWikiAccessControl has more information on setting up access controls. 118 122 … … 126 130 ---++ Sessions 127 131 128 TWikiuses the CPAN:CGI::Session and CPAN:CGI::Cookie modules to track sessions. These modules are de facto standards for session management among Perl programmers. If you can't use Cookies for any reason, CPAN:CGI::Session also supports session tracking using the client IP address.129 130 You don't _have_ to enable sessions to support logins in TWiki. However it is *strongly* recommended. TWiki needs some way to remember the fact that you logged in from a particular browser, and it uses sessions to do this. If you don;t enable sessions, TWikiwill try hard to remember you, but due to limitations in the browsers it may also forget you (and then suddenly remember you again later!). So for the best user experience, you should enable sessions.131 132 There are a number of TWikiVariables available that you can use to interrogate your current session. You can even add your own session variables to the TWikicookie. Session variables are referred to as "sticky" variables.132 %WIKITOOLNAME% uses the CPAN:CGI::Session and CPAN:CGI::Cookie modules to track sessions. These modules are de facto standards for session management among Perl programmers. If you can't use Cookies for any reason, CPAN:CGI::Session also supports session tracking using the client IP address. 133 134 You don't _have_ to enable sessions to support logins in %WIKITOOLNAME%. However it is *strongly* recommended. %WIKITOOLNAME% needs some way to remember the fact that you logged in from a particular browser, and it uses sessions to do this. If you don;t enable sessions, %WIKITOOLNAME% will try hard to remember you, but due to limitations in the browsers it may also forget you (and then suddenly remember you again later!). So for the best user experience, you should enable sessions. 135 136 There are a number of TWikiVariables available that you can use to interrogate your current session. You can even add your own session variables to the %WIKITOOLNAME% cookie. Session variables are referred to as "sticky" variables. 133 137 134 138 ---+++ Getting, Setting, and Clearing Session Variables 135 139 136 You can get, set, and clear session variables from within TWiki web pages or by using script parameters. This allows you to use the session as a personal "persistent memory space" that is not lost until the web browser is closed. Also note that if a session variable has the same name as a TWiki preference, the session variables value takes precedence over the TWikipreference. *This allows for per-session preferences.*140 You can get, set, and clear session variables from within %WIKITOOLNAME% web pages or by using script parameters. This allows you to use the session as a personal "persistent memory space" that is not lost until the web browser is closed. Also note that if a session variable has the same name as a %WIKITOOLNAME% preference, the session variables value takes precedence over the %WIKITOOLNAME% preference. *This allows for per-session preferences.* 137 141 138 142 To make use of these features, use the tags: … … 148 152 ---+++ Cookies and Transparent Session IDs 149 153 150 TWiki normally uses cookies to store session information on a client computer. Cookies are a common way to pass session information from client to server. TWiki cookies simply hold a unique session identifier that is used to look up a database of session information on the TWikiserver.151 152 For a number of reasons, it may not be possible to use cookies. In this case, TWikihas a fallback mechanism; it will automatically rewrite every internal URL it sees on pages being generated to one that also passes session information.154 %WIKITOOLNAME% normally uses cookies to store session information on a client computer. Cookies are a common way to pass session information from client to server. %WIKITOOLNAME% cookies simply hold a unique session identifier that is used to look up a database of session information on the %WIKITOOLNAME% server. 155 156 For a number of reasons, it may not be possible to use cookies. In this case, %WIKITOOLNAME% has a fallback mechanism; it will automatically rewrite every internal URL it sees on pages being generated to one that also passes session information. 153 157 154 158 #UsernameVsLoginName 155 ---++ TWikiUsername vs. Login Username159 ---++ Username vs. Login Username 156 160 157 161 This section applies only if you are using authentication with existing login names (i.e. mapping from login names to WikiNames). … … 224 228 225 229 %STOPINCLUDE% 226 __Related Topics:__ AdminDocumentationCategory, TWikiAccessControl, TWiki:TWiki. TWikiUserAuthenticationSupplement, TWiki:TWiki.SecuringTWikiSite230 __Related Topics:__ AdminDocumentationCategory, TWikiAccessControl, TWiki:TWiki.UserAuthenticationSupplement, TWiki:TWiki.SecuringTWikiSite
Note: See TracChangeset
for help on using the changeset viewer.
