001/*
002 *  Copyright 2017 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.workspaces.dav;
017
018import java.util.Arrays;
019import java.util.List;
020
021import org.apache.avalon.framework.parameters.ParameterException;
022import org.apache.avalon.framework.parameters.Parameters;
023import org.apache.cocoon.environment.Request;
024
025/**
026 * Action to authenticate Webdav URL
027 */
028public class AuthenticateAction extends org.ametys.core.authentication.AuthenticateAction
029{
030    @Override
031    protected List<String> _getContexts(Request request, Parameters parameters)
032    {
033        String name;
034        try
035        {
036            name = parameters.getParameter("project");
037        }
038        catch (ParameterException e)
039        {
040            throw new IllegalArgumentException(e);
041        }
042        
043        return Arrays.asList("/sites/" + name, "/sites-fo/" + name);
044    }
045}