Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d7298566d71fbf459d690b1c481f873b4338b09d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*******************************************************************************
 * Copyright (c) 2008 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.security.auth;

import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;

/**
 * The ILoginContext is the central entry point for the authentication support.
 * Use it to perform login, logout, and retrieve information associated with the security
 * subject.
 * <p>
 * This interface is not intended to be implemented by clients.
 * </p>
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface ILoginContext {

	/**
	 * Call this method to perform a login. 
	 * @see LoginContext#login()
	 * @throws LoginException if the authentication fails.
	 */
	public void login() throws LoginException;

	/**
	 * Call this method to perform a logout.
	 * @see LoginContext#logout()
	 * @throws LoginException if the logout fails.
	 */
	public void logout() throws LoginException;

	/**
	 * Retrieves the current Subject. Calling this method will force a login to occur 
	 * if the user is not already logged in.
	 * @see LoginContext#getSubject()
	 * @return the Subject
	 */
	public Subject getSubject() throws LoginException;

	/**
	 * Adds listener to be notified on security-related events.
	 * @param listener the listener to be registered
	 * @see ILoginContextListener
	 */
	public void registerListener(ILoginContextListener listener);

	/**
	 * Removes listener previously registered to receive notifications
	 * on security-related events.
	 * @param listener the listener to be unregistered
	 * @see ILoginContextListener
	 */
	public void unregisterListener(ILoginContextListener listener);

	/**
	 * The method exposes underlying JAAS LoginContext.
	 * <p>
	 * Using the LoginContext directly will bypass some of the processing offered
	 * by this interface and should be used only when other methods are not sufficient.
	 * </p>
	 * @return the underlying JAAS LoginContext
	 * @throws LoginException if exception was encountered while creating LoginContext
	 */
	public LoginContext getLoginContext() throws LoginException;

}

Back to the top