1 /* 2 * Copyright 2007 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.common.config.relyingparty.saml; 18 19 import edu.internet2.middleware.shibboleth.common.relyingparty.provider.saml2.SSOConfiguration; 20 21 /** Spring factory for SAML 2 SSO profile configurations. */ 22 public class SAML2SSOProfileConfigurationFactoryBean extends AbstractSAML2ProfileConfigurationFactoryBean { 23 24 /** Whether responses to the authentication request should include an attribute statement. */ 25 private boolean includeAttributeStatement; 26 27 /** The maximum amount of time, in milliseconds, the service provider should maintain a session for the user. */ 28 private long maximumSPSessionLifetime; 29 30 /** {@inheritDoc} */ 31 public Class getObjectType() { 32 return SSOConfiguration.class; 33 } 34 35 /** 36 * Gets whether responses to the authentication request should include an attribute statement. 37 * 38 * @return whether responses to the authentication request should include an attribute statement 39 */ 40 public boolean includeAttributeStatement() { 41 return includeAttributeStatement; 42 } 43 44 /** 45 * Sets whether responses to the authentication request should include an attribute statement. 46 * 47 * @param include whether responses to the authentication request should include an attribute statement 48 */ 49 public void setIncludeAttributeStatement(boolean include) { 50 includeAttributeStatement = include; 51 } 52 53 /** 54 * Gets the maximum amount of time, in milliseconds, the service provider should maintain a session for the user 55 * based on the authentication assertion. 56 * 57 * @return max lifetime of service provider should maintain a session 58 */ 59 public long getMaximumSPSessionLifetime() { 60 return maximumSPSessionLifetime; 61 } 62 63 /** 64 * Sets the maximum amount of time, in milliseconds, the service provider should maintain a session for the user 65 * based on the authentication assertion. 66 * 67 * @param lifetime max lifetime of service provider should maintain a session 68 */ 69 public void setMaximumSPSessionLifetime(long lifetime) { 70 maximumSPSessionLifetime = lifetime; 71 } 72 73 /** {@inheritDoc} */ 74 protected Object createInstance() throws Exception { 75 SSOConfiguration configuration = new SSOConfiguration(); 76 populateBean(configuration); 77 configuration.setIncludeAttributeStatement(includeAttributeStatement()); 78 configuration.setMaximumSPSessionLifetime(maximumSPSessionLifetime); 79 80 return configuration; 81 } 82 }