dazimo

authsources.php

Feb 22nd, 2023 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 12.51 KB | None | 0 0
  1. <?php
  2.  
  3. $config = [
  4.     /*
  5.      * When multiple authentication sources are defined, you can specify one to use by default
  6.      * in order to authenticate users. In order to do that, you just need to name it "default"
  7.      * here. That authentication source will be used by default then when a user reaches the
  8.      * SimpleSAMLphp installation from the web browser, without passing through the API.
  9.      *
  10.      * If you already have named your auth source with a different name, you don't need to change
  11.      * it in order to use it as a default. Just create an alias by the end of this file:
  12.      *
  13.      * $config['default'] = &$config['your_auth_source'];
  14.      */
  15.  
  16.     // This is a authentication source which handles admin authentication.
  17.     'admin' => [
  18.         // The default is to use core:AdminPassword, but it can be replaced with
  19.         // any authentication source.
  20.  
  21.         'core:AdminPassword',
  22.     ],
  23.  
  24.     /*
  25.     // An authentication source which can authenticate against both SAML 2.0
  26.     // and Shibboleth 1.3 IdPs.
  27.     'default-sp' => [
  28.         'saml:SP',
  29.  
  30.         // The entity ID of this SP.
  31.         // Can be NULL/unset, in which case an entity ID is generated based on the metadata URL.
  32.         'entityID' => null,
  33.  
  34.         // The entity ID of the IdP this SP should contact.
  35.         // Can be NULL/unset, in which case the user will be shown a list of available IdPs.
  36.         'idp' => null,
  37.  
  38.         // The URL to the discovery service.
  39.         // Can be NULL/unset, in which case a builtin discovery service will be used.
  40.         'discoURL' => null,
  41.  
  42.          *
  43.          * The attributes parameter must contain an array of desired attributes by the SP.
  44.          * The attributes can be expressed as an array of names or as an associative array
  45.          * in the form of 'friendlyName' => 'name'. This feature requires 'name' to be set.
  46.          * The metadata will then be created as follows:
  47.          * <md:RequestedAttribute FriendlyName="friendlyName" Name="name" />
  48.          *
  49.          *
  50.         'name' => [
  51.             'en' => 'A service',
  52.             'no' => 'En tjeneste',
  53.         ],
  54.  
  55.         'attributes' => [
  56.             'attrname' => 'urn:oid:x.x.x.x',
  57.         ],
  58.         'attributes.required' => [
  59.             'urn:oid:x.x.x.x',
  60.         ],
  61.  
  62.     ],
  63. */
  64.  
  65.     /*
  66.     'example-sql' => [
  67.         'sqlauth:SQL',
  68.         'dsn' => 'pgsql:host=sql.example.org;port=5432;dbname=simplesaml',
  69.         'username' => 'simplesaml',
  70.         'password' => 'secretpassword',
  71.         'query' => 'SELECT uid, givenName, email, eduPersonPrincipalName FROM users WHERE uid = :username ' .
  72.             'AND password = SHA2(CONCAT((SELECT salt FROM users WHERE uid = :username), :password), 256);',
  73.     ],
  74.     */
  75.  
  76.     /*
  77.     'example-static' => [
  78.         'exampleauth:StaticSource',
  79.         'uid' => ['testuser'],
  80.         'eduPersonAffiliation' => ['member', 'employee'],
  81.         'cn' => ['Test User'],
  82.     ],
  83.     */
  84.  
  85.  
  86.     'example-userpass' => [
  87.         'exampleauth:UserPass',
  88.  
  89.         // Give the user an option to save their username for future login attempts
  90.         // And when enabled, what should the default be, to save the username or not
  91.         //'remember.username.enabled' => false,
  92.         //'remember.username.checked' => false,
  93.  
  94.         'student:studentpass' => [
  95.             'username' => ['test'],
  96.             'eduPersonAffiliation' => ['member', 'student'],
  97.         ],
  98.         'employee:employeepass' => [
  99.             'username' => ['employee'],
  100.             'eduPersonAffiliation' => ['member', 'employee'],
  101.         ],
  102.     ],
  103.  
  104.  
  105.     /*
  106.     'crypto-hash' => [
  107.         'authcrypt:Hash',
  108.         // hashed version of 'verysecret', made with bin/pwgen.php
  109.         'professor:{SSHA256}P6FDTEEIY2EnER9a6P2GwHhI5JDrwBgjQ913oVQjBngmCtrNBUMowA==' => [
  110.             'uid' => ['prof_a'],
  111.             'eduPersonAffiliation' => ['member', 'employee', 'board'],
  112.         ],
  113.     ],
  114.     */
  115.  
  116.     /*
  117.     'htpasswd' => [
  118.         'authcrypt:Htpasswd',
  119.         'htpasswd_file' => '/var/www/foo.edu/legacy_app/.htpasswd',
  120.         'static_attributes' => [
  121.             'eduPersonAffiliation' => ['member', 'employee'],
  122.             'Organization' => ['University of Foo'],
  123.         ],
  124.     ],
  125.     */
  126.  
  127.     /*
  128.     // This authentication source serves as an example of integration with an
  129.     // external authentication engine. Take a look at the comment in the beginning
  130.     // of modules/exampleauth/lib/Auth/Source/External.php for a description of
  131.     // how to adjust it to your own site.
  132.     'example-external' => [
  133.         'exampleauth:External',
  134.     ],
  135.     */
  136.  
  137.     /*
  138.     'yubikey' => [
  139.         'authYubiKey:YubiKey',
  140.          'id' => '000',
  141.         // 'key' => '012345678',
  142.     ],
  143.     */
  144.  
  145.     /*
  146.     'facebook' => [
  147.         'authfacebook:Facebook',
  148.         // Register your Facebook application on http://www.facebook.com/developers
  149.         // App ID or API key (requests with App ID should be faster; https://github.com/facebook/php-sdk/issues/214)
  150.         'api_key' => 'xxxxxxxxxxxxxxxx',
  151.         // App Secret
  152.         'secret' => 'xxxxxxxxxxxxxxxx',
  153.         // which additional data permissions to request from user
  154.         // see http://developers.facebook.com/docs/authentication/permissions/ for the full list
  155.         // 'req_perms' => 'email,user_birthday',
  156.         // Which additional user profile fields to request.
  157.         // When empty, only the app-specific user id and name will be returned
  158.         // See https://developers.facebook.com/docs/graph-api/reference/v2.6/user for the full list
  159.         // 'user_fields' => 'email,birthday,third_party_id,name,first_name,last_name',
  160.     ],
  161.     */
  162.  
  163.     /*
  164.     // Twitter OAuth Authentication API.
  165.     // Register your application to get an API key here:
  166.     //  http://twitter.com/oauth_clients
  167.     'twitter' => [
  168.         'authtwitter:Twitter',
  169.         'key' => 'xxxxxxxxxxxxxxxx',
  170.         'secret' => 'xxxxxxxxxxxxxxxx',
  171.         // Forces the user to enter their credentials to ensure the correct users account is authorized.
  172.         // Details: https://dev.twitter.com/docs/api/1/get/oauth/authenticate
  173.         'force_login' => false,
  174.     ],
  175.     */
  176.  
  177.     /*
  178.     // Microsoft Account (Windows Live ID) Authentication API.
  179.     // Register your application to get an API key here:
  180.     //  https://apps.dev.microsoft.com/
  181.     'windowslive' => [
  182.         'authwindowslive:LiveID',
  183.         'key' => 'xxxxxxxxxxxxxxxx',
  184.         'secret' => 'xxxxxxxxxxxxxxxx',
  185.     ],
  186.     */
  187.  
  188.     /*
  189.     // Example of a LDAP authentication source.
  190.     'example-ldap' => [
  191.         'ldap:LDAP',
  192.  
  193.         // Give the user an option to save their username for future login attempts
  194.         // And when enabled, what should the default be, to save the username or not
  195.         //'remember.username.enabled' => false,
  196.         //'remember.username.checked' => false,
  197.  
  198.         // The hostname of the LDAP server.
  199.         'hostname' => 'ldap.example.org',
  200.  
  201.         // Whether SSL/TLS should be used when contacting the LDAP server.
  202.         'enable_tls' => true,
  203.  
  204.         // Whether debug output from the LDAP library should be enabled.
  205.         // Default is FALSE.
  206.         'debug' => false,
  207.  
  208.         // The timeout for accessing the LDAP server, in seconds.
  209.         // The default is 0, which means no timeout.
  210.         'timeout' => 0,
  211.  
  212.         // The port used when accessing the LDAP server.
  213.         // The default is 389.
  214.         'port' => 389,
  215.  
  216.         // Set whether to follow referrals. AD Controllers may require FALSE to function.
  217.         'referrals' => true,
  218.  
  219.         // Which attributes should be retrieved from the LDAP server.
  220.         // This can be an array of attribute names, or NULL, in which case
  221.         // all attributes are fetched.
  222.         'attributes' => null,
  223.  
  224.         // The pattern which should be used to create the users DN given the username.
  225.         // %username% in this pattern will be replaced with the users username.
  226.         //
  227.         // This option is not used if the search.enable option is set to TRUE.
  228.         'dnpattern' => 'uid=%username%,ou=people,dc=example,dc=org',
  229.  
  230.         // As an alternative to specifying a pattern for the users DN, it is possible to
  231.         // search for the username in a set of attributes. This is enabled by this option.
  232.         'search.enable' => false,
  233.  
  234.         // The DN which will be used as a base for the search.
  235.         // This can be a single string, in which case only that DN is searched, or an
  236.         // array of strings, in which case they will be searched in the order given.
  237.         'search.base' => 'ou=people,dc=example,dc=org',
  238.  
  239.         // The attribute(s) the username should match against.
  240.         //
  241.         // This is an array with one or more attribute names. Any of the attributes in
  242.         // the array may match the value the username.
  243.         'search.attributes' => ['uid', 'mail'],
  244.  
  245.         // Additional LDAP filters appended to the search attributes
  246.         //'search.filter' => '(objectclass=inetorgperson)',
  247.  
  248.         // The username & password the SimpleSAMLphp should bind to before searching. If
  249.         // this is left as NULL, no bind will be performed before searching.
  250.         'search.username' => null,
  251.         'search.password' => null,
  252.  
  253.         // If the directory uses privilege separation,
  254.         // the authenticated user may not be able to retrieve
  255.         // all required attribures, a privileged entity is required
  256.         // to get them. This is enabled with this option.
  257.         'priv.read' => false,
  258.  
  259.         // The DN & password the SimpleSAMLphp should bind to before
  260.         // retrieving attributes. These options are required if
  261.         // 'priv.read' is set to TRUE.
  262.         'priv.username' => null,
  263.         'priv.password' => null,
  264.  
  265.     ],
  266.     */
  267.  
  268.     /*
  269.     // Example of an LDAPMulti authentication source.
  270.     'example-ldapmulti' => [
  271.         'ldap:LDAPMulti',
  272.  
  273.         // Give the user an option to save their username for future login attempts
  274.         // And when enabled, what should the default be, to save the username or not
  275.         //'remember.username.enabled' => false,
  276.         //'remember.username.checked' => false,
  277.  
  278.         // Give the user an option to save their organization choice for future login
  279.         // attempts. And when enabled, what should the default be, checked or not.
  280.         //'remember.organization.enabled' => false,
  281.         //'remember.organization.checked' => false,
  282.  
  283.         // The way the organization as part of the username should be handled.
  284.         // Three possible values:
  285.         // - 'none':   No handling of the organization. Allows '@' to be part
  286.         //             of the username.
  287.         // - 'allow':  Will allow users to type 'username@organization'.
  288.         // - 'force':  Force users to type 'username@organization'. The dropdown
  289.         //             list will be hidden.
  290.         //
  291.         // The default is 'none'.
  292.         'username_organization_method' => 'none',
  293.  
  294.         // Whether the organization should be included as part of the username
  295.         // when authenticating. If this is set to TRUE, the username will be on
  296.         // the form <username>@<organization identifier>. If this is FALSE, the
  297.         // username will be used as the user enters it.
  298.         //
  299.         // The default is FALSE.
  300.         'include_organization_in_username' => false,
  301.  
  302.         // A list of available LDAP servers.
  303.         //
  304.         // The index is an identifier for the organization/group. When
  305.         // 'username_organization_method' is set to something other than 'none',
  306.         // the organization-part of the username is matched against the index.
  307.         //
  308.         // The value of each element is an array in the same format as an LDAP
  309.         // authentication source.
  310.         'employees' => [
  311.             // A short name/description for this group. Will be shown in a dropdown list
  312.             // when the user logs on.
  313.             //
  314.             // This option can be a string or an array with language => text mappings.
  315.             'description' => 'Employees',
  316.  
  317.             // The rest of the options are the same as those available for
  318.             // the LDAP authentication source.
  319.             'hostname' => 'ldap.employees.example.org',
  320.             'dnpattern' => 'uid=%username%,ou=employees,dc=example,dc=org',
  321.         ],
  322.  
  323.         'students' => [
  324.             'description' => 'Students',
  325.  
  326.             'hostname' => 'ldap.students.example.org',
  327.             'dnpattern' => 'uid=%username%,ou=students,dc=example,dc=org',
  328.         ],
  329.     ],
  330.     */
  331. ];
  332.  
Advertisement
Add Comment
Please, Sign In to add comment