本文整理汇总了Java中io.swagger.annotations.AuthorizationScope类的典型用法代码示例。如果您正苦于以下问题:Java AuthorizationScope类的具体用法?Java AuthorizationScope怎么用?Java AuthorizationScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthorizationScope类属于io.swagger.annotations包,在下文中一共展示了AuthorizationScope类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSecurityRequirements
import io.swagger.annotations.AuthorizationScope; //导入依赖的package包/类
protected List<SecurityRequirement> getSecurityRequirements(Api api) {
List<SecurityRequirement> securities = new ArrayList<SecurityRequirement>();
if(api == null) {
return securities;
}
for (Authorization auth : api.authorizations()) {
if (auth.value().isEmpty()) {
continue;
}
SecurityRequirement security = new SecurityRequirement();
security.setName(auth.value());
for (AuthorizationScope scope : auth.scopes()) {
if (!scope.scope().isEmpty()) {
security.addScope(scope.scope());
}
}
securities.add(security);
}
return securities;
}