View Javadoc

1   /*
2   jGuard is a security framework based on top of jaas (java authentication and authorization security).
3   it is written for web applications, to resolve simply, access control problems.
4   version $Name$
5   http://sourceforge.net/projects/jguard/
6   
7   Copyright (C) 2004  Charles GAY
8   
9   This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13  
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  Lesser General Public License for more details.
18  
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  
23  
24  jGuard project home page:
25  http://sourceforge.net/projects/jguard/
26  
27  */
28  
29  
30  package net.sf.jguard.core.authentication.bindings;
31  
32  
33  import net.sf.jguard.core.PolicyEnforcementPoint;
34  import net.sf.jguard.core.authentication.AccessContext;
35  import net.sf.jguard.core.authentication.AuthenticationServicePoint;
36  import net.sf.jguard.core.authentication.AuthenticationUtils;
37  
38  import javax.security.auth.callback.CallbackHandler;
39  
40  
41  /**
42   * Authentication bindings with the underlying protocol and server technology
43   * used by the {@link PolicyEnforcementPoint}, <b>specific to an AccessContext</b>.
44   * Note that implementation of this interface <strong>DOES NOT</strong>
45   * authenticate any entity.
46   *
47   * @author <a href="mailto:diabolo512@users.sourceforge.net">Charles Gay</a>
48   * @see PolicyEnforcementPoint
49   * @see AuthenticationServicePoint
50   * @since 1.1
51   */
52  public interface AuthenticationBindings {
53  
54  
55      //actions
56      public void process();
57  
58      /**
59       * return a CallbackHandler bounded to the current AccessContext.
60       *
61       * @return
62       */
63      public CallbackHandler getCallbackHandler();
64  
65  
66      public AccessContext getContext();
67  
68      /**
69       * extract from the AccessContext the AuthenticationUtils.
70       * note that each AuthenticationUtils instance is related to a Subject,
71       * so different AuthenticationUtils coexist.It can be done because
72       * AccessContext is different among users, although if they share <b>the same</b> AuthenticationBindings
73       * instance: it implies that AuthenticationBindings is only the method to extract from
74       * AccessContext the AuthenticationUtils (and its underlying Subject).
75       *
76       * @return
77       */
78      public AuthenticationUtils getAuthenticationUtils();
79  
80      //request specific method
81      public void setRequestAttribute(String key, Object value);
82  
83      public Object getRequestAttribute(String key);
84  
85      public void removeRequestAttribute(String key);
86  
87  
88      //application specific method
89      public void setApplicationAttribute(String key, Object value);
90  
91      public Object getApplicationAttribute(String key);
92  
93      public void removeApplicationAttribute(String key);
94  
95      /**
96       * parameter defined for initialization purpose, reachable
97       * at an application scope.
98       *
99       * @param key
100      * @return value as a String
101      */
102     public String getInitApplicationAttribute(String key);
103 
104     public AuthenticationBindingsFactory getAuthenticationBindingsFactory();
105 
106 
107     public String getScope();
108 }