2 // ========================================================================
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
19 package org.eclipse.jetty.security;
21 import org.eclipse.jetty.server.UserIdentity;
24 /* ------------------------------------------------------------ */
26 * Login Service Interface.
28 * The Login service provides an abstract mechanism for an {@link Authenticator}
29 * to check credentials and to create a {@link UserIdentity} using the
30 * set {@link IdentityService}.
32 public interface LoginService
35 /* ------------------------------------------------------------ */
37 * @return Get the name of the login service (aka Realm name)
41 /* ------------------------------------------------------------ */
43 * @param username The user name
44 * @param credentials The users credentials
45 * @return A UserIdentity if the credentials matched, otherwise null
47 UserIdentity login(String username,Object credentials);
49 /* ------------------------------------------------------------ */
50 /** Validate a user identity.
51 * Validate that a UserIdentity previously created by a call
52 * to {@link #login(String, Object)} is still valid.
53 * @param user The user to validate
54 * @return true if authentication has not been revoked for the user.
56 boolean validate(UserIdentity user);
58 /* ------------------------------------------------------------ */
59 /** Get the IdentityService associated with this Login Service.
60 * @return the IdentityService associated with this Login Service.
62 IdentityService getIdentityService();
64 /* ------------------------------------------------------------ */
65 /** Set the IdentityService associated with this Login Service.
66 * @param service the IdentityService associated with this Login Service.
68 void setIdentityService(IdentityService service);
70 void logout(UserIdentity user);