This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit b9e249e4cc3863502d2410bd1fcf9644ffbfcbf5 Author: LanKhuat <[email protected]> AuthorDate: Tue Jul 28 14:15:50 2020 +0700 JAMES-3351 Allow only 1 set of credential --- .../java/org/apache/james/jmap/http/AuthenticationStrategy.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/http/AuthenticationStrategy.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/http/AuthenticationStrategy.java index 991e00a..5367a9b 100644 --- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/http/AuthenticationStrategy.java +++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/http/AuthenticationStrategy.java @@ -18,8 +18,6 @@ ****************************************************************/ package org.apache.james.jmap.http; -import java.util.stream.Stream; - import org.apache.james.mailbox.MailboxSession; import com.google.common.base.Preconditions; @@ -32,9 +30,10 @@ public interface AuthenticationStrategy { String AUTHORIZATION_HEADERS = "Authorization"; - default Stream<String> authHeaders(HttpServerRequest httpRequest) { + default String authHeaders(HttpServerRequest httpRequest) { Preconditions.checkArgument(httpRequest != null, "'httpRequest' is mandatory"); + Preconditions.checkArgument(httpRequest.requestHeaders().getAll(AUTHORIZATION_HEADERS).size() <= 1, "Only one set of credential is allowed"); - return httpRequest.requestHeaders().getAll(AUTHORIZATION_HEADERS).stream(); + return httpRequest.requestHeaders().get(AUTHORIZATION_HEADERS); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
