View Javadoc

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.common.config.attribute.resolver.attributeDefinition;
18  
19  import edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefinition.SAML2NameIDAttributeDefinition;
20  
21  /** Factory bean for creating {@link SAML2NameIDAttributeDefinition}s. */
22  public class SAML2NameIDAttributeDefinitionFactoryBean extends BaseAttributeDefinitionFactoryBean {
23      
24      /** Format of the NameID. */
25      private String nameIdFormat;
26  
27      /** Name qualifier for the NameID. */
28      private String nameIdQualifier;
29  
30      /** {@inheritDoc} */
31      public Class getObjectType() {
32          return SAML2NameIDAttributeDefinition.class;
33      }
34      
35      /**
36       * Gets the format for the NameID used as an attribute value.
37       * 
38       * @return format for the NameID used as an attribute value
39       */
40      public String getNameIdFormat() {
41          return nameIdFormat;
42      }
43  
44      /**
45       * Sets the format for the NameID used as an attribute value.
46       * 
47       * @param format format for the NameID used as an attribute value
48       */
49      public void setNameIdFormat(String format) {
50          nameIdFormat = format;
51      }
52  
53      /**
54       * Gets the NameID qualifier for the NameID used as an attribute value.
55       * 
56       * @return NameID qualifier for the NameID used as an attribute value
57       */
58      public String getNameIdQualifier() {
59          return nameIdQualifier;
60      }
61  
62      /**
63       * Sets the NameID qualifier for the NameID used as an attribute value.
64       * 
65       * @param qualifier NameID qualifier for the NameID used as an attribute value
66       */
67      public void setNameIdQualifier(String qualifier) {
68          nameIdQualifier = qualifier;
69      }
70  
71      /** {@inheritDoc} */
72      protected Object createInstance() throws Exception {
73          SAML2NameIDAttributeDefinition definition = new SAML2NameIDAttributeDefinition();
74          populateAttributeDefinition(definition);
75          
76          definition.setNameIdQualifier(nameIdQualifier);
77          definition.setNameIdFormat(nameIdFormat);
78          
79          return definition;
80      }
81  }