From f404aefec3227ccaffc69f45e2b208485fd5c6d5 Mon Sep 17 00:00:00 2001 From: heowc Date: Wed, 10 Oct 2018 22:04:14 +0900 Subject: [PATCH] DATACMNS-1403 - Fixed example source in reference documentation. Changed to example source for changed specifications. Original pull request: #321. --- src/main/asciidoc/auditing.adoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/asciidoc/auditing.adoc b/src/main/asciidoc/auditing.adoc index 30884b796..b112ebccd 100644 --- a/src/main/asciidoc/auditing.adoc +++ b/src/main/asciidoc/auditing.adoc @@ -47,15 +47,16 @@ The following example shows an implementation of the interface that uses Spring ---- class SpringSecurityAuditorAware implements AuditorAware { - public User getCurrentAuditor() { + public Optional getCurrentAuditor() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null || !authentication.isAuthenticated()) { - return null; + return Optional.empty(); } - return ((MyUserDetails) authentication.getPrincipal()).getUser(); + MyUserDetails myUserDetails = ((MyUserDetails) authentication.getPrincipal()).getUser(); + return Optional.of(myUserDetails); } } ----