Skip to content

Commit 63368b0

Browse files
committed
Renamed nonce value column/attribute in ACME database
The nonce value column/attribute in ACME database has been renamed to id for consistency.
1 parent 183558f commit 63368b0

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

base/acme/database/ldap/schema.ldif

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ attributeTypes: ( acmeStatus-oid NAME 'acmeStatus'
1818
attributeTypes: ( acmeError-oid NAME 'acmeError'
1919
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
2020
SINGLE-VALUE )
21-
attributeTypes: ( acmeNonceValue-oid NAME 'acmeNonceValue'
21+
attributeTypes: ( acmeNonceId-oid NAME 'acmeNonceId'
2222
SUP name
2323
SINGLE-VALUE )
2424
attributeTypes: ( acmeAccountId-oid NAME 'acmeAccountId'
@@ -56,7 +56,7 @@ attributeTypes: ( acmeCertificateId-oid NAME 'acmeCertificateId'
5656
add: objectClasses
5757
objectClasses: ( acmeNonce-oid NAME 'acmeNonce'
5858
STRUCTURAL
59-
MUST ( acmeNonceValue $ acmeExpires ) )
59+
MUST ( acmeNonceId $ acmeExpires ) )
6060
objectClasses: ( acmeAccount-oid NAME 'acmeAccount'
6161
STRUCTURAL
6262
MUST ( acmeAccountId $ acmeAccountKey $ acmeStatus )

base/acme/database/postgresql/create.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CREATE TABLE "nonces" (
2-
"value" VARCHAR PRIMARY KEY,
2+
"id" VARCHAR PRIMARY KEY,
33
"expires" TIMESTAMP NOT NULL
44
);
55

base/acme/database/postgresql/statements.conf

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ SELECT \
44
FROM \
55
"nonces" \
66
WHERE \
7-
"value" = ?
7+
"id" = ?
88

99
addNonce=\
1010
INSERT INTO \
11-
"nonces" ("value", "expires") \
11+
"nonces" ("id", "expires") \
1212
VALUES \
1313
(?, ?)
1414

1515
removeNonce=\
1616
DELETE FROM \
1717
"nonces" \
1818
WHERE \
19-
"value" = ?
19+
"id" = ?
2020

2121
getExpiredNonceIDs=\
2222
SELECT \
23-
"value" \
23+
"id" \
2424
FROM \
2525
"nonces" \
2626
WHERE \

base/acme/src/main/java/org/dogtagpki/acme/database/LDAPDatabase.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class LDAPDatabase extends ACMEDatabase {
8282
static final String ATTR_ERROR = "acmeError";
8383
static final String ATTR_EXPIRES = "acmeExpires";
8484
static final String ATTR_IDENTIFIER = "acmeIdentifier";
85-
static final String ATTR_NONCE_VALUE = "acmeNonceValue";
85+
static final String ATTR_NONCE_ID = "acmeNonceId";
8686
static final String ATTR_ORDER_ID = "acmeOrderId";
8787
static final String ATTR_STATUS = "acmeStatus";
8888
static final String ATTR_TOKEN = "acmeToken";
@@ -223,7 +223,7 @@ public void init() throws Exception {
223223
}
224224

225225
public ACMENonce getNonce(String nonceID) throws Exception {
226-
String dn = ATTR_NONCE_VALUE + "=" + nonceID + "," + RDN_NONCE + "," + basedn;
226+
String dn = ATTR_NONCE_ID + "=" + nonceID + "," + RDN_NONCE + "," + basedn;
227227
LDAPEntry entry = ldapGet(dn);
228228
if (entry == null) return null;
229229

@@ -239,11 +239,11 @@ public ACMENonce getNonce(String nonceID) throws Exception {
239239
public void addNonce(ACMENonce nonce) throws Exception {
240240
LDAPAttribute[] attrs = {
241241
new LDAPAttribute(ATTR_OBJECTCLASS, OBJ_NONCE),
242-
new LDAPAttribute(ATTR_NONCE_VALUE, nonce.getID()),
242+
new LDAPAttribute(ATTR_NONCE_ID, nonce.getID()),
243243
new LDAPAttribute(ATTR_EXPIRES, dateFormat.format(nonce.getExpirationTime()))
244244
};
245245
LDAPAttributeSet attrSet = new LDAPAttributeSet(attrs);
246-
String dn = ATTR_NONCE_VALUE + "=" + nonce.getID() + "," + RDN_NONCE + "," + basedn;
246+
String dn = ATTR_NONCE_ID + "=" + nonce.getID() + "," + RDN_NONCE + "," + basedn;
247247
LDAPEntry entry = new LDAPEntry(dn, attrSet);
248248
ldapAdd(entry);
249249
}
@@ -252,7 +252,7 @@ public ACMENonce removeNonce(String nonceID) throws Exception {
252252
ACMENonce nonce = getNonce(nonceID);
253253
if (nonce == null) return null;
254254

255-
String dn = ATTR_NONCE_VALUE + "=" + nonceID + "," + RDN_NONCE + "," + basedn;
255+
String dn = ATTR_NONCE_ID + "=" + nonceID + "," + RDN_NONCE + "," + basedn;
256256
ldapDelete(dn, OnNoSuchObject.Ignore);
257257

258258
return nonce;

base/acme/src/main/java/org/dogtagpki/acme/database/PostgreSQLDatabase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public Collection<String> getExpiredNonceIDs(Date currentTime) throws Exception
252252
try (ResultSet rs = ps.executeQuery()) {
253253

254254
while (rs.next()) {
255-
String nonceID = rs.getString("value");
255+
String nonceID = rs.getString("id");
256256
nonces.add(nonceID);
257257
}
258258
}

0 commit comments

Comments
 (0)