Changes between Version 1 and Version 2 of proposals/SpringSecurity


Ignore:
Timestamp:
Sep 3, 2012, 2:14:27 AM (12 years ago)
Author:
fxp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • proposals/SpringSecurity

    v1 v2  
    44|| '''Contact(s)''' || [http://wiki.osgeo.org/wiki/User:Jeichar Jesse Eichar], Francois Prunayre ||
    55|| '''Last edited''' || ||
    6 || '''Status''' || draft ||
     6|| '''Status''' || Done ||
    77|| '''Assigned to release''' || 2.9.x ||
    88|| '''Resources''' || Funding Ifremer ||
     
    5151=== Configuration ===
    5252
    53 A config-security.xml file is added to:
     53A set of files config-security* is added in order to easily configure authentication mechanism:
    5454 * configure access for GeoNetwork services
    5555 * configure authentication provider(s)
    56 
    57 
    58 === LDAP improvements ===
    59 
    60 LDAP support is similar as the current one, creating a local user in GeoNetwork database. The following improvements have been done:
    61 
    62  * Support for non anonymous binding
    63  * Support full user property mapping to populate all information for a user (possibility to set default value for all fields)
    64 {{{
    65 #ldapUserContextMapper.mapping[USER TABLE COLUMN]=LDAP ATTRIBUTE,DEFAULT VALUE
    66 
    67 ldapUserContextMapper.mapping[name]=cn,
    68 ldapUserContextMapper.mapping[surname]=givenName,
    69 ldapUserContextMapper.mapping[mail]=mail,data@myorganization.org
    70 ldapUserContextMapper.mapping[organisation]=,myorganization
    71 ldapUserContextMapper.mapping[kind]=,
    72 ldapUserContextMapper.mapping[address]=,
    73 ldapUserContextMapper.mapping[zip]=,
    74 ldapUserContextMapper.mapping[state]=,
    75 ldapUserContextMapper.mapping[city]=,
    76 ldapUserContextMapper.mapping[country]=,
    77 ldapUserContextMapper.mapping[privilege]=listesiteweb,sample
    78 ldapUserContextMapper.mapping[profile]=,Guest
    79 }}}
    80  * Manage user groups and profiles from LDAP information or from local database
    81  * Support to retrieve a list of groups (and not only one) from an attribute or using a pattern
    82 A combination of group/profile could be defined in an LDAP attribute and extracted on login:
    83 
    84 Note : this will work with the multiple profil proposal (http://trac.osgeo.org/geonetwork/wiki/proposals/UserProfileByGroup)
    85 {{{
    86 -- Define a catalog admin:
    87 listesiteweb=SXT_*_Administrator
    88 
    89 -- Define a reviewer for the group GRANULAT
    90 Listesiteweb=SXT_GRANULAT_Reviewer
    91 
    92 -- Define a reviewer for the group GRANULAT and editor for MIMEL
    93 Listesiteweb=SXT_GRANULAT_Reviewer
    94 Listesiteweb=SXT_MIMEL_Editor
    95 
    96 -- Define a reviewer for the group GRANULAT and editor for MIMEL and RegisteredUser for NATURA2000
    97 Listesiteweb=SXT_GRANULAT_Reviewer
    98 Listesiteweb=SXT_MIMEL_Reviewer
    99 Listesiteweb=SXT_NATURA2000_RegisterdUser
    100 
    101 -- Only a registered user for GRANULAT
    102 Listesiteweb=SXT_GRANULAT_RegisteredUser
    103 }}}
    104 In that case, the configuration for extracting user profils and groups is:
    105 {{{
    106 ldap.privilege.pattern=SXT_(.*)_(.*)
    107 ldap.privilege.pattern.idx.profil=2
    108 ldap.privilege.pattern.idx.group=1
    109 }}}
    110  * Add synchronization task to remove user from local user database when removed from the LDAP
    111  * Add option to create user LDAP group in local database
     56  * Local database
     57  * LDAP
     58  * CAS+LDAP
     59  * CAS+local database
     60
     61
     62==== LDAP ====
     63
     64
     65===== Connection Settings =====
     66
     67To enable LDAP support:
     68
     69
     70 * add the CAS base URL property in config-security.properties::
     71
     72{{{
     73    # LDAP security properties
     74    ldap.base.provider.url=ldap://localhost:389
     75    ldap.base.dn=dc=fao,dc=org
     76    ldap.security.principal=cn=admin,dc=fao,dc=org
     77    ldap.security.credentials=ldap
     78
     79}}}
     80
     81  * ldap.base.provider.url: This tells the portal where the LDAP server is located. Make sure that the computer with the catalog can hit the computer with the LDAP server. Check to make sure that the appropriate ports are opened, etc.
     82  * ldap.base.dn=dc=fao,dc=org: this will usually look something like: "dc=organizationnamehere,dc=org"
     83  * ldap.security.principal & ldap.security.credentials: Define LDAP administrator user to use to bind to LDAP. If not define, an anonymous bind is made. Principal is the username and credentials property the password.
     84  * To verify that you have the correct settings, try to connect to the LDAP server using an LDAP browser application.
     85
     86 * define where to find users in LDAP structure for authentication::
     87{{{
     88    ldap.base.search.base=ou=people
     89    ldap.base.dn.pattern=uid={0},${ldap.base.search.base}
     90    #ldap.base.dn.pattern=mail={0},${ldap.base.search.base}
     91}}}
     92 
     93  * ldap.base.search.base: this is where the catalog will look for users (for authentication)
     94  * ldap.base.dn.pattern: this is the distinguished name for the user to bind with. {0} is replaced by the user name typed in the sign in screen.
     95
     96
     97 * add the following import to config-security.xml::
     98{{{
     99    <import resource="config-security-ldap.xml"/>
     100}}}
     101
     102===== Authorization Settings =====
     103
     104When using LDAP, user information and privileges could be defined from the LDAP attributes.
     105
     106====== User details ======
     107
     108All user informations could be retrieved from the LDAP as defined in the config-security-overrides.properties.
     109This property file defined for each user attribute in the catalog database which LDAP attributes match.
     110If the attribute is empty or not defined, a default value could be defined. The configuration is the following::
     111{{{
     112    # Map user information to LDAP attributes and default values
     113    # ldapUserContextMapper.mapping[name]=ldap_attribute,default_value
     114    ldapUserContextMapper.mapping[name]=cn,
     115    ldapUserContextMapper.mapping[surname]=givenName,
     116    ldapUserContextMapper.mapping[mail]=mail,data@myorganization.org
     117    ldapUserContextMapper.mapping[organisation]=,myorganization
     118    ldapUserContextMapper.mapping[kind]=,
     119    ldapUserContextMapper.mapping[address]=,
     120    ldapUserContextMapper.mapping[zip]=,
     121    ldapUserContextMapper.mapping[state]=,
     122    ldapUserContextMapper.mapping[city]=,
     123    ldapUserContextMapper.mapping[country]=,
     124}}}
     125
     126====== Privileges configuration ======
     127
     128
     129When using LDAP, user groups and user profiles could be set from LDAP information or not.
     130To manage user privileges from the local database, set the ldap.privilege.import property in
     131config-security.properties to false::
     132
     133{{{
     134    ldap.privilege.import=false
     135}}}
     136
     137
     138If LDAP information should be used to define user privileges, set it to true::
     139
     140{{{
     141    ldap.privilege.import=true
     142}}}
     143
     144When importing privileges from LDAP, the catalog administrator could decide to create groups
     145defined in the LDAP and not defined in local database. For this set the following property to true::
     146{{{
     147    ldap.privilege.create.nonexisting.groups=false
     148}}}
     149
     150
     151======= Simple privileges configuration =======
     152
     153
     154
     155In order to define which groups the user is member of and which profile is the user::
     156{{{
     157    ldapUserContextMapper.mapping[privilege]=groups,sample
     158    # If not set, the default profile is RegisteredUser
     159    # Valid profiles are http://geonetwork-opensource.org/manuals/trunk/eng/developer/apidocs/geonetwork/org/fao/geonet/constants/Geonet.Profile.html
     160    ldapUserContextMapper.mapping[profile]=privileges,RegisteredUser
     161}}}
     162
     163Attributes configuration:
     164
     165 * privilege attribute contains the group this user is member of. More than one group is allowed.
     166 * profile attribute contains the profile of the user
     167
     168
     169======= Profile mapping configuration =======
     170
     171
     172If LDAP attribute containing profiles does not match the catalog profile list, a mapping could be defined
     173in config-security-overrides.properties::
     174{{{
     175    # Map LDAP custom profiles to catalog profiles. Not used if ldap.privilege.pattern is defined.
     176    ldapUserContextMapper.profilMapping[Admin]=Administrator
     177    ldapUserContextMapper.profilMapping[Editeur]=Reviewer
     178    ldapUserContextMapper.profilMapping[Public]=RegisteredUser
     179}}}
     180
     181For example, in the previous configuration, the attribute value Admin will be mapped to Administrator (which
     182is a valid profile for the catalog).
     183
     184
     185======= Advanced privileges configuration =======
     186
     187An attribute could define both the profile and the group for a user. To extract this information,
     188a custom pattern could be defined to populate user privileges according to that attribute::
     189{{{
     190    # In config-security-overrides.properties
     191    ldapUserContextMapper.mapping[privilege]=cat_privileges,sample
     192    # In config-security.properties
     193    ldap.privilege.pattern=CAT_(.*)_(.*)
     194    ldap.privilege.pattern.idx.group=1
     195    ldap.privilege.pattern.idx.profil=2
     196}}}
     197   
     198
     199The LDAP attribute can contains the following configuration to define the different type of users::
     200{{{
     201    -- Define a catalog admin:
     202    cat_privileges=CAT_ALL_Administrator
     203   
     204    -- Define a reviewer for the group GRANULAT
     205    cat_privileges=CAT_GRANULAT_Reviewer
     206   
     207    -- Define a reviewer for the group GRANULAT and editor for MIMEL
     208    cat_privileges=CAT_GRANULAT_Reviewer
     209    cat_privileges=CAT_MIMEL_Editor
     210   
     211    -- Define a reviewer for the group GRANULAT and editor for MIMEL and RegisteredUser for NATURA2000
     212    cat_privileges=CAT_GRANULAT_Reviewer
     213    cat_privileges=CAT_MIMEL_Reviewer
     214    cat_privileges=CAT_NATURA2000_RegisterdUser
     215   
     216    -- Only a registered user for GRANULAT
     217    cat_privileges=CAT_GRANULAT_RegisteredUser
     218}}}
     219   
     220
     221
     222===== Synchronization =====
     223
     224
     225A synchronization task is taking care of removing LDAP user which may be deleted. For example:
     226
     227 * T0: a user A sign in the catalog. A local user A is created in the user database
     228 * T1: A is deleted from the LDAP (A could not sign in in the catalog anymore)
     229 * T2: the synchronization task will check that all local LDAP users exist in LDAP:
     230  * if user is not owner of any records, it will be deleted
     231  * if user is owner of metadata records, warning message is avaialable on the catalog logging system. record's owner should be changed to another user before the task could remove the user.
     232
     233By default the task is runned once every day. Configuration could be changed in config-security.properties::
     234{{{
     235    # Run LDAP sync every day at 23:30
     236    ldap.sync.cron=0 30 23 * * ?
     237}}}
     238
     239===== Debugging =====
     240
     241
     242If connection fails, try to increase logging for LDAP in log4j.cfg::
     243{{{
     244    log4j.logger.geonetwork.ldap          = DEBUG
     245    log4j.logger.org.springframework = DEBUG, console, jeeves
     246    log4j.logger.org.springframework.* = DEBUG
     247    log4j.logger.org.springframework.security.ldap = DEBUG
     248}}}
     249
     250==== CAS ====
     251
     252
     253To enable CAS support:
     254
     255 * add the CAS base URL property in config-security.properties::
     256 
     257{{{
     258    cas.baseURL=https://localhost:8443/cas
     259    cas.ticket.validator.url=${cas.baseURL}
     260    cas.login.url=${cas.baseURL}/login
     261    cas.logout.url=${cas.baseURL}/logout?url=${geonetwork.https.url}/
     262}}}
     263
     264 * add the following import to config-security.xml::
     265{{{
     266    <import resource="config-security-cas.xml"/>
     267    <import resource="config-security-cas-ldap.xml"/>
     268}}}
     269
    112270
    113271
     
    116274 * Security configuration is made using configuration file (and not user interface)
    117275 * Database changes (migration script provided):
    118   * User table : add a authtype column
    119  * Configuration overrides would not work at all and there is not migration for that. 
     276  * User table : add a authtype column to identify local/external users
     277 * Configuration overrides would not work at all for that. 
    120278
    121279== Risks ==