Skip to content

Commit

Permalink
Fix the Ada server skeleton to check the authsMethods in the Shared_I…
Browse files Browse the repository at this point in the history
…nstance generic package (#7514)

[Ada] fix PUT request and authentication checks for the server skeleton
  • Loading branch information
stcarrez authored and wing328 committed Jan 28, 2018
1 parent 4bd8fc6 commit 0de7f97
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ package body {{package}}.Skeletons is
{{/returnType}}
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");
Expand All @@ -48,7 +52,7 @@ package body {{package}}.Skeletons is
{{/pathParams}}
{{#hasFormParams}}
{{#formParams}}
Swagger.Servers.Get_Parameter (Req, "{{baseName}}", {{paramName}});
Swagger.Servers.Get_Parameter (Context, "{{baseName}}", {{paramName}});
{{/formParams}}
{{/hasFormParams}}
{{#hasParams}}
Expand Down Expand Up @@ -122,6 +126,18 @@ package body {{package}}.Skeletons is
Result : {{returnType}};
{{/returnType}}
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}}
Swagger.Servers.Get_Query_Parameter (Req, "{{baseName}}", {{paramName}});
{{/queryParams}}
Expand All @@ -130,7 +146,7 @@ package body {{package}}.Skeletons is
{{/pathParams}}
{{#hasFormParams}}
{{#formParams}}
Swagger.Servers.Get_Parameter (Req, "{{baseName}}", {{paramName}});
Swagger.Servers.Get_Parameter (Context, "{{baseName}}", {{paramName}});
{{/formParams}}
{{/hasFormParams}}
{{#hasParams}}
Expand Down

0 comments on commit 0de7f97

Please sign in to comment.