View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2016 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  import java.net.URI;
22  
23  /**
24   * A store for {@link Authentication}s and {@link Authentication.Result}s.
25   */
26  public interface AuthenticationStore
27  {
28      /**
29       * @param authentication the {@link Authentication} to add
30       */
31      public void addAuthentication(Authentication authentication);
32  
33      /**
34       * @param authentication the {@link Authentication} to remove
35       */
36      public void removeAuthentication(Authentication authentication);
37  
38      /**
39       * Removes all {@link Authentication}s stored
40       */
41      public void clearAuthentications();
42  
43      /**
44       * Returns the authentication that matches the given type (for example, "Basic" or "Digest"),
45       * the given request URI and the given realm.
46       * If no such authentication can be found, returns null.
47       *
48       * @param type the {@link Authentication} type such as "Basic" or "Digest"
49       * @param uri the request URI
50       * @param realm the authentication realm
51       * @return the authentication that matches the given parameters, or null
52       */
53      public Authentication findAuthentication(String type, URI uri, String realm);
54  
55      /**
56       * @param result the {@link Authentication.Result} to add
57       */
58      public void addAuthenticationResult(Authentication.Result result);
59  
60      /**
61       * @param result the {@link Authentication.Result} to remove
62       */
63      public void removeAuthenticationResult(Authentication.Result result);
64  
65      /**
66       * Removes all authentication results stored
67       */
68      public void clearAuthenticationResults();
69  
70      /**
71       * Returns an {@link Authentication.Result} that matches the given URI, or null if no
72       * {@link Authentication.Result}s match the given URI.
73       *
74       * @param uri the request URI
75       * @return the {@link Authentication.Result} that matches the given URI, or null
76       */
77      public Authentication.Result findAuthenticationResult(URI uri);
78  }