mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
Added error-throw if no auth-handler was set up before controller is added to router or swagger-doc.
Also added missing undef for `OATPP_MACRO_API_CONTROLLER_AUTHORIZATION_2` and `OATPP_MACRO_API_CONTROLLER_AUTHORIZATION_INFO_2`
This commit is contained in:
parent
fb29f0d919
commit
7b0f6e64d0
@ -276,6 +276,8 @@ if(__param_obj_##NAME) { \
|
||||
info->headers.add(oatpp::web::protocol::http::Header::AUTHORIZATION, oatpp::String::Class::getType()); \
|
||||
info->headers[oatpp::web::protocol::http::Header::AUTHORIZATION].description = __param_obj_##NAME ->getScheme(); \
|
||||
info->authorization = __param_obj_##NAME ->getScheme(); \
|
||||
} else { \
|
||||
throw oatpp::web::protocol::http::HttpError(Status::CODE_500, "No authorization handler set up in controller before controller was added to router or swagger-doc."); \
|
||||
}
|
||||
|
||||
#define OATPP_MACRO_API_CONTROLLER_AUTHORIZATION_INFO_2(TYPE, NAME, AUTH_HANDLER) \
|
||||
@ -284,6 +286,8 @@ if(__auth_handler_##NAME) { \
|
||||
info->headers.add(oatpp::web::protocol::http::Header::AUTHORIZATION, oatpp::String::Class::getType()); \
|
||||
info->headers[oatpp::web::protocol::http::Header::AUTHORIZATION].description = __auth_handler_##NAME->getScheme(); \
|
||||
info->authorization = __auth_handler_##NAME->getScheme(); \
|
||||
} else { \
|
||||
throw oatpp::web::protocol::http::HttpError(Status::CODE_500, "Invalid authorization handler given (or not set up) in AUTHORIZATION(TYPE, NAME, AUTH_HANDLER) before controller was added to router or swagger-doc."); \
|
||||
}
|
||||
|
||||
#define OATPP_MACRO_API_CONTROLLER_AUTHORIZATION_INFO(TYPE, PARAM_LIST) \
|
||||
|
@ -129,10 +129,12 @@
|
||||
|
||||
// AUTHORIZATION MACRO // ------------------------------------------------------
|
||||
#undef OATPP_MACRO_API_CONTROLLER_AUTHORIZATION_1
|
||||
#undef OATPP_MACRO_API_CONTROLLER_AUTHORIZATION_2
|
||||
#undef OATPP_MACRO_API_CONTROLLER_AUTHORIZATION
|
||||
|
||||
// __INFO
|
||||
#undef OATPP_MACRO_API_CONTROLLER_AUTHORIZATION_INFO_1
|
||||
#undef OATPP_MACRO_API_CONTROLLER_AUTHORIZATION_INFO_2
|
||||
#undef OATPP_MACRO_API_CONTROLLER_AUTHORIZATION_INFO
|
||||
|
||||
// FOR EACH // ------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user