View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.common.lib.policy;
20  
21  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
22  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
23  import java.util.ArrayList;
24  import java.util.List;
25  import org.apache.syncope.common.lib.Schema;
26  import org.apache.syncope.common.lib.types.AnyTypeKind;
27  import org.apache.syncope.common.lib.types.SchemaType;
28  
29  public class DefaultAccountRuleConf extends AbstractAccountRuleConf implements AccountRuleConf {
30  
31      private static final long serialVersionUID = 3259256974414758406L;
32  
33      /**
34       * Minimum length.
35       */
36      private int maxLength;
37  
38      /**
39       * Maximum length.
40       */
41      private int minLength;
42  
43      /**
44       * Pattern (regular expression) that must match.
45       */
46      private String pattern;
47  
48      /**
49       * Specify if one or more lowercase characters are permitted.
50       */
51      private boolean allUpperCase;
52  
53      /**
54       * Specify if one or more uppercase characters are permitted.
55       */
56      private boolean allLowerCase;
57  
58      /**
59       * Substrings not permitted.
60       */
61      private final List<String> wordsNotPermitted = new ArrayList<>();
62  
63      /**
64       * User attribute values not permitted.
65       */
66      @Schema(anyTypeKind = AnyTypeKind.USER,
67              type = { SchemaType.PLAIN, SchemaType.DERIVED, SchemaType.VIRTUAL })
68      private final List<String> schemasNotPermitted = new ArrayList<>();
69  
70      /**
71       * Substrings not permitted as prefix.
72       */
73      private final List<String> prefixesNotPermitted = new ArrayList<>();
74  
75      /**
76       * Substrings not permitted as suffix.
77       */
78      private final List<String> suffixesNotPermitted = new ArrayList<>();
79  
80      public boolean isAllLowerCase() {
81          return allLowerCase;
82      }
83  
84      public void setAllLowerCase(final boolean allLowerCase) {
85          this.allLowerCase = allLowerCase;
86      }
87  
88      public boolean isAllUpperCase() {
89          return allUpperCase;
90      }
91  
92      public void setAllUpperCase(final boolean allUpperCase) {
93          this.allUpperCase = allUpperCase;
94      }
95  
96      public int getMaxLength() {
97          return maxLength;
98      }
99  
100     public void setMaxLength(final int maxLength) {
101         this.maxLength = maxLength;
102     }
103 
104     public int getMinLength() {
105         return minLength;
106     }
107 
108     public void setMinLength(final int minLength) {
109         this.minLength = minLength;
110     }
111 
112     public String getPattern() {
113         return pattern;
114     }
115 
116     public void setPattern(final String pattern) {
117         this.pattern = pattern;
118     }
119 
120     @JacksonXmlElementWrapper(localName = "wordsNotPermitted")
121     @JacksonXmlProperty(localName = "word")
122     public List<String> getWordsNotPermitted() {
123         return wordsNotPermitted;
124     }
125 
126     @JacksonXmlElementWrapper(localName = "prefixesNotPermitted")
127     @JacksonXmlProperty(localName = "prefix")
128     public List<String> getPrefixesNotPermitted() {
129         return prefixesNotPermitted;
130     }
131 
132     @JacksonXmlElementWrapper(localName = "schemasNotPermitted")
133     @JacksonXmlProperty(localName = "schema")
134     public List<String> getSchemasNotPermitted() {
135         return schemasNotPermitted;
136     }
137 
138     @JacksonXmlElementWrapper(localName = "suffixesNotPermitted")
139     @JacksonXmlProperty(localName = "suffix")
140     public List<String> getSuffixesNotPermitted() {
141         return suffixesNotPermitted;
142     }
143 }