View Javadoc

1   // ========================================================================
2   // Copyright (c) 2008-2009 Mort Bay Consulting Pty. Ltd.
3   // ------------------------------------------------------------------------
4   // All rights reserved. This program and the accompanying materials
5   // are made available under the terms of the Eclipse Public License v1.0
6   // and Apache License v2.0 which accompanies this distribution.
7   // The Eclipse Public License is available at 
8   // http://www.eclipse.org/legal/epl-v10.html
9   // The Apache License v2.0 is available at
10  // http://www.opensource.org/licenses/apache2.0.php
11  // You may elect to redistribute this code under either of these licenses. 
12  // ========================================================================
13  
14  package org.eclipse.jetty.security.jaspi;
15  
16  import java.util.Map;
17  
18  import javax.security.auth.Subject;
19  import javax.security.auth.message.AuthException;
20  import javax.security.auth.message.MessageInfo;
21  import javax.security.auth.message.config.ServerAuthConfig;
22  import javax.security.auth.message.config.ServerAuthContext;
23  
24  /**
25   * @version $Rev: 4660 $ $Date: 2009-02-25 17:29:53 +0100 (Wed, 25 Feb 2009) $
26   */
27  public class SimpleAuthConfig implements ServerAuthConfig
28  {
29      public static final String HTTP_SERVLET = "HttpServlet";
30  
31      private final String _appContext;
32  
33      private final ServerAuthContext _serverAuthContext;
34  
35      public SimpleAuthConfig(String appContext, ServerAuthContext serverAuthContext)
36      {
37          this._appContext = appContext;
38          this._serverAuthContext = serverAuthContext;
39      }
40  
41      public ServerAuthContext getAuthContext(String authContextID, Subject serviceSubject, Map properties) throws AuthException
42      {
43          return _serverAuthContext;
44      }
45  
46      // supposed to be of form host-name<space>context-path
47      public String getAppContext()
48      {
49          return _appContext;
50      }
51  
52      // not used yet
53      public String getAuthContextID(MessageInfo messageInfo) throws IllegalArgumentException
54      {
55          return null;
56      }
57  
58      public String getMessageLayer()
59      {
60          return HTTP_SERVLET;
61      }
62  
63      public boolean isProtected()
64      {
65          return true;
66      }
67  
68      public void refresh()
69      {
70      }
71  }