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     * @since 0.1
037     */
038    public class ConcurrentAccessException extends AccountException {
039    
040        /**
041         * Creates a new ConcurrentAccessException.
042         */
043        public ConcurrentAccessException() {
044            super();
045        }
046    
047        /**
048         * Constructs a new ConcurrentAccessException.
049         *
050         * @param message the reason for the exception
051         */
052        public ConcurrentAccessException(String message) {
053            super(message);
054        }
055    
056        /**
057         * Constructs a new ConcurrentAccessException.
058         *
059         * @param cause the underlying Throwable that caused this exception to be thrown.
060         */
061        public ConcurrentAccessException(Throwable cause) {
062            super(cause);
063        }
064    
065        /**
066         * Constructs a new ConcurrentAccessException.
067         *
068         * @param message the reason for the exception
069         * @param cause   the underlying Throwable that caused this exception to be thrown.
070         */
071        public ConcurrentAccessException(String message, Throwable cause) {
072            super(message, cause);
073        }
074    
075    }