我有一个实现 OpenID Connect 客户端的 HTTP 服务器。OpenID Connect 协议涉及许多重定向,其中之一给我带来了麻烦,可能是由于 Referer 标头的存在。Firefox、Chrome 和 IE 都会出现此问题。
我创建了一个简单的 OpenID Connect Provider 实现用于测试,一切正常。但使用 salesforce.com 进行测试时,步骤 4 中的最终重定向存在问题。使用 salesforce.com 时,最终请求不包含 Cookie 标头。
使用我的 OpenID Connect 提供商进行测试
步骤 4 中发送到用户浏览器的响应:
HTTP/1.1 302 Found
Set-Cookie: session=c925f5006beb15cab779b292fe37e727; path=/; secure; HttpOnly
Location: https://localhost:21201/targetService
Content-Type: text/html; charset=UTF-8
Content-Length: 75
Run Code Online (Sandbox Code Playgroud)
浏览器返回:
GET /targetService HTTP/1.1
Host: localhost:21201
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, …Run Code Online (Sandbox Code Playgroud) 我正在使用com.sun.net.httpserver.HttpServer创建一个小容器来测试服务器代码的位数,并且无法让它使用多个线程来处理请求.
我调用java.util.concurrent.Executors.newFixedThreadPool(20)来创建一个包含20个线程的java.util.concurrent.ThreadPoolExecutor.然后,我在HttpServer上设置了这个Executor.使用Jmeter,我触发20个客户端线程,发送请求路由到服务器中唯一的HttpHandler实现.该处理程序执行System.out.println(this),我看到了这个输出:
Started TestServer at port 8800
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
http.TestHandler@30eb9dfa
Run Code Online (Sandbox Code Playgroud)
我想我会在这里看到20个(或近20个)不同的线程.这是代码.
package http;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
public class TestServer implements Runnable {
private final static int PORT = Integer.getInteger("test.port", 8800);
private static TestServer serverInstance;
private HttpServer httpServer;
private ExecutorService executor;
@Override
public void run() {
try {
executor = Executors.newFixedThreadPool(20); …Run Code Online (Sandbox Code Playgroud) 我的团队正在将现有产品作为OpenID Connect RP(依赖方)并使用connect2id的Nimbus JOSE + JWT库.该库支持签名和加密的JWT,但只先签名,然后加密.他们有理由不支持加密然后签名,但我们担心的是我们需要与之交互的一些OP可能会加密然后签名.
我们最初的目标是Salesforce和Google.我无法从他们的文档中确定,在担任OpenID Connect Providers时,Salesforce和Google是否使用sign-then-encrypt或encrypt-then-sign.
有人能指出我为这些OP记录的页面吗?或者它是非问题,因为没有人使用加密然后签名?谢谢.