Making building the docker images optional in spring_boot_scan
[cxf.git] / services / sts / sts-core / src / main / java / org / apache / cxf / sts / SignatureProperties.java
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.cxf.sts;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import org.apache.wss4j.dom.WSConstants;
25
26 /**
27 * This class contains various configuration properties that can be used to sign an issued token,
28 * or generate a symmetric key in the STS.
29 */
30 public class SignatureProperties {
31 private String signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
32 private String c14nAlgorithm = WSConstants.C14N_EXCL_OMIT_COMMENTS;
33 private List<String> acceptedSignatureAlgorithms = new ArrayList<>();
34 private List<String> acceptedC14nAlgorithms = new ArrayList<>();
35 private boolean useKeyValue;
36 private long keySize = 256;
37 private long minimumKeySize = 128;
38 private long maximumKeySize = 512;
39 private String digestAlgorithm = WSConstants.SHA256;
40
41 public SignatureProperties() {
42 // Default signature algorithms
43 acceptedSignatureAlgorithms.add(WSConstants.RSA_SHA1);
44 acceptedSignatureAlgorithms.add(signatureAlgorithm);
45
46 // Default c14n algorithms
47 acceptedC14nAlgorithms.add(c14nAlgorithm);
48 }
49
50 /**
51 * Get whether a KeyValue is used to refer to a a certificate used to sign an issued token.
52 * The default is false.
53 */
54 public boolean isUseKeyValue() {
55 return useKeyValue;
56 }
57
58 /**
59 * Set whether a KeyValue is used to refer to a a certificate used to sign an issued token.
60 * The default is false.
61 */
62 public void setUseKeyValue(boolean useKeyValue) {
63 this.useKeyValue = useKeyValue;
64 }
65
66 /**
67 * Get the key size to use when generating a symmetric key. The default is 256 bits.
68 */
69 public long getKeySize() {
70 return keySize;
71 }
72
73 /**
74 * Set the key size to use when generating a symmetric key. The default is
75 * 256 bits.
76 */
77 public void setKeySize(long keySize) {
78 this.keySize = keySize;
79 }
80
81 /**
82 * Get the minimum key size to use when generating a symmetric key. The requestor can
83 * specify a KeySize value to use. The default is 128 bits.
84 */
85 public long getMinimumKeySize() {
86 return minimumKeySize;
87 }
88
89 /**
90 * Set the minimum key size to use when generating a symmetric key. The requestor can
91 * specify a KeySize value to use. The default is 128 bits.
92 */
93 public void setMinimumKeySize(long minimumKeySize) {
94 this.minimumKeySize = minimumKeySize;
95 }
96
97 /**
98 * Get the maximum key size to use when generating a symmetric key to sign an issued token. The
99 * requestor can specify a KeySize value to use. The default is 512 bits.
100 */
101 public long getMaximumKeySize() {
102 return maximumKeySize;
103 }
104
105 /**
106 * Set the maximum key size to use when generating a symmetric key to sign an issued token. The
107 * requestor can specify a KeySize value to use. The default is 512 bits.
108 */
109 public void setMaximumKeySize(long maximumKeySize) {
110 this.maximumKeySize = maximumKeySize;
111 }
112
113 /**
114 * Get the signature algorithm to use
115 */
116 public String getSignatureAlgorithm() {
117 return signatureAlgorithm;
118 }
119
120 /**
121 * Set the signature algorithm to use
122 */
123 public void setSignatureAlgorithm(String signatureAlgorithm) {
124 this.signatureAlgorithm = signatureAlgorithm;
125 }
126
127 /**
128 * Get the c14n algorithm to use
129 */
130 public String getC14nAlgorithm() {
131 return c14nAlgorithm;
132 }
133
134 /**
135 * Set the c14n algorithm to use
136 */
137 public void setC14nAlgorithm(String c14nAlgorithm) {
138 this.c14nAlgorithm = c14nAlgorithm;
139 }
140
141 /**
142 * Get the list of accepted signature algorithms. A request can contain a wst:SignatureAlgorithm
143 * uri to use to sign an issued token. The algorithm specified must be contained in this list.
144 * The default algorithms are RSA-SHA1.
145 */
146 public List<String> getAcceptedSignatureAlgorithms() {
147 return acceptedSignatureAlgorithms;
148 }
149
150 /**
151 * Set the list of accepted signature algorithms. A request can contain a wst:SignatureAlgorithm
152 * uri to use to sign an issued token. The algorithm specified must be contained in this list.
153 * The default algorithms are RSA-SHA1.
154 */
155 public void setAcceptedSignatureAlgorithms(
156 List<String> acceptedSignatureAlgorithms
157 ) {
158 this.acceptedSignatureAlgorithms = acceptedSignatureAlgorithms;
159 }
160
161
162 /**
163 * Get the list of accepted c14n algorithms. A request can contain a wst:CanonicalizationAlgorithm
164 * uri to use for c14n in an issued token. The algorithm specified must be contained in this list.
165 * The default algorithms are C14N_EXCL_OMIT_COMMENTS.
166 */
167 public List<String> getAcceptedC14nAlgorithms() {
168 return acceptedC14nAlgorithms;
169 }
170
171 /**
172 * Set the list of accepted c14n algorithms. A request can contain a wst:CanonicalizationAlgorithm
173 * uri to use for c14n in an issued token. The algorithm specified must be contained in this list.
174 * The default algorithms are C14N_EXCL_OMIT_COMMENTS.
175 */
176 public void setAcceptedC14nAlgorithms(List<String> acceptedC14nAlgorithms) {
177 this.acceptedC14nAlgorithms = acceptedC14nAlgorithms;
178 }
179
180 /**
181 * Get the Digest algorithm to use for Signature
182 * @return the Digest algorithm to use for Signature
183 */
184 public String getDigestAlgorithm() {
185 return digestAlgorithm;
186 }
187
188 /**
189 * Set the Digest algorithm to use for Signature
190 * @param digestAlgorithm the Digest algorithm to use for Signature
191 */
192 public void setDigestAlgorithm(String digestAlgorithm) {
193 this.digestAlgorithm = digestAlgorithm;
194 }
195
196 }