001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.security.spi;
018:
019: import java.util.Iterator;
020:
021: import org.apache.jetspeed.security.SecurityException;
022: import org.apache.jetspeed.security.om.InternalGroupPrincipal;
023: import org.apache.jetspeed.security.om.InternalRolePrincipal;
024: import org.apache.jetspeed.security.om.InternalUserPrincipal;
025:
026: /**
027: * <p>
028: * SecurityAccess
029: * </p>
030: * <p>
031: *
032: * </p>
033: * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
034: * @version $Id: SecurityAccess.java 290457 2005-09-20 14:14:31Z ate $
035: *
036: */
037: public interface SecurityAccess {
038: /**
039: * <p>
040: * Returns if a Internal UserPrincipal is defined for the user name.
041: * </p>
042: *
043: * @param username The user name.
044: * @return true if the user is known
045: */
046: public boolean isKnownUser(String username);
047:
048: /**
049: * <p>
050: * Returns the {@link InternalUserPrincipal} from the user name.
051: * </p>
052: *
053: * @param username The user name.
054: * @return The {@link InternalUserPrincipal}.
055: */
056: InternalUserPrincipal getInternalUserPrincipal(String username);
057:
058: /**
059: * <p>
060: * Returns the {@link InternalUserPrincipal} from the user name.
061: * </p>
062: *
063: * @param username The user name.
064: * @param isMappingOnly Whether a principal's purpose is for security mappping only.
065: * @return The {@link InternalUserPrincipal}.
066: */
067: InternalUserPrincipal getInternalUserPrincipal(String username,
068: boolean isMappingOnly);
069:
070: /**
071: * <p>
072: * Returns a {@link InternalUserPrincipal} collection given the filter.
073: * </p>
074: *
075: * @param filter The filter.
076: * @return Collection of {@link InternalUserPrincipal}.
077: */
078: Iterator getInternalUserPrincipals(String filter);
079:
080: /**
081: * <p>
082: * Sets the given {@link InternalUserPrincipal}.
083: * </p>
084: *
085: * @param internalUser The {@link InternalUserPrincipal}.
086: * @param isMappingOnly Whether a principal's purpose is for security mappping only.
087: * @throws SecurityException Throws a {@link SecurityException}.
088: */
089: void setInternalUserPrincipal(InternalUserPrincipal internalUser,
090: boolean isMappingOnly) throws SecurityException;
091:
092: /**
093: * <p>
094: * Remove the given {@link InternalUserPrincipal}.
095: * </p>
096: *
097: * @param internalUser The {@link InternalUserPrincipal}.
098: * @throws SecurityException Throws a {@link SecurityException}.
099: */
100: void removeInternalUserPrincipal(InternalUserPrincipal internalUser)
101: throws SecurityException;
102:
103: /**
104: * <p>
105: * Returns the {@link InternalRolePrincipal}from the role full path name.
106: * </p>
107: *
108: * @param roleFullPathName The role full path name.
109: * @return The {@link InternalRolePrincipal}.
110: */
111: InternalRolePrincipal getInternalRolePrincipal(
112: String roleFullPathName);
113:
114: /**
115: * <p>
116: * Sets the given {@link InternalRolePrincipal}.
117: * </p>
118: *
119: * @param internalRole The {@link InternalRolePrincipal}.
120: * @param isMappingOnly Whether a principal's purpose is for security mappping only.
121: * @throws SecurityException Throws a {@link SecurityException}.
122: */
123: void setInternalRolePrincipal(InternalRolePrincipal internalRole,
124: boolean isMappingOnly) throws SecurityException;
125:
126: /**
127: * <p>
128: * Remove the given {@link InternalRolePrincipal}.
129: * </p>
130: *
131: * @param internalRole The {@link InternalRolePrincipal}.
132: * @throws SecurityException Throws a {@link SecurityException}.
133: */
134: void removeInternalRolePrincipal(InternalRolePrincipal internalRole)
135: throws SecurityException;
136:
137: /**
138: * <p>
139: * Returns the {@link InternalGroupPrincipal}from the group full path name.
140: * </p>
141: *
142: * @param groupFullPathName The group full path name.
143: * @return The {@link InternalGroupPrincipal}.
144: */
145: InternalGroupPrincipal getInternalGroupPrincipal(
146: String groupFullPathName);
147:
148: /**
149: * <p>
150: * Sets the given {@link InternalGroupPrincipal}.
151: * </p>
152: *
153: * @param internalGroup The {@link InternalGroupPrincipal}.
154: * @param isMappingOnly Whether a principal's purpose is for security mappping only.
155: * @throws SecurityException Throws a {@link SecurityException}.
156: */
157: void setInternalGroupPrincipal(
158: InternalGroupPrincipal internalGroup, boolean isMappingOnly)
159: throws SecurityException;
160:
161: /**
162: * <p>
163: * Remove the given {@link InternalGroupPrincipal}.
164: * </p>
165: *
166: * @param internalGroup The {@link InternalGroupPrincipal}.
167: * @throws SecurityException Throws a {@link SecurityException}.
168: */
169: void removeInternalGroupPrincipal(
170: InternalGroupPrincipal internalGroup)
171: throws SecurityException;
172:
173: /**
174: * <p>
175: * Returns a {@link InternalRolePrincipal} collection given the filter.
176: * </p>
177: *
178: * @param filter The filter.
179: * @return Collection of {@link InternalRolePrincipal}.
180: */
181: Iterator getInternalRolePrincipals(String filter);
182:
183: /**
184: * <p>
185: * Returns a {@link InternalGroupPrincipal} collection of Group given the filter.
186: * </p>
187: *
188: * @param filter The filter.
189: * @return Collection of {@link InternalGroupPrincipal}.
190: */
191: Iterator getInternalGroupPrincipals(String filter);
192:
193: }
|