001package org.apache.archiva.redback.authentication;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.archiva.redback.policy.AccountLockedException;
023import org.apache.archiva.redback.policy.MustChangePasswordException;
024
025import java.util.List;
026
027/**
028 * AuthenticationManager:
029 *
030 * @author Jesse McConnell
031 * @author Martin Stockhammer
032 */
033public interface AuthenticationManager
034{
035    /**
036     * Returns the identifier of this authentication manager
037     * @return the identifier string
038     */
039    String getId();
040
041    /**
042     * Returns the list of authenticators in the same order as they are called for authentication
043     * @return the list of authenticators.
044     */
045    List<Authenticator> getAuthenticators();
046
047    /**
048     * Authenticates by calling all authenticators in the defined order.
049     *
050     * @param source the authentication data
051     * @return the result that gives information, if the authentication was successful
052     * @throws AccountLockedException if the account is locked
053     * @throws AuthenticationException if something unexpected happend during authentication
054     * @throws MustChangePasswordException if the user has to change his password
055     */
056    AuthenticationResult authenticate( AuthenticationDataSource source )
057        throws AccountLockedException, AuthenticationException, MustChangePasswordException;
058
059    /**
060     * Returns the authenticator controls that are used to control the order and actions during authentication.
061     * @return the list of controls
062     */
063    List<AuthenticatorControl> getControls();
064
065    /**
066     * Sets the list of authenticator controls
067     * @param controlList the list of control instances
068     */
069    void setControls( List<AuthenticatorControl> controlList);
070
071    /**
072     * Modifies the control for a single authenticator
073     * @param control the authenticator control
074     */
075    void modifyControl(AuthenticatorControl control);
076}