> For the complete documentation index, see [llms.txt](https://rs.ppgg.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rs.ppgg.in/other-information/testing-sso.md).

# \*测试 SSO

{% hint style="success" %}
对应的[官方页面地址](https://github.com/dani-garcia/vaultwarden/wiki/Testing-SSO/)
{% endhint %}

## 用于测试 SSO 的开发设置 <a href="#development-setup-to-test-sso" id="development-setup-to-test-sso"></a>

Vaultwarden 的 SSO 支持目前[正在开发中](https://github.com/dani-garcia/vaultwarden/pull/3154)。以下内容描述了基于 docker-compose 的用于本地测试这些更改的设置。

{% hint style="danger" %}
**仅用于测试 SSO，这些设置并不安全！**
{% endhint %}

## 设置 <a href="#setup" id="setup"></a>

* 查看 SSO 分支
* 使用以下内容创建 `docker-compose.yml`：

  ```yaml
  services:
    vaultwarden:
      build: .
      environment:
        DOMAIN: "http://localhost:8000"
        I_REALLY_WANT_VOLATILE_STORAGE: "true"
        SSO_ENABLED: "true"
        SSO_CLIENT_ID: "client"
        SSO_CLIENT_SECRET: "clientsecret"
        SSO_AUTHORITY: "http://auth.test:8080/mock"
      ports:
        - 127.0.0.1:8000:80

    mock-oauth2:
      image: ghcr.io/navikt/mock-oauth2-server:0.5.10
      hostname: "auth.test"
      ports:
        - 127.0.0.1:8080:8080
  ```
* 将 `auth.test` 添加到您的系统 host 文件中：`echo "127.0.0.1 auth.test" | sudo tee -a /etc/hosts`
* 构建 Vaultwarden：`docker compose build`

## 测试 <a href="#testing" id="testing"></a>

* 启动服务：`docker compose up`
* 转到 <http://localhost:8000/#/sso>，输入任意字符串作为标识符，点击「登录」
* 在模拟 Auth2 服务器登录页面上，输入任意字符串作为用户/主题，并在声明字段中添加要测试的电子邮件，像这样：`{"email": "user@example.com"}`
* 如果一切按计划进行，您将会被要求输入主密码


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://rs.ppgg.in/other-information/testing-sso.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
