1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.config.beans;
21
22
23 import java.util.Arrays;
24 import java.util.HashSet;
25 import java.util.Set;
26
27
28 import org.apache.directory.server.config.ConfigurationElement;
29
30
31
32
33
34
35
36 public class HashInterceptorBean extends InterceptorBean
37 {
38
39 @ConfigurationElement(attributeType = "ads-hashAlgorithm", isOptional = true, defaultValue = "SSHA-256" )
40 private String hashAlgorithm;
41
42
43 @ConfigurationElement(attributeType = "ads-hashAttribute", isOptional = true, defaultValues = {"2.5.4.35"} )
44 private Set<String> hashAttributes = new HashSet<>();
45
46
47
48
49
50 public HashInterceptorBean()
51 {
52 super();
53 }
54
55
56
57
58
59 public void addHashAttributes( String[] hashAttributes )
60 {
61 if ( hashAttributes != null && hashAttributes.length > 0 )
62 {
63 if ( this.hashAttributes == null )
64 {
65 this.hashAttributes = new HashSet<>();
66 }
67 this.hashAttributes.addAll( Arrays.asList( hashAttributes ) );
68 }
69 }
70
71
72
73
74
75 public String getHashAlgorithm()
76 {
77 return hashAlgorithm;
78 }
79
80
81
82
83
84 public Set<String> getHashAttributes()
85 {
86 return hashAttributes;
87 }
88
89
90
91
92
93 public void setHashAlgorithm( String hashAlgorithm )
94 {
95 this.hashAlgorithm = hashAlgorithm;
96 }
97
98
99
100
101
102 @Override
103 public String toString( String tabs )
104 {
105 StringBuilder sb = new StringBuilder();
106
107 sb.append( tabs ).append( "HashInterceptor :\n" );
108 sb.append( super.toString( tabs + " " ) );
109
110 if ( hashAlgorithm != null )
111 {
112 sb.append( tabs ).append( " hashAlgorithm : " )
113 .append( hashAlgorithm ).append( "\n" );
114 }
115 if ( ( hashAttributes != null ) && !hashAttributes.isEmpty() )
116 {
117 sb.append( tabs ).append( " hashAttributes :\n" );
118
119 for ( String hashAttribute : hashAttributes )
120 {
121 sb.append( tabs ).append( " " ).append( hashAttribute );
122 }
123 }
124
125 return sb.toString();
126 }
127 }