Skip to content

Commit

Permalink
Add security to methods if not defined on controller class.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed May 23, 2017
1 parent f8dd4f5 commit ec4fc90
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,7 @@ else if (producesContentType.contains(MediaType.TEXT_HTML))

List<String> securityDefinitions = new ArrayList<>();

securityDefinitions.addAll(typeLevelSecurityDefinitions);


if( Optional.ofNullable(m.getAnnotation(io.swagger.annotations.ApiOperation.class)).isPresent() )
{
io.swagger.annotations.ApiOperation apiOperationAnnotation = m.getAnnotation(io.swagger.annotations.ApiOperation.class);
Expand All @@ -1119,6 +1118,11 @@ else if (producesContentType.contains(MediaType.TEXT_HTML))
}
}
}

if(securityDefinitions.isEmpty())
{
securityDefinitions.addAll(typeLevelSecurityDefinitions);
}


if (wrapAnnotation.isPresent() || typeLevelHandlerWrapperMap.size() > 0 || securityDefinitions.size() > 0)
Expand Down

0 comments on commit ec4fc90

Please sign in to comment.