001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Florent Guillaume
018 */
019package org.nuxeo.ecm.core.api.local;
020
021import java.security.Principal;
022
023import org.nuxeo.ecm.core.api.NuxeoPrincipal;
024import org.nuxeo.runtime.api.login.LoginComponent;
025
026/**
027 * @deprecated since 11.1, use {@link LoginComponent} instead
028 */
029@Deprecated
030public class ClientLoginModule {
031
032    /**
033     * @since 5.7
034     * @deprecated since 11.1, use {@link LoginComponent#clearPrincipalStack} instead
035     */
036    @Deprecated
037    public static void clearThreadLocalLogin() {
038        LoginComponent.clearPrincipalStack();
039    }
040
041    /**
042     * @deprecated since 11.1, use {@link LoginComponent} instead
043     */
044    @Deprecated
045    public static LoginStack getThreadLocalLogin() {
046        return new LoginStack(); // delegates to LoginComponent's stack
047    }
048
049    /**
050     * @deprecated since 11.1, use {@link LoginComponent#getCurrentPrincipal} instead
051     */
052    @Deprecated
053    public static LoginStack.Entry getCurrentLogin() {
054        Principal principal = LoginComponent.getCurrentPrincipal();
055        return principal == null ? null : new LoginStack.Entry(principal, null, null);
056    }
057
058    /**
059     * Returns the current logged {@link NuxeoPrincipal} from the login stack
060     *
061     * @since 5.6
062     * @deprecated since 11.1, use {@link NuxeoPrincipal#getCurrent} instead
063     */
064    @Deprecated
065    public static NuxeoPrincipal getCurrentPrincipal() {
066        return NuxeoPrincipal.getCurrent();
067    }
068
069    /**
070     * @since 11.1
071     * @deprecated since 11.1, use {@link NuxeoPrincipal#isCurrentAdministrator} instead
072     */
073    @Deprecated
074    public static boolean isCurrentAdministrator() {
075        return NuxeoPrincipal.isCurrentAdministrator();
076    }
077
078}