2 * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package edu.internet2.middleware.shibboleth.idp.config.profile.authn;
19 import java.util.List;
21 import edu.internet2.middleware.shibboleth.idp.authn.provider.IPAddressLoginHandler;
22 import edu.internet2.middleware.shibboleth.idp.util.IPRange;
25 * Spring factory for {@link IPAddressLoginHandler}.
27 public class IPAddressLoginHandlerFactoryBean extends AbstractLoginHandlerFactoryBean {
29 /** The username to use for IP-address "authenticated" users. */
30 private String authenticatedUser;
32 /** List of configured IP ranged. */
33 private List<IPRange> ipRanges;
35 /** Whether a user is "authenticated" if their IP address is within a configured IP range. */
36 private boolean ipInRangeIsAuthenticated;
39 public Class getObjectType() {
40 return IPAddressLoginHandler.class;
44 * @param user The authenticatedUser to set.
46 public void setAuthenticatedUser(String user) {
47 authenticatedUser = user;
51 * @param ranges The ipRanges to set.
53 public void setIpRanges(List<IPRange> ranges) {
58 * @param authenticated The ipInRangeIsAuthenticated to set.
60 public void setIpInRangeIsAuthenticated(boolean authenticated) {
61 ipInRangeIsAuthenticated = authenticated;
65 protected Object createInstance() throws Exception {
66 IPAddressLoginHandler handler = new IPAddressLoginHandler(authenticatedUser, ipRanges, ipInRangeIsAuthenticated);
67 populateHandler(handler);