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 */
017package org.apache.wicket.authroles.authorization.strategies.role;
018
019/**
020 * Strategy for doing role checking. Normally, an implementation of this strategy interface would
021 * look in the current session for credentials that indicate what roles the current user can take
022 * on, but any kind of strategy is possible. For example, you could have a role checking strategy
023 * that allowed gave users the ADMIN role between 9AM and 5PM.
024 * 
025 * @author Eelco Hillenius
026 * @author Jonathan Locke
027 */
028@FunctionalInterface
029public interface IRoleCheckingStrategy
030{
031        /**
032         * Whether any of the given roles matches. For example, if a user has role USER and the provided
033         * roles are {USER, ADMIN} this method should return true as the user has at least one of the
034         * roles that were provided.
035         * 
036         * @param roles
037         *            the roles
038         * @return true if a user or whatever subject this implementation wants to work with has at
039         *         least on of the provided roles
040         */
041        boolean hasAnyRole(Roles roles);
042}