View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.security.spi;
18  
19  import java.util.Iterator;
20  
21  import org.apache.jetspeed.security.SecurityException;
22  import org.apache.jetspeed.security.om.InternalGroupPrincipal;
23  import org.apache.jetspeed.security.om.InternalRolePrincipal;
24  import org.apache.jetspeed.security.om.InternalUserPrincipal;
25  
26  /***
27   * <p>
28   * SecurityAccess
29   * </p>
30   * <p>
31   *
32   * </p>
33   * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
34   * @version $Id: SecurityAccess.java 290457 2005-09-20 14:14:31Z ate $
35   *
36   */
37  public interface SecurityAccess
38  {
39      /***
40       * <p>
41       * Returns if a Internal UserPrincipal is defined for the user name.
42       * </p>
43       * 
44       * @param username The user name.
45       * @return true if the user is known
46       */
47      public boolean isKnownUser(String username);
48  
49      /***
50       * <p>
51       * Returns the {@link InternalUserPrincipal} from the user name.
52       * </p>
53       * 
54       * @param username The user name.
55       * @return The {@link InternalUserPrincipal}.
56       */
57      InternalUserPrincipal getInternalUserPrincipal( String username );
58  
59      /***
60       * <p>
61       * Returns the {@link InternalUserPrincipal} from the user name.
62       * </p>
63       * 
64       * @param username The user name.
65       * @param isMappingOnly Whether a principal's purpose is for security mappping only.
66       * @return The {@link InternalUserPrincipal}.
67       */
68      InternalUserPrincipal getInternalUserPrincipal( String username, boolean isMappingOnly );
69  
70      /***
71       * <p>
72       * Returns a {@link InternalUserPrincipal} collection given the filter.
73       * </p>
74       * 
75       * @param filter The filter.
76       * @return Collection of {@link InternalUserPrincipal}.
77       */
78      Iterator getInternalUserPrincipals( String filter );
79  
80      /***
81       * <p>
82       * Sets the given {@link InternalUserPrincipal}.
83       * </p>
84       * 
85       * @param internalUser The {@link InternalUserPrincipal}.
86       * @param isMappingOnly Whether a principal's purpose is for security mappping only.
87       * @throws SecurityException Throws a {@link SecurityException}.
88       */
89      void setInternalUserPrincipal( InternalUserPrincipal internalUser, boolean isMappingOnly ) throws SecurityException;
90  
91      /***
92       * <p>
93       * Remove the given {@link InternalUserPrincipal}.
94       * </p>
95       * 
96       * @param internalUser The {@link InternalUserPrincipal}.
97       * @throws SecurityException Throws a {@link SecurityException}.
98       */
99      void removeInternalUserPrincipal( InternalUserPrincipal internalUser ) throws SecurityException;
100 
101     /***
102      * <p>
103      * Returns the {@link InternalRolePrincipal}from the role full path name.
104      * </p>
105      * 
106      * @param roleFullPathName The role full path name.
107      * @return The {@link InternalRolePrincipal}.
108      */
109     InternalRolePrincipal getInternalRolePrincipal( String roleFullPathName );
110 
111     /***
112      * <p>
113      * Sets the given {@link InternalRolePrincipal}.
114      * </p>
115      * 
116      * @param internalRole The {@link InternalRolePrincipal}.
117      * @param isMappingOnly Whether a principal's purpose is for security mappping only.
118      * @throws SecurityException Throws a {@link SecurityException}.
119      */
120     void setInternalRolePrincipal( InternalRolePrincipal internalRole, boolean isMappingOnly ) throws SecurityException;
121 
122     /***
123      * <p>
124      * Remove the given {@link InternalRolePrincipal}.
125      * </p>
126      * 
127      * @param internalRole The {@link InternalRolePrincipal}.
128      * @throws SecurityException Throws a {@link SecurityException}.
129      */
130     void removeInternalRolePrincipal( InternalRolePrincipal internalRole ) throws SecurityException;
131 
132     /***
133      * <p>
134      * Returns the {@link InternalGroupPrincipal}from the group full path name.
135      * </p>
136      * 
137      * @param groupFullPathName The group full path name.
138      * @return The {@link InternalGroupPrincipal}.
139      */
140     InternalGroupPrincipal getInternalGroupPrincipal( String groupFullPathName );
141 
142     /***
143      * <p>
144      * Sets the given {@link InternalGroupPrincipal}.
145      * </p>
146      * 
147      * @param internalGroup The {@link InternalGroupPrincipal}.
148      * @param isMappingOnly Whether a principal's purpose is for security mappping only.
149      * @throws SecurityException Throws a {@link SecurityException}.
150      */
151     void setInternalGroupPrincipal( InternalGroupPrincipal internalGroup, boolean isMappingOnly )
152             throws SecurityException;
153 
154     /***
155      * <p>
156      * Remove the given {@link InternalGroupPrincipal}.
157      * </p>
158      * 
159      * @param internalGroup The {@link InternalGroupPrincipal}.
160      * @throws SecurityException Throws a {@link SecurityException}.
161      */
162     void removeInternalGroupPrincipal( InternalGroupPrincipal internalGroup ) throws SecurityException;
163 
164     /***
165      * <p>
166      * Returns a {@link InternalRolePrincipal} collection given the filter.
167      * </p>
168      * 
169      * @param filter The filter.
170      * @return Collection of {@link InternalRolePrincipal}.
171      */    
172     Iterator getInternalRolePrincipals(String filter);
173     
174     /***
175      * <p>
176      * Returns a {@link InternalGroupPrincipal} collection of Group given the filter.
177      * </p>
178      * 
179      * @param filter The filter.
180      * @return Collection of {@link InternalGroupPrincipal}.
181      */    
182     Iterator getInternalGroupPrincipals(String filter);
183 
184 }