Java 类io.swagger.annotations.AuthorizationScope 实例源码

项目:swagger-maven-plugin    文件:AbstractReader.java   
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;
}