mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
Fix the Ada server skeleton to check the authsMethods in the Shared_Instance generic package (#7514)
[Ada] fix PUT request and authentication checks for the server skeleton
This commit is contained in:
parent
4bd8fc6e8a
commit
0de7f972fe
@ -33,6 +33,10 @@ package body {{package}}.Skeletons is
|
|||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
begin
|
begin
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
|
if not Context.Is_Authenticated then
|
||||||
|
Context.Set_Error (401, "Not authenticated");
|
||||||
|
return;
|
||||||
|
end if;
|
||||||
{{#scopes}}
|
{{#scopes}}
|
||||||
if not Context.Has_Permission (ACL_{{ident}}.Permission) then
|
if not Context.Has_Permission (ACL_{{ident}}.Permission) then
|
||||||
Context.Set_Error (403, "Permission denied");
|
Context.Set_Error (403, "Permission denied");
|
||||||
@ -48,7 +52,7 @@ package body {{package}}.Skeletons is
|
|||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
{{#hasFormParams}}
|
{{#hasFormParams}}
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
Swagger.Servers.Get_Parameter (Req, "{{baseName}}", {{paramName}});
|
Swagger.Servers.Get_Parameter (Context, "{{baseName}}", {{paramName}});
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
{{/hasFormParams}}
|
{{/hasFormParams}}
|
||||||
{{#hasParams}}
|
{{#hasParams}}
|
||||||
@ -122,6 +126,18 @@ package body {{package}}.Skeletons is
|
|||||||
Result : {{returnType}};
|
Result : {{returnType}};
|
||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
begin
|
begin
|
||||||
|
{{#authMethods}}
|
||||||
|
if not Context.Is_Authenticated then
|
||||||
|
Context.Set_Error (401, "Not authenticated");
|
||||||
|
return;
|
||||||
|
end if;
|
||||||
|
{{#scopes}}
|
||||||
|
if not Context.Has_Permission (ACL_{{ident}}.Permission) then
|
||||||
|
Context.Set_Error (403, "Permission denied");
|
||||||
|
return;
|
||||||
|
end if;
|
||||||
|
{{/scopes}}
|
||||||
|
{{/authMethods}}
|
||||||
{{#queryParams}}
|
{{#queryParams}}
|
||||||
Swagger.Servers.Get_Query_Parameter (Req, "{{baseName}}", {{paramName}});
|
Swagger.Servers.Get_Query_Parameter (Req, "{{baseName}}", {{paramName}});
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
@ -130,7 +146,7 @@ package body {{package}}.Skeletons is
|
|||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
{{#hasFormParams}}
|
{{#hasFormParams}}
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
Swagger.Servers.Get_Parameter (Req, "{{baseName}}", {{paramName}});
|
Swagger.Servers.Get_Parameter (Context, "{{baseName}}", {{paramName}});
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
{{/hasFormParams}}
|
{{/hasFormParams}}
|
||||||
{{#hasParams}}
|
{{#hasParams}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user