Fedora 4 uses servlet container authentication (Realms) to provide minimal protection for your repository, including the set up of "superuser" accounts.  User credentials are configured in your web application container, usually in a properties file or XML file. By configuring superuser accounts you can require authentication for all management (write) operations.  This document describes how to set up Fedora and either Tomcat or Jetty to enable HTTP Basic Authentication, using simple user files.  Consult your web application server documentation for other ways to configure and manage users;  Fedora can handle any user principal passed to it by the servlet container, as provisioned by any of the container's supported authentication mechanisms.

The superuser role is fedoraAdmin.  This is comparable to the fedoraAdmin superuser role in Fedora 3, used for Fedora 3 API-M operations.

If you are starting from the pre-packaged authorization war file (fcrepo-webapp-<version>-auth.war), you should skip to step #3 below.

 

  1. Configure your repo.xml file

    Add the beans authenticationProvider and pep to your repo.xml file, and make the modeshapeRepofactory bean dependent on authenticationProvider.  Use the class org.fcrepo.auth.ServletContainerAuthenticationProvider as your authentication provider.  Here is an example repo.xml that configures authentication and authorization using the Basic Roles PEP:

        <bean name="modeshapeRepofactory"
            class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean"                                                                                        
            p:repositoryConfiguration="${fcrepo.modeshape.configuration:classpath:/config/rest-sessions/repository.json}"                                          
            depends-on="authenticationProvider"/>                                                                                                                  
                                                                                                                                                                   
        <bean name="pep" class="org.fcrepo.auth.roles.basic.BasicRolesPEP"/>                                                                                       
                                                                                                                                                                   
        <bean name="authenticationProvider" 
    		class="org.fcrepo.auth.common.ServletContainerAuthenticationProvider">                                                        
            <property name="pep" ref="pep"/>                                                                                                                       
        </bean>
    
    
  2. Configure your repository.json file

    Modify the security section to enable both authenticated (via authentication provider) and internal sessions between Fedora and ModeShape.  It should match this block:

    "security" : {        
            "anonymous" : {
                "roles" : ["readonly","readwrite","admin"],
                "useOnFailedLogin" : false
            },
            "providers" : [
                { "classname" : "org.fcrepo.auth.common.ServletContainerAuthenticationProvider" }
            ]
        },
  3. Configure your web application container

-Djetty.users.file=/path/to/jetty-users.properties

See the Jetty Authentication documentation for more details. 

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.