You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2020/08/11 09:39:19 UTC
[james-project] 02/10: JAMES-3351 Allow only 1 set of credential
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 <dl...@linagora.com>
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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org