View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2013 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.security.jaspi;
20  
21  import java.util.Map;
22  
23  import javax.security.auth.Subject;
24  import javax.security.auth.message.AuthException;
25  import javax.security.auth.message.MessageInfo;
26  import javax.security.auth.message.config.ServerAuthConfig;
27  import javax.security.auth.message.config.ServerAuthContext;
28  
29  /**
30   * @version $Rev: 4660 $ $Date: 2009-02-25 17:29:53 +0100 (Wed, 25 Feb 2009) $
31   */
32  public class SimpleAuthConfig implements ServerAuthConfig
33  {
34      public static final String HTTP_SERVLET = "HttpServlet";
35  
36      private final String _appContext;
37  
38      private final ServerAuthContext _serverAuthContext;
39  
40      public SimpleAuthConfig(String appContext, ServerAuthContext serverAuthContext)
41      {
42          this._appContext = appContext;
43          this._serverAuthContext = serverAuthContext;
44      }
45  
46      public ServerAuthContext getAuthContext(String authContextID, Subject serviceSubject, Map properties) throws AuthException
47      {
48          return _serverAuthContext;
49      }
50  
51      // supposed to be of form host-name<space>context-path
52      public String getAppContext()
53      {
54          return _appContext;
55      }
56  
57      // not used yet
58      public String getAuthContextID(MessageInfo messageInfo) throws IllegalArgumentException
59      {
60          return null;
61      }
62  
63      public String getMessageLayer()
64      {
65          return HTTP_SERVLET;
66      }
67  
68      public boolean isProtected()
69      {
70          return true;
71      }
72  
73      public void refresh() 
74      {
75      }
76  }