1 /* 2 * Licensed to the University Corporation for Advanced Internet Development, 3 * Inc. (UCAID) under one or more contributor license agreements. See the 4 * NOTICE file distributed with this work for additional information regarding 5 * copyright ownership. The UCAID licenses this file to You under the Apache 6 * License, Version 2.0 (the "License"); you may not use this file except in 7 * compliance with the License. You may obtain a copy of the License at 8 * 9 * 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 18 package edu.internet2.middleware.shibboleth.idp.config.profile.authn; 19 20 import edu.internet2.middleware.shibboleth.idp.authn.provider.PreviousSessionLoginHandler; 21 22 /** 23 * Spring factory for {@link PreviousSessionLoginHandler}. 24 */ 25 public class PreviousSessionLoginHandlerFactoryBean extends AbstractLoginHandlerFactoryBean { 26 27 /** Path to protected servlet. */ 28 private String servletPath; 29 30 /** Whether the login handler supports passive authentication. */ 31 private boolean supportPassiveAuth; 32 33 /** Whether the login handler will report its authentication method as PreviousSession. */ 34 private boolean reportPreviousSessionAuthnMethod; 35 36 /** {@inheritDoc} */ 37 public Class getObjectType() { 38 return PreviousSessionLoginHandler.class; 39 } 40 41 /** 42 * Gets the path of the servlet to which the user agent may be redirected. 43 * 44 * @return path of the servlet to which the user agent may be redirected 45 */ 46 public String getServletPath() { 47 return servletPath; 48 } 49 50 /** 51 * Sets the path of the servlet to which the user agent may be redirected. 52 * 53 * @param path path of the servlet to which the user agent may be redirected 54 */ 55 public void setServletPath(String path) { 56 servletPath = path; 57 } 58 59 /** 60 * Gets whether the login handler supports passive authentication. 61 * 62 * @return whether the login handler supports passive authentication 63 */ 64 public boolean supportsPassiveAuth() { 65 return supportPassiveAuth; 66 } 67 68 /** 69 * Sets whether the login handler supports passive authentication. 70 * 71 * @param supported whether the login handler supports passive authentication 72 */ 73 public void setSupportsPassiveAuth(boolean supported) { 74 supportPassiveAuth = supported; 75 } 76 77 /** 78 * Gets whether the login handler will report its authentication method as PreviousSession. 79 * 80 * @return whether the login handler will report its authentication method as PreviousSession 81 */ 82 public boolean reportPreviousSessionAuthnMethod() { 83 return reportPreviousSessionAuthnMethod; 84 } 85 86 /** 87 * Sets whether the login handler will report its authentication method as PreviousSession. 88 * 89 * @param report whether the login handler will report its authentication method as PreviousSession 90 */ 91 public void setReportPreviousSessionAuthnMethod(boolean report) { 92 reportPreviousSessionAuthnMethod = report; 93 } 94 95 /** {@inheritDoc} */ 96 protected Object createInstance() throws Exception { 97 PreviousSessionLoginHandler handler = new PreviousSessionLoginHandler(); 98 handler.setServletPath(getServletPath()); 99 handler.setSupportsPassive(supportsPassiveAuth()); 100 handler.setReportPreviousSessionAuthnMethod(reportPreviousSessionAuthnMethod()); 101 populateHandler(handler); 102 return handler; 103 } 104 }