01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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.wicket.authorization.strategies.role;
18:
19: /**
20: * Strategy for doing role checking. Normally, an implementation of this
21: * strategy interface would look in the current session for credentials that
22: * indicate what roles the current user can take on, but any kind of strategy is
23: * possible. For example, you could have a role checking strategy that allowed
24: * gave users the ADMIN role between 9AM and 5PM.
25: *
26: * @author Eelco Hillenius
27: * @author Jonathan Locke
28: */
29: public interface IRoleCheckingStrategy {
30: /**
31: * Whether any of the given roles matches. For example, if a user has role
32: * USER and the provided roles are {USER, ADMIN} this method should return
33: * true as the user has at least one of the roles that were provided.
34: *
35: * @param roles
36: * the roles
37: * @return true if a user or whatever subject this implementation wants to
38: * work with has at least on of the provided roles
39: */
40: boolean hasAnyRole(Roles roles);
41: }
|