[java-plugin-shibd] branch main updated: Fix expiration precision so external contract is in seconds.
Scott Cantor
cantor.2 at osu.edu
Tue Jul 2 18:23:25 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-plugin-shibd.
View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd.git;a=commit;h=d4a3df9731a94de52e6b5a6eb964b7b94f1aeff9
The following commit(s) were added to refs/heads/main by this push:
new d4a3df9 Fix expiration precision so external contract is in seconds.
d4a3df9 is described below
commit d4a3df9731a94de52e6b5a6eb964b7b94f1aeff9
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jul 2 14:23:19 2024 -0400
Fix expiration precision so external contract is in seconds.
---
.../shibboleth/sp/profile/impl/DoStorageOperation.java | 15 ++++++++++++---
.../sp/profile/impl/DoStorageOperationTest.java | 2 +-
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoStorageOperation.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoStorageOperation.java
index 8f3f78f..d9abfee 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoStorageOperation.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoStorageOperation.java
@@ -178,7 +178,8 @@ public class DoStorageOperation extends AbstractAgentAction {
output.addmember(VERSION).longinteger(record.getVersion());
final Long exp = record.getExpiration();
if (exp != null) {
- output.addmember(EXP).longinteger(exp);
+ // Convert back to seconds.
+ output.addmember(EXP).longinteger(exp / 1000);
}
ensureAgentRequestContext().setOutput(output);
} else {
@@ -210,7 +211,11 @@ public class DoStorageOperation extends AbstractAgentAction {
// Decorate context with Agent ID for uniqueness.
context = ensureAgent().getId() + '!' + context;
- final Long exp = input.getmember(EXP).longinteger();
+ Long exp = input.getmember(EXP).longinteger();
+ if (exp != null) {
+ // Convert to ms.
+ exp *= 1000;
+ }
if (storageService.create(context, key, value, exp)) {
log.trace("{} Created record with context ({}), key ({}), expiration ({})", getLogPrefix(), context, key,
@@ -243,8 +248,12 @@ public class DoStorageOperation extends AbstractAgentAction {
// Decorate context with Agent ID for uniqueness.
context = ensureAgent().getId() + '!' + context;
- final Long exp = input.getmember(EXP).longinteger();
Long version = input.getmember(VERSION).longinteger();
+ Long exp = input.getmember(EXP).longinteger();
+ if (exp != null) {
+ // Convert to ms.
+ exp *= 1000;
+ }
if (version != null) {
try {
diff --git a/sp-server-impl/src/test/java/net/shibboleth/sp/profile/impl/DoStorageOperationTest.java b/sp-server-impl/src/test/java/net/shibboleth/sp/profile/impl/DoStorageOperationTest.java
index 28ff89d..e17ab76 100644
--- a/sp-server-impl/src/test/java/net/shibboleth/sp/profile/impl/DoStorageOperationTest.java
+++ b/sp-server-impl/src/test/java/net/shibboleth/sp/profile/impl/DoStorageOperationTest.java
@@ -170,7 +170,7 @@ public class DoStorageOperationTest extends BaseAgentRequestTest {
Assert.assertEquals(output.getmember(DoStorageOperation.VALUE).string(), VALUE);
Assert.assertEquals(output.getmember(DoStorageOperation.VERSION).longinteger(), 1);
- Assert.assertEquals(output.getmember(DoStorageOperation.EXP).longinteger(), exp);
+ Assert.assertEquals(output.getmember(DoStorageOperation.EXP).longinteger(), exp / 1000);
}
/**
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list