001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     bstefanescu
011 */
012package org.nuxeo.runtime.api.login;
013
014import javax.security.auth.login.LoginContext;
015import javax.security.auth.login.LoginException;
016
017import org.nuxeo.runtime.api.Framework;
018
019/**
020 * This service is performing a login under another identity without checking the password.
021 * <p>
022 * You must never use this service explicitly in your code since it may be removed in future. Instead you should use
023 * {@link Framework#loginAsUser(String)}
024 * <p>
025 * Implementors must implement this interface and expose the implementation as a Nuxeo service.
026 *
027 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
028 * @since 5.4.0.2
029 */
030public interface LoginAs {
031
032    /**
033     * Perform the Login As.
034     *
035     * @param username
036     * @return
037     * @throws LoginException
038     */
039    public LoginContext loginAs(String username) throws LoginException;
040
041}