001package org.apache.archiva.redback.common.ldap.role;
002/*
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 */
020
021import org.apache.archiva.redback.common.ldap.MappingException;
022
023import java.util.Collection;
024import java.util.List;
025import java.util.Map;
026
027/**
028 * @author Olivier Lamy
029 * @since 2.1
030 */
031public interface LdapRoleMapperConfiguration
032{
033    /**
034     * add mapping ldap group to redback roles
035     *
036     * @param roles     list of Role names
037     * @param ldapGroup ldap group
038     */
039    void addLdapMapping( String ldapGroup, List<String> roles )
040        throws MappingException;
041
042    /**
043     * update an existing mapping
044     * @param ldapGroup
045     * @param roles
046     * @throws MappingException
047     */
048    void updateLdapMapping( String ldapGroup, List<String> roles )
049        throws MappingException;
050
051    /**
052     * remove a mapping
053     *
054     * @param group ldap group
055     */
056    void removeLdapMapping( String group )
057        throws MappingException;
058
059    /**
060     * @return Map of corresponding LDAP group (key) and Redback roles (value)
061     */
062    Map<String, Collection<String>> getLdapGroupMappings()
063        throws MappingException;
064
065    /**
066     * Returns the mapping for the given group
067     * @param groupName the group name
068     * @return the list of roles
069     * @throws MappingException
070     */
071    Collection<String> getLdapGroupMapping(String groupName) throws MappingException;
072
073    void setLdapGroupMappings( Map<String, List<String>> mappings )
074        throws MappingException;
075}