小编sim*_*bro的帖子

YubiKey + Webauth:userHandle 始终为 null

当我使用 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)

security webauthn yubikey

1
推荐指数
1
解决办法
284
查看次数

Rust + Rocket:我如何从请求中读取 POST 正文作为字符串?

我正在使用 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)

rest rust rust-rocket

1
推荐指数
1
解决办法
1578
查看次数

使用Zuul和Eureka自动配置路由

通过阅读各种书籍/教程,似乎可以在将Zuul与Eureka服务发现结合使用时自动配置Zuul中的路由。这意味着我不必显式添加到Zull的application.properties的路由。

所以我理解正确吗?还是我仍然需要显式添加路由到Zuul才能使其充当网关?

我希望它根据在Eureka中注册的应用程序名称自动创建路由。这可能吗?

(注意:我实际上已经尝试过了,但是当我转到http:// localhost:8762 / routes时,我只会看到一个错误页面。)

spring-boot netflix-eureka netflix-zuul

0
推荐指数
1
解决办法
1346
查看次数

Portainer-如何在docker-compose.yml中指定SSL?

我正在尝试将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 docker-swarm portainer

0
推荐指数
3
解决办法
2675
查看次数