有什么方法可以获取.net核心API的所有授权终结点? 目前,我设法获得了所有路线:
[HttpGet("routes")]
public IActionResult GetRoutes() {
var routes = _provider.ActionDescriptors.Items.Select(x => new {
Action = x.RouteValues["Action"],
Controller = x.RouteValues["Controller"],
Name = x.AttributeRouteInfo.Name,
Template = x.AttributeRouteInfo.Template
}).ToList();
return Ok(routes);
}
但是有什么方法可以知道哪个路线具有[Authorized]批注吗?
预先感谢
答案 0 :(得分:1)
这是我的实现,用于查找安全的控制器和操作:
4742 <declare-styleable name="Spinner">
...
4763 <!-- Reference to a layout to use for displaying a prompt in the dropdown for
4764 spinnerMode="dropdown". This layout must contain a TextView with the id
4765 {@code @android:id/text1} to be populated with the prompt text. -->
4766 <attr name="popupPromptView" format="reference" />
...
4772 </declare-styleable>
github上的完整源代码。