如何使用 openiddict 反省电子邮件等 return 信息
How to get introspect to return information such as email with openiddict
有没有办法将 OpenIDDict 配置为 return 内省端点调用的有效负载中的其他字段?目前它只传回字段 active,client_id,exp,iat,iss,jti,nbf,sub,token_type,token_usage.
我确认 ~/connect/authorize 端点主体在调用“return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);”
之前拥有电子邮件声明
我确认 ~/connect/token 端点主体在调用“return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);”
之前也有电子邮件声明
由于以上两个陈述,我假设不透明令牌中包含电子邮件。内省端点不应该在有效负载中包含电子邮件信息吗?
我想为第 3 方资源服务器提供电子邮件值,以便能够识别访问令牌颁发给哪个用户。
如果全部满足以下条件,OpenIddict 3.0 只会返回可能非常敏感的应用程序声明:
声明存在于访问令牌中。这意味着您必须在调用 SignIn
.
之前为它们分配“access_token”目的地
发送内省请求的应用程序在调用 SignIn
时被明确列为资源(即您调用了 principal.SetResources("client_id of the API doing introspection")
)。
进行自省的 API 被注册为机密客户端(即被迫发送有效的 client_secret
以便能够自省令牌)。
如果要自定义内省响应,可以使用事件模型API:
options.AddEventHandler<HandleIntrospectionRequestContext>(builder =>
{
builder.UseInlineHandler(context =>
{
context.Claims["key"] = 42;
return default;
});
builder.SetOrder(AttachApplicationClaims.Descriptor.Order + 1_000);
});
有没有办法将 OpenIDDict 配置为 return 内省端点调用的有效负载中的其他字段?目前它只传回字段 active,client_id,exp,iat,iss,jti,nbf,sub,token_type,token_usage.
我确认 ~/connect/authorize 端点主体在调用“return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);”
之前拥有电子邮件声明我确认 ~/connect/token 端点主体在调用“return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);”
之前也有电子邮件声明由于以上两个陈述,我假设不透明令牌中包含电子邮件。内省端点不应该在有效负载中包含电子邮件信息吗?
我想为第 3 方资源服务器提供电子邮件值,以便能够识别访问令牌颁发给哪个用户。
如果全部满足以下条件,OpenIddict 3.0 只会返回可能非常敏感的应用程序声明:
声明存在于访问令牌中。这意味着您必须在调用
之前为它们分配“access_token”目的地SignIn
.发送内省请求的应用程序在调用
SignIn
时被明确列为资源(即您调用了principal.SetResources("client_id of the API doing introspection")
)。进行自省的 API 被注册为机密客户端(即被迫发送有效的
client_secret
以便能够自省令牌)。
如果要自定义内省响应,可以使用事件模型API:
options.AddEventHandler<HandleIntrospectionRequestContext>(builder =>
{
builder.UseInlineHandler(context =>
{
context.Claims["key"] = 42;
return default;
});
builder.SetOrder(AttachApplicationClaims.Descriptor.Order + 1_000);
});