1 //
2 // ========================================================================
3 // Copyright (c) 1995-2012 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.
8 //
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
11 //
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
14 //
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
17 //
18
19 package org.eclipse.jetty.client.api;
20
21 /**
22 * A store for {@link Authentication}s and {@link Authentication.Result}s.
23 */
24 public interface AuthenticationStore
25 {
26 /**
27 * @param authentication the {@link Authentication} to add
28 */
29 public void addAuthentication(Authentication authentication);
30
31 /**
32 * @param authentication the {@link Authentication} to remove
33 */
34 public void removeAuthentication(Authentication authentication);
35
36 /**
37 * Removes all {@link Authentication}s stored
38 */
39 public void clearAuthentications();
40
41 /**
42 * Returns the authentication that matches the given type (for example, "Basic" or "Digest"),
43 * the given request URI and the given realm.
44 * If no such authentication can be found, returns null.
45 *
46 * @param type the {@link Authentication} type such as "Basic" or "Digest"
47 * @param uri the request URI
48 * @param realm the authentication realm
49 * @return the authentication that matches the given parameters, or null
50 */
51 public Authentication findAuthentication(String type, String uri, String realm);
52
53 /**
54 * @param result the {@link Authentication.Result} to add
55 */
56 public void addAuthenticationResult(Authentication.Result result);
57
58 /**
59 * @param result the {@link Authentication.Result} to remove
60 */
61 public void removeAuthenticationResult(Authentication.Result result);
62
63 /**
64 * Removes all authentication results stored
65 */
66 public void clearAuthenticationResults();
67
68 /**
69 * Returns an {@link Authentication.Result} that matches the given URI, or null if no
70 * {@link Authentication.Result}s match the given URI.
71 *
72 * @param uri the request URI
73 * @return the {@link Authentication.Result} that matches the given URI, or null
74 */
75 public Authentication.Result findAuthenticationResult(String uri);
76 }