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;
24 * Spring factory for {@link IPAddressLoginHandler}.
26 public class IPAddressLoginHandlerFactoryBean extends AbstractLoginHandlerFactoryBean {
28 /** The list of denied or permitted IPs. */
29 private List<String> addresses;
31 /** The username to use for IP-address "authenticated" users. */
32 private String username;
34 /** Are the IPs in ipList a permitted list or a deny list. */
35 private boolean defaultDeny;
38 protected Object createInstance() throws Exception {
39 IPAddressLoginHandler handler = new IPAddressLoginHandler();
40 handler.setUsername(getUsername());
41 handler.setEntries(getAddresses(), isDefaultDeny());
42 populateHandler(handler);
47 public Class getObjectType() {
48 return IPAddressLoginHandler.class;
52 * Get the list of denied or permitted IPs.
54 * @return list of denied or permitted IPs
56 public List<String> getAddresses() {
61 * Set the list of denied or permitted IPs.
63 * @param newAddresses list of denied or permitted IPs
65 public void setAddresses(List<String> newAddresses) {
66 addresses = newAddresses;
70 * Get the username to use for IP-address "authenticated" users.
72 * @return username to use for IP-address "authenticated" users
74 public String getUsername() {
79 * Set the username to use for IP-address "authenticated" users.
81 * @param newUsername username to use for IP-address "authenticated" users
83 public void setUsername(String newUsername) {
84 username = newUsername;
88 * Get whether the IPs in ipList a permitted list or a deny list.
90 * @return whether the IPs in ipList a permitted list or a deny list
92 public boolean isDefaultDeny() {
97 * Set whether the IPs in ipList a permitted list or a deny list.
99 * @param newDefaultDeny whether the IPs in ipList a permitted list or a deny list.
101 public void setDefaultDeny(boolean newDefaultDeny) {
102 defaultDeny = newDefaultDeny;