Skip to content

Commit f4ecb00

Browse files
committed
improved session timeout config, new error handling code in UI
If the FHIR servers answers with a redirect to the OIDC provider due to an invalidated session Task resources to be created and QuestionnaireResponse resource to be updated are stored in the browsers session storage. After the redirect returns from the OIDC provider input elements are pre-filled from the stored resources and the send button scrolled into view. The send button blinks twice to get the users attention.
1 parent e0b6cf0 commit f4ecb00

4 files changed

Lines changed: 322 additions & 51 deletions

File tree

dsf-common/dsf-common-jetty/src/main/java/dev/dsf/common/config/AbstractJettyConfig.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ public abstract class AbstractJettyConfig extends AbstractCertificateConfig
212212
@Value("${dev.dsf.server.auth.oidc.back.channel.logout.path:/back-channel-logout}")
213213
private String oidcBackChannelPath;
214214

215+
@Documentation(description = "Maximum inactivity period after which the server session for OIDC logins is invalidated; the access token may expire earlier, resulting in earlier session invalidation")
216+
@Value("${dev.dsf.server.auth.oidc.session.timeout:PT30M}")
217+
private String oidcSessionTimeout;
218+
215219
@Documentation(description = "Forward (http/https) proxy url, use *DEV_DSF_BPE_PROXY_NOPROXY* to list domains that do not require a forward proxy", example = "http://proxy.foo:8080")
216220
@Value("${dev.dsf.proxy.url:#{null}}")
217221
private String proxyUrl;
@@ -318,6 +322,7 @@ private void configureSecurityHandler(WebAppContext webAppContext, Supplier<Inte
318322
{
319323
SessionHandler sessionHandler = webAppContext.getSessionHandler();
320324
sessionHandler.setSameSite(SameSite.LAX);
325+
sessionHandler.setMaxInactiveInterval(oidcSessionTimeout());
321326

322327
SessionCookieConfig sessionCookieConfig = sessionHandler.getSessionCookieConfig();
323328
sessionCookieConfig.setSecure(true);
@@ -334,7 +339,7 @@ private void configureSecurityHandler(WebAppContext webAppContext, Supplier<Inte
334339
if (oidcAuthorizationCodeFlowEnabled || oidcBearerTokenEnabled || oidcBackChannelLogoutEnabled)
335340
{
336341
openIdConfiguration = new OpenIdConfiguration.Builder(oidcProviderRealmBaseUrl, oidcClientId,
337-
oidcClientSecret).httpClient(createOidcClient()).build();
342+
oidcClientSecret).logoutWhenIdTokenIsExpired(true).httpClient(createOidcClient()).build();
338343

339344
if (oidcAuthorizationCodeFlowEnabled)
340345
{
@@ -441,20 +446,26 @@ private Duration getOidcProviderClientCacheJwksResourceTimeout()
441446
return assertPositive(Duration.parse(oidcProviderClientCacheJwksResourceTimeout));
442447
}
443448

444-
@Bean
445-
@Lazy
446-
public Duration oidcProviderClientTimeoutRead()
449+
private Duration oidcProviderClientTimeoutRead()
447450
{
448451
return assertPositive(Duration.parse(oidcProviderClientTimeoutRead));
449452
}
450453

451-
@Bean
452-
@Lazy
453-
public Duration oidcProviderClientTimeoutConnect()
454+
private Duration oidcProviderClientTimeoutConnect()
454455
{
455456
return assertPositive(Duration.parse(oidcProviderClientTimeoutConnect));
456457
}
457458

459+
private int oidcSessionTimeout()
460+
{
461+
long seconds = assertPositive(Duration.parse(oidcSessionTimeout)).getSeconds();
462+
463+
if (seconds >= Integer.MAX_VALUE)
464+
seconds = Integer.MAX_VALUE;
465+
466+
return (int) seconds;
467+
}
468+
458469
private Duration assertPositive(Duration duration)
459470
{
460471
if (duration != null && duration.isNegative())

dsf-fhir/dsf-fhir-server/src/main/resources/fhir/static/form.css

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,25 @@ input[type=number] {
255255
}
256256

257257
button.submit {
258-
background-color: #326F95;
259-
color: #fff;
258+
background-color: var(--color-prime);
259+
color: var(--color-background);
260260
padding: 12px 60px;
261261
border: none;
262262
border-radius: 4px;
263263
cursor: pointer;
264264
float: left;
265265
}
266266

267+
@keyframes button-blink-red {
268+
0% { background-color: var(--color-info-red); color: var(--color-info-background-red); }
269+
33.3% { background-color: var(--color-prime); color: var(--color-background); }
270+
66.6% { background-color: var(--color-info-red); color: var(--color-info-background-red); }
271+
}
272+
273+
.button-blink {
274+
animation: button-blink-red 0.7s steps(1);
275+
}
276+
267277
.spinner-enabled {
268278
display: block;
269279
}

0 commit comments

Comments
 (0)