5.3.2. 它如何工作
已创建安全域 sample-domain,并配置为使用 IdentityLoginModule。登录模块中配置了以下凭证:
| username | 密码 | 角色 |
|---|---|---|
| 文莱 | samplePass | 示例 |
在启动时,JBoss EAP 加载核心服务并启动 undertow 和 security 子系统,这些子系统分别管理所有 Web 应用和 sample-domain 的 HTTPS 连接。sampleApp2.war 已加载,并查找 sample-domain,以便为其安全 URL 提供身份验证和授权。sampleApp2.war 有两个 HTML 文件 /hello.html 和 /secure/hello.html,并使用基本的 HTTP 身份验证来保护路径 /secure/*。它使用 sample-domain 安全域,需要 sample 的角色。
当文稿请求 /hello.html 时,他能够查看该页面而不进行身份验证。当葡萄牙尝试请求 /secure/hello.html 时,会提示他输入其用户名和密码。成功登录后,他能够查看 /secure/hello.html。所有其他用户均可在不登录的情况下访问 /hello.html,但是任何用户都无法访问 /secure/hello.html,因为文莱是 sample-domain 中的唯一用户。这也适用于通过 HTTPS 处理的所有流量。