001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: https://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: https://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.security;
029
030import org.opencms.configuration.I_CmsConfigurationParameterHandler;
031import org.opencms.file.CmsObject;
032
033import java.util.Locale;
034
035/**
036 * Interface for plugging in a custom login button in the login dialog which redirects to some sort of third-party authentication page.
037 */
038public interface I_CmsCustomLogin extends I_CmsConfigurationParameterHandler {
039
040    /**
041     * Mode enum indicating how the custom login should be displayed.
042     */
043    public enum Mode {
044
045        /** Add the custom login to the login dialog. */
046        add,
047
048        /** Completely replace the normal login dialog widgets with custom login.*/
049        replace;
050    }
051
052    /**
053     * Indicates how the custom login should be displayed.
054     *
055     * @return the display mode
056     */
057    public Mode getMode();
058
059    /**
060     * Gets the page to redirect to after the user has clicked on the custom button.
061     *
062     * @param orgUnit the organizational unit that has been selected, or null if none was selected
063     * @return the redirect URI
064     */
065    public String getRedirect(String orgUnit);
066
067    /**
068     * Gets the caption to display on the button for the given locale.
069     *
070     * @param locale the locale
071     * @return the caption to display
072     */
073    String getLoginButtonCaption(Locale locale);
074
075    /**
076     * Sets the CmsObject needed for VFS operations or anything like that.
077     *
078     * @param cms a CmsObject with admin privileges
079     */
080    void initialize(CmsObject cms);
081
082    /**
083     * Only if this returns true should the custom login be enabled.
084     *
085     * @return true if the custom login should be enabled
086     */
087    boolean isEnabled();
088
089    /**
090     * Checks if the custom login method needs the user to select the OU in the login dialog.
091     *
092     * @return true if the custom login method needs the OU
093     */
094    boolean needsOrgUnit();
095
096}