001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    package org.apache.shiro.authc;
020    
021    /**
022     * Thrown when an authentication attempt has been received for an account that has already been
023     * authenticated (i.e. logged-in), and the system is configured to prevent such concurrent access.
024     *
025     * <p>This is useful when an application must ensure that only one person is logged-in to a single
026     * account at any given time.
027     *
028     * <p>Sometimes account names and passwords are lazily given away
029     * to many people for easy access to a system.  Such behavior is undesirable in systems where
030     * users are accountable for their actions, such as in government applications, or when licensing
031     * agreements must be maintained, such as those which only allow 1 user per paid license.
032     *
033     * <p>By disallowing concurrent access, such systems can ensure that each authenticated session
034     * corresponds to one and only one user at any given time.
035     *
036     * @author Les Hazlewood
037     * @since 0.1
038     */
039    public class ConcurrentAccessException extends AccountException {
040    
041        /**
042         * Creates a new ConcurrentAccessException.
043         */
044        public ConcurrentAccessException() {
045            super();
046        }
047    
048        /**
049         * Constructs a new ConcurrentAccessException.
050         *
051         * @param message the reason for the exception
052         */
053        public ConcurrentAccessException(String message) {
054            super(message);
055        }
056    
057        /**
058         * Constructs a new ConcurrentAccessException.
059         *
060         * @param cause the underlying Throwable that caused this exception to be thrown.
061         */
062        public ConcurrentAccessException(Throwable cause) {
063            super(cause);
064        }
065    
066        /**
067         * Constructs a new ConcurrentAccessException.
068         *
069         * @param message the reason for the exception
070         * @param cause   the underlying Throwable that caused this exception to be thrown.
071         */
072        public ConcurrentAccessException(String message, Throwable cause) {
073            super(message, cause);
074        }
075    
076    }