1 /*
2 * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 package edu.internet2.middleware.shibboleth.idp.config.profile.authn;
18
19 import edu.internet2.middleware.shibboleth.idp.authn.provider.PreviousSessionLoginHandler;
20
21 /**
22 * Spring factory for {@link PreviousSessionLoginHandler}.
23 */
24 public class PreviousSessionLoginHandlerFactoryBean extends AbstractLoginHandlerFactoryBean {
25
26 /** Path to protected servlet. */
27 private String servletPath;
28
29 /** Whether the login handler supports passive authentication. */
30 private boolean supportPassiveAuth;
31
32 /** Whether the login handler will report its authentication method as PreviousSession. */
33 private boolean reportPreviousSessionAuthnMethod;
34
35 /** {@inheritDoc} */
36 public Class getObjectType() {
37 return PreviousSessionLoginHandler.class;
38 }
39
40 /**
41 * Gets the path of the servlet to which the user agent may be redirected.
42 *
43 * @return path of the servlet to which the user agent may be redirected
44 */
45 public String getServletPath() {
46 return servletPath;
47 }
48
49 /**
50 * Sets the path of the servlet to which the user agent may be redirected.
51 *
52 * @param path path of the servlet to which the user agent may be redirected
53 */
54 public void setServletPath(String path) {
55 servletPath = path;
56 }
57
58 /**
59 * Gets whether the login handler supports passive authentication.
60 *
61 * @return whether the login handler supports passive authentication
62 */
63 public boolean supportsPassiveAuth() {
64 return supportPassiveAuth;
65 }
66
67 /**
68 * Sets whether the login handler supports passive authentication.
69 *
70 * @param supported whether the login handler supports passive authentication
71 */
72 public void setSupportsPassiveAuth(boolean supported) {
73 supportPassiveAuth = supported;
74 }
75
76 /**
77 * Gets whether the login handler will report its authentication method as PreviousSession.
78 *
79 * @return whether the login handler will report its authentication method as PreviousSession
80 */
81 public boolean reportPreviousSessionAuthnMethod() {
82 return reportPreviousSessionAuthnMethod;
83 }
84
85 /**
86 * Sets whether the login handler will report its authentication method as PreviousSession.
87 *
88 * @param report whether the login handler will report its authentication method as PreviousSession
89 */
90 public void setReportPreviousSessionAuthnMethod(boolean report) {
91 reportPreviousSessionAuthnMethod = report;
92 }
93
94 /** {@inheritDoc} */
95 protected Object createInstance() throws Exception {
96 PreviousSessionLoginHandler handler = new PreviousSessionLoginHandler();
97 handler.setServletPath(getServletPath());
98 handler.setSupportsPassive(supportsPassiveAuth());
99 handler.setReportPreviousSessionAuthnMethod(reportPreviousSessionAuthnMethod());
100 populateHandler(handler);
101 return handler;
102 }
103 }