ServiceStack - 自定义身份验证响应
ServiceStack - customize auth response
ServiceStack - 自定义身份验证响应
两个 AuthenticateResponse and ResponseStatus DTO 都包含一个 Meta
字符串字典,您可以使用它来添加其他数据。
您可以使用 Response Filter 或覆盖 AppHost 中的 OnAfterExecute()
方法修改返回的 AuthenticateResponse DTO。
使用全局响应过滤器
this.GlobalResponseFilters.Add((req, res, responseDto) => {
var authResponse = responseDto as AuthenticateResponse;
if (authResponse != null) {
authResponse.Meta = new Dictionary<string,string> {
{"foo", "bar"}
};
}
});
ServiceStack - 自定义身份验证响应
两个 AuthenticateResponse and ResponseStatus DTO 都包含一个 Meta
字符串字典,您可以使用它来添加其他数据。
您可以使用 Response Filter 或覆盖 AppHost 中的 OnAfterExecute()
方法修改返回的 AuthenticateResponse DTO。
使用全局响应过滤器
this.GlobalResponseFilters.Add((req, res, responseDto) => {
var authResponse = responseDto as AuthenticateResponse;
if (authResponse != null) {
authResponse.Meta = new Dictionary<string,string> {
{"foo", "bar"}
};
}
});