当我使用 WebAuthn 和 YubiKey 进行身份验证时, response.userHandle 属性始终为空。那是我注册凭据的用户 id 和 displayName 不会返回。这是因为我在注册/身份验证过程中做错了什么:
async function register() {
const publicKeyCredentialCreationOptions = {
challenge: Uint8Array.from("this-is-a-test", (c) => c.charCodeAt(0)),
rp: {
name: "Webauthn Test",
id: "localhost",
},
user: {
id: Uint8Array.from("a1b2c3d4e5f6", (c) => c.charCodeAt(0)),
name: "just-a-test",
displayName: "MrUser",
},
pubKeyCredParams: [{ alg: -7, type: "public-key" }],
authenticatorSelection: {
authenticatorAttachment: "cross-platform",
},
timeout: 60000,
attestation: "direct",
};
const credential = await navigator.credentials.create({
publicKey: publicKeyCredentialCreationOptions,
});
}
Run Code Online (Sandbox Code Playgroud)
这是我用来验证的代码:
async function authenticate() {
const publicKeyCredentialRequestOptions = {
challenge: …Run Code Online (Sandbox Code Playgroud) 我正在使用 Rust 和 Rocket 构建一个简单的 REST API。其中一个端点接受 POST 方法请求,并从请求正文中读取一个大字符串。我不知道如何用火箭做到这一点。
该文档描述了如何从 POST 请求的正文中读取 JSON 对象,以及如何读取多部分表单数据,而不是原始字符串。有谁知道如何做到这一点?
更新:
按照下面 Dave 的回答中的建议,我实现了 FromDataSimple 特征来尝试解析请求正文。这是我已经实施的,但它只会导致“404 Not Found”响应:
struct Store {
contents: String,
}
impl FromDataSimple for Store {
type Error = String;
fn from_data(req: &Request, data: Data) -> data::Outcome<Self, String> {
let mut contents = String::new();
if let Err(e) = data.open().take(256).read_to_string(&mut contents) {
return Failure((Status::InternalServerError, format!("{:?}", e)));
}
Success(Store { contents })
}
}
#[post("/process", format = "application/json", data = "<input>")]
fn process_store(input: Store) -> …Run Code Online (Sandbox Code Playgroud) 通过阅读各种书籍/教程,似乎可以在将Zuul与Eureka服务发现结合使用时自动配置Zuul中的路由。这意味着我不必显式添加到Zull的application.properties的路由。
所以我理解正确吗?还是我仍然需要显式添加路由到Zuul才能使其充当网关?
我希望它根据在Eureka中注册的应用程序名称自动创建路由。这可能吗?
(注意:我实际上已经尝试过了,但是当我转到http:// localhost:8762 / routes时,我只会看到一个错误页面。)
我正在尝试将Portainer的一个实例部署到docker swarm。我不确定如何设置正确的标志以启用SSL。
从文档:
$ docker run -d -p 443:9000 --name portainer --restart always -v ~/local-certs:/certs -v portainer_data:/data portainer/portainer --ssl --sslcert /certs/portainer.crt --sslkey /certs/portainer.key
Run Code Online (Sandbox Code Playgroud)
https://portainer.readthedocs.io/en/stable/deployment.html
但是如何将其转换为docker compose yml文件?
docker ×1
docker-swarm ×1
netflix-zuul ×1
portainer ×1
rest ×1
rust ×1
rust-rocket ×1
security ×1
spring-boot ×1
webauthn ×1
yubikey ×1