Módosítások

DrupalShibbolethReadmeDev

4 811 bájt hozzáadva, 2015. január 22., 00:11
Profile module
Drupal '''shib_auth''' module enables [http://shibboleth.internet2.edu Shibboleth] authentication for [http://drupal.org Drupal CMS].
 
{{STOP|This document is written for module version 4.0-x ('''development branch'''). Please consult the [[#Change log]] for the revisions of this document for the previous releases.}}
== Installation and bootstrapping ==
{{STOP|The following documentation assumes that
* You [https://wiki.shibboleth.net/confluence/display/SHIB2/FlowsAndConfig understand how Shibboleth works]
* You have [https://wiki.shibboleth.net/confluence/display/SHIB2/Installation successfully installed and configured Shibboleth SP] on your host running Drupal.
}}
=== Installing the module ===
# Download module source for your Drupal version from the [http://drupal.org/project/shib_auth project page].
# Enable module at '''<code>Administer -> Site building -> Modules</code>'''
==== Compatibility ====
The module is supported for Drupal 6assumes that you use Shibboleth SP 2.x. No new features and patches (excluding security fixes) are backported It's possible to 5.x. Drupal 7 support will be added after it becomes an official stable version. If you want to contribute to development or porting, please contact '''aai _AT_ niif _DOT_ hu'''! Both use the module with Shibboleth SP 1.3 and Shibboleth 2.x are , but that version is not supported, although some features will require Shibboleth 2.xanymore.
=== Upgrading the module ===
The upgrade script makes slight changes to the database. You only need to run this script once, however running it several times does no harm to your installation apart from showing some SQL errors.
{{NOTE_EN|although the upgrade script was designed to be robust, please '''back up your database''' before upgrading.}}
==== Moving from Drupal 6 to Drupal 7 ====
To migrate your working installation to D7, first you must update your module to the latest 4.x version. After that, you can perform the Drupal update.
=== Get it running ===
==== Configuring Shibboleth ====
You should be familiar with protecting resources with Shibboleth before using this module. (See [https://spaceswiki.internet2shibboleth.edunet/confluence/display/SHIB2/NativeSPProtectContent Shibboleth Wiki] for comprehensive information) Please check that Shibboleth authentication is working for the location of your Drupal installation and all the necessary attributes are exported to the headers. You can enable [[Drupal Shibboleth module#DEBUG mode | DEBUG mode]] to dump the whole '''$_SERVER''' array. If you can see Shibboleth attributes there, you're fine.
In Shibboleth there are two modes for protecting resources:
}}
===== Example Shibboleth configuration =====
{{NOTE_EN|this example uses lazy sessions. Configuration for Shibboleth 1.3 is quite similar.}}
'''/etc/shibboleth/shibboleth2.xml snippet''':
AuthType Shibboleth
ShibRequireSession Off
# the following single line is only valid for Shib2
ShibUseHeaders On
require shibboleth
</Location>
</source>
 
 
{{ATTENTION_EN|You '''MUST''' use <code>ShibUseHeaders On</code> if you use Shibboleth2 with '''<code>mod_rewrite</code>'''.
 
<code>mod_rewrite</code> prefixes CGI environment variables with '''<code>REDIRECT_</code>''', so you have to instruct Shibboleth2 to use headers instead.
 
Shibboleth 1.3 always uses headers, therefore the <code>ShibUseHeaders</code> directive is invalid with Shibboleth 1.3.}}
==== DEBUG mode ====
If you enable DEBUG mode on the module configuration interface, you can dump the whole '''$_SERVER''' array, '''$_SESSION''' arrays and additionally the '''$user''' object, if the user is logged in. This mode shows you all the available attributes and helps you diagnosing possible Shibboleth attribute problems.
:: <small>Keep in mind that some users might have a specific attribute while others don't.</small>
Both fields can have the same value, if you wish.
 
===== Redirecting authenticated users to HTTPS =====
It's a common problem if Shibboleth SP is configured on HTTPS only (<code>handlerSSL="true"</code>), while the site also works on plain HTTP. By using ''Force HTTPS on login'' feature, you can redirect your users to HTTPS at login time. This way you can have your anonymous users view your site unencrypted (which saves some CPU cycles), but once they login, they get redirected to HTTPS (which is the only secure use of Shibboleth SP).
 
{{NOTE_EN|If you don't see Shibboleth attributes in DEBUG although you have double checked that you have set <code>AuthType shibboleth</code>, <code>require shibboleth</code> in your <code>.htaccess</code> file, you most probably need to turn this feature on.}}
== Understanding features ==
# Enable Shibboleth protection
# Login with your own credentials, you should have 'Administrator' rights now.
==== Pre-creating users ====
Versions before 4.0 allowed pre-creating users without any tweaks; if the username matched, the user was logged in.
 
Since 4.0 the module only logs in users who exist in <code>{shib_authmap}</code> and the update script only takes care of users tagged with 'shib_auth' in <code>{authmap}</code>. When there is no mapping in the <code>{shib_authmap}</code>, a new user is attempted to be created, which fails because of the mail being duplicated. So what was accidentally working with pre-created users, do not work anymore with 4.0.
To pre-create users, you should first create the Drupal users in your preferred way (either by using the administration interface or by direct SQL query), and then you '''MUST''' manually run the following '''three queries''': <source lang="SQL">INSERT INTO shib_authmap (uid, targeted_id) SELECT uid, name FROM users WHERE uid > 1 AND (uid) NOT IN (SELECT uid FROM shib_authmap); INSERT INTO authmap (uid, authname) SELECT uid, targeted_id FROM shib_authmap WHERE (uid) NOT IN (SELECT uid FROM authmap); UPDATE authmap SET module ='shib_auth'WHERE (uid) IN (SELECT uid FROM shib_authmap);</source>  {{NOTE_EN|These queries add all your existing users to <code>shib_authmap</code> with their usernames and make sure that your <code>authmap</code> table contains all of the user entries. You should optimize these queries if you have a large number of users.}} {{ATTENTION_EN|You should repeat these queries each time after you add pre-created users.}} = Dynamic role == Role assignment ===
It's possible to assign roles to users based on their Shibboleth attributes.
* '''Role(s)''': checklist of roles to be assigned to the matching users
Revoking==== Dynamic rules (default) ====Dynamic rules add roles to the user, but '''do not save them to the user's profile'''. This means that* the roles assigned by dynamic rules are '''NOT displayed on the user page''', even though the permissions assigned to the role are in effect* the roles assigned by dynamic rules are '''automatically revoked''' if the Shibboleth attributes change (ie. <code>eduPersonAffiliation</code> changes from <code>student</adding a code> to <code>alum</code>),* thus if the user logs in by other means than Shibboleth attribute , the rule will take effect immediately on next page refresh. The same applies when not be triggered, so the set of headers is happened to roles will not be changedassigned.
{{NOTE_EN|although dynamic Additional roles are can be assigned statically to the user (as an individual) by the administrator as normally. Every logged in user gets the role <code>Authenticated user</code> automatically.==== Sticky rules ====On the other hand, sticky rules do '''save the roles to the user'NOTs profile''' . Thus* the roles assigned by sticky rules are displayed on the user page, * the permissions assigned to roles are not revoked automatically by the module,* the role are roles will be in effect for regardless of the userlogin procedure. <br><small>This is a feature, not a bug</small>}}
Additional roles === User profile mapping ===From the 7.x-4.2 version (D6 is not supported) it is possible to define a mapping between Shibboleth attributes and Drupal Fields. You must have the ''Field UI'' and the ''Shibboleth profile fields'' modules enabled to use this functionality. Unlike other features of the module, this mapping is configured together with the field definition. Go to ''Administration » Configuration » People » Account settings » Manage fields'' (<code>admin/config/people/accounts/fields</code>) and create a new field or edit an existing one. The Shibboleth mapping is available on the Field Edit form and can be used in three ways:* ''Disabled'': no mapping (this is the default);* ''Initial value from Shibboleth, later editable by User'': the value of the mapping is only assigned statically to the user (as an individual) field if the field has no values;* ''Always update value on User login, not editable by User'': the administrator as normallyfield is updated on every login. Every logged in user gets  You can use the values of the role server variables by referring to them with square brackets like <code>Authenticated user[sn]</code> automatically.You can reference multiple server variables in one mapping. Anything that is not matched to a server variable will be treated as string and copied to the value of the field. The server variable match is case insensitive. As an example, consider the user's request containing the following server variables (regardless of being set by Shibboleth or by something else): [givenName] -> John [sn] -> Doe [email] -> jdoe@example.com
The following mappings would produce the results as indicated:
{|
|<code>[sn], [givenName] <[email]></code> || '''''Doe, John <jdoe@example.com>''''' ||
|-
|<code>[firstName] [sn]</code> || '''''[firstname] Doe''''' (note the mistaken header name)
|}
=== Account linking ===
There might be cases when you have a number of existing users and you want them to (optionally) log in through the federation. If you enable '''account linking''', a user can add her SSO login to her existing Drupal account. The process of adding an SSO login -> Drupal account association is the following (all steps are performed by the user):
* If the administrator disables this feature, no new associations can be stored. Existing associations remain in effect.
* On a new user logon, the one cannot choose the Drupal username of another user (when ''user-defined usernames'' is active). For account linking, the user must be already logged in.
* Currently account linking link is not displayed if the user has been logged in using Shibboleth. If you want to support users with multiple federated identities, please file a feature request.
}}
{{ATTENTION_EN|Dynamic roles are roles based on server variables, not users. These may well be different on username/password logon and Shibboleth logon.
{{INFO_EN|;Keep in mind if you leave this option off:
* if the Shibboleth session is lost, all the Shibboleth-derived attributes disappear, therefore the user loses the [[#Dynamic role assignment|assigned Shibboleth dynamic roles]]** on the other handare lost, the roles assigned to the ''Drupal account of the user'' persist as long as the Drupal session is validtoo* Shibboleth session might get lost if you use a clustered SP without a central session cache* '''Never ever leave this option off if you want support Single Logout'''. Otherwise the user will remain logged in to Drupal even after doing single (global) logout.}}
==== URL to redirect to after logout ====
By using this option, you can auto-login users who are already logged in to the IdP even if you are using lazy sessions. If auto-login can not be performed, the user returns to Drupal unauthenticated without seeing any error message.
{{ATTENTION_EN|You need to instruct Shibboleth to redirect errors back to Drupal to handle passive authentication failures. This is done by setting <code>redirectErrors</code> parameter in the RequestMap. See [https://spaceswiki.internet2shibboleth.edunet/confluence/display/SHIB2/NativeSPContentSettings Shibboleth wiki] for details.
'''IMPORTANT''': current implementation does not handle any errors except for NoPassive error. This means, that on every possible Shibboleth SP error you will get an unauthenticated Drupal page instead of a Shibboleth error page.}}
; Bug fixes
* The module now works with caching enabled
* Code refactoring
; New features
* Allow specifying Drupal username, thus support opaque identifiers
* Support for sticky rules (roles saved permanently to the users' profile)* Basic support for account linking* Basic support for getting user consent on personal data* Support for isPassive and forceAuthn session initiation* Support for redirecting users to HTTPS on login
[[Category: AAI]] [[Category: Drupal]] [[Category: Shibboleth SP]] [[Category: HOWTO]] [[Category: English]]

Navigációs menü