🔒 Mock 资源服务器(Resource Server)

OAuth2 里 RP(客户端)之外的另一角色:一个受 Bearer access token 保护的 API。 它只信任本站 Mock OP 签发、未过期scope 含 profile 的 access token。

受保护端点

GET https://mock.authn.tech/rs/api — 需请求头 Authorization: Bearer <access_token>

试用步骤

1) 先从 Mock OP 拿一个 access token(用授权码流程,或最简单的 client_credentials):

curl -s -X POST https://mock.authn.tech/oidc/token \
  -d grant_type=client_credentials -d client_id=demo -d scope="openid profile"

2) 用返回的 access_token 调用受保护 API:

curl -s https://mock.authn.tech/rs/api -H "Authorization: Bearer <access_token>"

令牌有效、scope 足够 → 返回受保护资源;缺 scope → 403 insufficient_scope; 无/失效令牌 → 401 invalid_token

仅供测试。真实资源服务器还应校验 aud/iss,并按最小权限设计 scope。