chibenwa commented on code in PR #2450:
URL: https://github.com/apache/james-project/pull/2450#discussion_r1799115445


##########
server/protocols/jmap/src/main/java/org/apache/james/jmap/http/XUserAuthenticationStrategy.java:
##########
@@ -36,25 +42,50 @@
 
 public class XUserAuthenticationStrategy implements AuthenticationStrategy {
     private static final String X_USER_HEADER_NAME = "X-User";
+    private static final String X_USER_SECRET_HEADER_NAME = "X-User-Secret";
+    private static final String AUTHENTICATION_STRATEGY_XUSER_SECRET = 
"authentication.strategy.rfc8621.xUser.secret";
+
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(XUserAuthenticationStrategy.class);
     private static final AuthenticationChallenge X_USER_CHALLENGE = 
AuthenticationChallenge.of(
         AuthenticationScheme.of("XUserHeader"),
         ImmutableMap.of());
 
+    private static Optional<String> 
extractXUserSecretFromConfig(PropertiesProvider propertiesProvider) {
+        try {
+            return 
Optional.ofNullable(propertiesProvider.getConfiguration("jmap"))
+                .map(config -> 
config.getString(AUTHENTICATION_STRATEGY_XUSER_SECRET, null));
+        } catch (FileNotFoundException | ConfigurationException e) {
+            return Optional.empty();

Review Comment:
   Please :
    - catch and recover only the FileNotFoundException exception.
    - forward ConfigurationException: the admin needs to be aware of the config 
issue and fix it. Aborting the start sequence for it is OK!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to