# --------------------------------------------------- # Optional authentication configuration options # --------------------------------------------------- # --------------------------------------------------- # Authentication adapter to use # --------------------------------------------------- # Available options are: # CaUsers : Database-powered authentication with secure password hashing. No additional setup required. # OpenLDAP : Authentication via OpenLDAP/slapd-based directory service # ActiveDirectory : Authentication via Microsoft Active Directory service # ExternalDB : Authentication using an external database # Shibboleth: Authentication via the Shibboleth SSO service # HTTPHeader : User info in HTTP Headers - web server handles login auth_adapter = __CA_AUTH_ADAPTER__ # User different authentication method for service calls? #auth_adapter_for_services = CaUsers # Require authentication for IIIF service calls? iiif_use_authentication = 1 # Set this to 1 to enable the CollectiveAccess password reset feature. # Note that a working email configuration is required for this to work. auth_allow_password_reset = 0 # Forces synchronization of groups from single-sign-on system every time a user logs in # If you can managing group affiliations locally in CollectiveAccess set this to 0 synchronize_groups_on_each_login = 0 # A list of controller names for which authentication will not be required #auth_not_required_for_controllers = [front] # Uncomment to display a 'manage account' link on the login page # manage_account_url = http://www.mysite.org/auth/manage # Optional fallback to authenticate against local ca_users user database if login with chosen # authentication adapter fails. This can be handy when you have existing locally managed CA users alongside # an organizational directory... or it can be a security hole if you don't. Leave disabled unless actually needed. allow_fallback_to_ca_users_auth = 0 # Allow bypassing of configured authentication adapter in favor of CaUsers local authentication. # When employing single-sign-on (SSO) services that redirect to an external login screen such as Shibboleth/SAML # this option provides a way for users without SSO credentials to gain access to the system. This can be # useful for debugging or providing third-party support for a system otherwise only accessible to those # in the SSO system. Of course, it also allows bypass of the SSO system, which may be seen as a security # issue in some cases. # # If enabled, then appending the parameter "forceUserAuth=1" to any URL while force use of the CaUsers # authentication adapter in the current session. Setting forceUserAuth=0 will revert to use of the # configured adapter. # # Ex. https://mysite.com/?forceUserAuth=1 allow_force_to_ca_users_auth = 0 # Login rate limiting. Failed logins using a user name and password (via the login form, HTTP basic auth or # web services) are counted per username and per client IP address. Once a limit is reached, further login # attempts are rejected until "login_rate_limit_window" seconds after the first counted failure. A successful # login resets the per-user count. Set the limit to 0 to disable it. # # The per-user limit protects individual accounts regardless of client IP address, but can be used to temporarily # lock a user out by deliberately failing logins with their user name. The per-IP limit catches a single client trying # many user names, but relies on client IP detection, which trusts the headers listed in "request_ip_headers" in # app.conf; only list headers there that your proxy sets, or clients can evade this limit by supplying their own. login_rate_limit_window = 900 login_rate_limit_max_failures_per_user = 10 login_rate_limit_max_failures_per_ip = 50 # Two-factor authentication. When enabled, users may opt in to requiring a code from an authenticator app # (or a single-use recovery code) after their password when logging in. It is never required for any user. # It applies to logins where a user name and password are entered into CollectiveAccess, including LDAP, # ExternalDB and the CaUsers bypass (allow_force_to_ca_users_auth). It does not apply to single-sign-on # adapters that use their own login screen (eg. Shibboleth); configure multi-factor authentication in # your identity provider instead. Users with two-factor authentication can't log in via IP address # authentication or HTTP basic auth, and must pass their code in the "code" argument when logging in # through the GraphQL API. Users set up two-factor authentication under Preferences; administrators can # reset it under Manage > Access > Users, or with "caUtils reset-mfa". # # Requires __CA_MFA_ENCRYPTION_KEY__ to be set in setup.php. If this option is turned off later, users who # set up two-factor authentication will be able to log in with only their password. mfa_enabled = 0 # Name shown for this system in authenticator apps. Defaults to "app_display_name" in app.conf. mfa_issuer = # Number of seconds a user has to enter their code after their password is accepted. mfa_pending_login_timeout = 300 # Maximum number of incorrect codes per user within "login_rate_limit_window" seconds. Set to 0 to disable. mfa_max_failures_per_user = 5 # Number of recovery codes generated for each user. mfa_recovery_code_count = 10 # Allow users to have a single-use code sent to the email address in their profile when they don't have # their authenticator app. Users must have an email address to set up two-factor authentication when enabled. mfa_email_fallback = 1 # Number of seconds an emailed code is valid for. mfa_email_code_lifetime = 600 # Maximum number of codes emailed to a user within "login_rate_limit_window" seconds. At most one code # is sent per minute regardless. Set to 0 to remove the overall limit. mfa_max_email_codes_per_user = 5 # Optional regular expressions to rewrite user name with when authenticating. Authentication will be performed using # the transformed user name. This can be helpful when the underlying authentication system expects user names in # a different format than expected by users (Eg. users use email addresses as user name but auth system expects # bare user names). "rewrite_username_with_regex" is used for matching; "rewrite_username_to_regex" is used for substitutions. rewrite_username_with_regex = rewrite_username_to_regex = # --------------------------------------------------- # Password policy # --------------------------------------------------- # # Password complexity may be enforced with the following rules: # # min_length = length [Minimum number of characters the password must contain.] # max_length = length [Maximum number of characters the password must contain.] # upper_case = count [Minimum number of upper case characters the password must contain.] # lower_case = count [Minimum number of lower case characters the password must contain.] # digits = count [Minimum number of numeric characters the password must contain.] # special_characters = count [Minimum number of special characters the password must contain.] # does_not_contain => [phrase list] [Phrases that the password should not contain.] # # You can specify any number of policies. Policies with a single rule (Eg. the "length_policy" below) # enforce a single criterion. Policies with multiple rules (Eg. the "content_policy" below) will validate # if the number of passing rules within the policy is greater than or equal to the policy's min_passing_rules # setting. If min_passing_rules is omitted a value of 1 is assumed. # password_policies = { length_policy = { min_length = 6 }, # content_policy = { # min_passing_rules = 3, # rules = { # digits = 1, # upper_case = 1, # lower_case = 1, # special_characters = 1 # } # } } # Check password strength and reject passwords that are too easy (apparently) to guess? # Passwords are checked using the zxcvbn password assessment library (https://github.com/bjeavons/zxcvbn-php). # zxcvbn returns a score from 0 to 4: # # 0 = password is extremely guessable (usually a dictionary word) # 1 = password is very guessable (usually a dictionary word with additional characters) # 2 = password is somewhat guessable # 3 = password is safely unguessable # 4 = password is highly unguessable # # If a minimum score is set any passwords not meeting this score will not be saved # #require_minimum_password_score = 3 # --------------------------------------------------- # Configuration for OpenLDAP / ADS Adapters # --------------------------------------------------- directories = { main = { # Authentication via Lightweight Directory Access Protocol (LDAP) # Note that this feature requires the "ldap" PHP module which is not checked # in the standard CollectiveAccess configuration checks. # Server location ldap_host = ldap.example.com, ldap_port = 389, # Record structure ldap_base_dn = "dc=example,dc=com", ldap_user_ou = ou=users, # Distinguished name to use for binding/authenticating users. The following optional replacements are available: # {username} = user name entered in login form. Is technically optional but should obviously be used. # {user_ou} = ldap_user_ou setting from above # {base_dn} = ldap_base_dn setting from above ldap_bind_rdn_format = "cn={username},{user_ou},{base_dn}", # We have seen directories where it's not possible to specify a generic DN for binding # all CollectiveAccess users because they're scattered over multiple organizational units. # In those cases you can use the following setting to search for the user records. CollectiveAccess # will then try to get the distinguished name for binding from the first result record. If this # is set to a non-zero value, ldap_bind_rdn_format will be ignored. OpenLDAP implementation only! # ldap_bind_rdn_filter = uid={username}, # # ldap_bind_rdn_filter_rdn = , # ldap_bind_rdn_filter_password = , # Some LDAP servers will not allow searches when bound anonymously. Set a service account login here # if you need to authenticate to the LDAP server in a general way before performing a user authentication # ldap_service_account_rdn = # ldap_service_account_password = # Map CollectiveAccess user record attributes to the corresponding fields in your directory # These are used when new CollectiveAccess user records are created with information from the # directory service. Note that a unique email address is mandatory for CollectiveAccess user records, # i.e. you should map this to a field that actually contains an email address for each user! ldap_attribute_email = mail, ldap_attribute_fname = givenName, ldap_attribute_lname = sn, # How do we find user records when a user doesn't exist in CollectiveAccess yet? # See http://php.net/manual/en/function.ldap-search.php # These two settings refer to the second and third parameter of ldap_search() ldap_user_search_dn_format = "cn={username},{user_ou},{base_dn}", ldap_user_search_filter_format = "cn={username}", # Attribute to compare username to? Usually memberuid, but could be something else (like "member") ldap_search_search_attribute = memberuid # Unless the user is member of one of these LDAP groups, they can't log in. # ldap_group_cn_list = [CollectiveAccessUsers], # How do we find group records to check for group membership? # These settings are for the OpenLDAP adapter only. See ldap_attribute_member_of # below for the Active Directory group membership check. Also see # http://php.net/manual/en/function.ldap-search.php # These two settings refer to the second and third parameter of ldap_search() ldap_group_search_dn_format = "dc=example,dc=com", ldap_group_search_filter_format = "cn={groupname}", # Lists of roles and groups that are *always* added to automatically created new users ldap_users_default_roles = [cataloguer], ldap_users_default_groups = [cataloguer], # Automatically activate new users? (otherwise they can't log in and you have to activate by hand) ldap_users_auto_active = 1, # The following setting is specific to the Active Directory authentication adapter. # It defines the name of the user record attribute that contains a list of # groups the user belongs to. It is used to check for group membership if the above # ldap_group_cn_list is set and not empty. ldap_attribute_member_of = memberOf, # --------------------------------------------------- # The following features are OpenLDAP only! # --------------------------------------------------- # Note that the LDAP groups here are searched using the # ldap_group_search_dn_format and ldap_group_search_filter_format settings from above. # Roles granted to newly created user from LDAP directory # Map LDAP group names to lists of CollectiveAccess role codes here. ldap_roles_group_map = { #Admins = { admin, moderator, researcher } }, # Groups granted to newly created user from LDAP directory # Map LDAP group names to lists of CollectiveAccess group codes here. ldap_groups_group_map = { #Admins = { admin, cataloguer } }, # If the following settings are set to non-zero values, a user's CollectiveAccess roles and/or groups # are synced with the OpenLDAP directory on every login attempt. Note that this overrides any changes # to role or group membership you may have done by hand using the "Access Control" menu. # A user's CollectiveAccess roles and groups are determined by the combination of # ldap_roles_group_map + ldap_users_default_roles and ldap_groups_group_map + ldap_users_default_groups ldap_sync_user_roles = 0, ldap_sync_user_groups = 0, } } # --------------------------------------------------- # End configuration for OpenLDAP / ADS Adapters # --------------------------------------------------- # --------------------------------------------------- # Authentication using an external database: ExternalDB adapter # --------------------------------------------------- # Note: the values below are defaults. They MUST be changed # to work with your own external authentication database # # Login for external auth database extdb_host = localhost extdb_username = your_auth_database_login extdb_password = your_auth_database_password extdb_database = your_auth_database_name extdb_db_type = mysql # The table and fields in the external database to use for authentication extdb_table = users extdb_username_field = email extdb_password_field = password # How the external database hashes passwords # For plain-text passwords use "none" # Possible values are: md5, sha1, none extdb_password_hash_type = md5 # How to determine from the external database if the user is active # If all users in the external database are active set extdb_default_active = 1 extdb_default_active = 0 extdb_active_field = status extdb_active_field_map = { Active = 1, active = 1, Disabled = 0, none = 0 } # How to determine from the external database what the class of user is # possible CA values are none, public and full # "public" means Pawtucket (front-end) login only, "full" means both Pawtucket and Providence (back-end) extdb_access_field = access extdb_access_field_map = { Member = public, Staff = full } extdb_default_access = none # Roles granted to login from external database extdb_roles_field = access # extdb value = assoc list of CA roles extdb_roles_field_map = { Member = { cataloguer } } extdb_default_roles = { } # Groups granted to login from external database extdb_groups_field = access # extdb value = assoc list of CA groups extdb_groups_field_map = { Member = { cataloguers } } extdb_default_groups = { cataloguers } # Fields to copy from external database to newly created CA user record # extdb field = ca_users field extdb_user_field_map = { email = email, firstname = fname, lastname = lname } # Fields to copy from external database to user preferences in newly created CA user record # extdb field = ca user pref extdb_user_pref_map = { cur_address1 = user_profile_address1, cur_address2 = user_profile_address2, cur_city = user_profile_city, cur_state = user_profile_state, cur_country = user_profile_country, cur_postal_code = user_profile_postalcode, primary_phone = user_profile_phone } # --------------------------------------------------- # Authentication via Shibboleth # --------------------------------------------------- # Note: the values below are defaults. They MUST be changed # to work with your own external authentication database # # This option requires working Shibboleth SP and IdP services # If you have an IdP talk to you system administrator about # configuring your server as a Service Provider (SP) for Shibboleth # This also requires that the PHP simplesamlphp library be installed # Your service provider shibboleth_service_provider = default-sp # Name of Shibboleth token cookie shibboleth_token_cookie = shib_test # Mapping of CA user fields (on the left) to Shibboleth attributes (on the right). # Available CA user fields: uid, email, fname, lname # uid and email are required fields and *MUST* be set shibboleth_attribute_map = { uid = uid, email = eduPersonPrincipalName, fname = firstname, lname = lastname } # Lists of roles and groups that are *always* added to automatically set all users at login shibboleth_users_default_roles = [cataloguer] shibboleth_users_default_groups = [cataloguer] # Attributes containing groups associated with user # Multiple attributes may be listed; entries present in any # of the listed attributes will be applied to the user shibboleth_group_attributes = [groups, memberOf, isMemberOf] # Mapping of Shibboleth/SAML groups (on the left) to CA groups (on the right) # Groups will be synchronized from the idp at login shibboleth_group_map = { # CACatalog = cataloguer, # CAResearch = researcher } # Emit detailed debugging information to the application log? shibboleth_debug = 0 # Create new CollectiveAccess user entries for user if one doesn't exist on successful login? # Set this to zero if you want to manually provision users in CollectiveAccess but have # authentication of those users performed by Shibboleth shibboleth_auto_create_new_users = 1 # --------------------------------------------------- # Authentication using an http header: HTTPHeader adapter # --------------------------------------------------- # Note: the values below are defaults. They MUST be changed # to work with your own web server based authentication # httpheader_username = "HTTP_SM_USER" httpheader_firstname = "HTTP_GIVENNAME" httpheader_lastname = "HTTP_SN" httpheader_email = "HTTP_MAIL"