protected List<SecurityRequirement> getSecurityRequirements(Api api) { List<SecurityRequirement> securities = new ArrayList<>(); 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; }
@ApiOperation( value = "Delete categorization rule", authorizations = { @Authorization(value = "multibanking_auth", scopes = { @AuthorizationScope(scope = "openid", description = "") })}) @DeleteMapping(value = "/{ruleId}") public HttpEntity<Void> deleteRule(@PathVariable String ruleId) { rulesService.deleteById(ruleId); log.info("Rule [{}] deleted.", ruleId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); }
List<springfox.documentation.service.AuthorizationScope> authorizationScopeList = newArrayList(); for (AuthorizationScope authorizationScope : scopes) { String description = authorizationScope.description(); String scope = authorizationScope.scope();
@ApiOperation( value = "Update contract blacklist configuration", authorizations = { @Authorization(value = "multibanking_auth", scopes = { @AuthorizationScope(scope = "openid", description = "") })}) @PutMapping public HttpEntity<Void> updateContractBlackList(@RequestBody ContractBlacklist contractBlacklist) { contractBlacklistService.saveContractBlacklist(contractBlacklist); return new ResponseEntity<>(HttpStatus.NO_CONTENT); }
@ApiOperation( value = "Update booking groups configuration", authorizations = { @Authorization(value = "multibanking_auth", scopes = { @AuthorizationScope(scope = "openid", description = "") })}) @PutMapping public HttpEntity<Void> updateBookingGroups(@RequestBody GroupConfig groupsContainer) { bookingGroupsService.saveBookingGroups(groupsContainer); return new ResponseEntity<>(HttpStatus.NO_CONTENT); }
private static List<SecurityRequirement> parseAuthorizations(Authorization[] authorizations) { final List<SecurityRequirement> result = new ArrayList<SecurityRequirement>(); for (Authorization auth : authorizations) { if (StringUtils.isNotEmpty(auth.value())) { final SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); for (AuthorizationScope scope : auth.scopes()) { if (StringUtils.isNotEmpty(scope.scope())) { security.addScope(scope.scope()); } } result.add(security); } } return result; }
@ApiOperation( value = "Update categories tree", authorizations = { @Authorization(value = "multibanking_auth", scopes = { @AuthorizationScope(scope = "openid", description = "") })}) @PutMapping public HttpEntity<Void> updateCategories(@RequestBody CategoriesTree categoriesContainer) { categoriesService.saveCategories(categoriesContainer); return new ResponseEntity<>(HttpStatus.NO_CONTENT); }
@ApiOperation( value = "Download categorization rules", authorizations = { @Authorization(value = "multibanking_auth", scopes = { @AuthorizationScope(scope = "openid", description = "") })}) @GetMapping(path = "/download", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) public HttpEntity<InputStreamResource> downloadRules(@RequestParam(required = false, defaultValue = "CSV") RulesService.FileFormat format) throws IOException { return ResponseEntity.ok() .body(new InputStreamResource(new ByteArrayInputStream(rulesService.rulesAsByteArray(format)))); }
@ApiOperation( value = "Find categorization rule", authorizations = { @Authorization(value = "multibanking_auth", scopes = { @AuthorizationScope(scope = "openid", description = "") })}) @GetMapping(value = "/search") public Resources<RuleEntity> searchRules(@RequestParam String query) { return new Resources<>(rulesService.search(query)); }
@ApiOperation( value = "Update categorization rule", authorizations = { @Authorization(value = "multibanking_auth", scopes = { @AuthorizationScope(scope = "openid", description = "") })}) @PutMapping(value = "/{ruleId}") public HttpEntity<Void> updateRule(@PathVariable String ruleId, @RequestBody RuleEntity ruleEntity) { ruleEntity.updateSearchIndex(); rulesService.save(ruleEntity); return new ResponseEntity<>(HttpStatus.NO_CONTENT); }
@ApiOperation( value = "Create categorization rule", authorizations = { @Authorization(value = "multibanking_auth", scopes = { @AuthorizationScope(scope = "openid", description = "") })}) @PostMapping public HttpEntity<Void> createRule(@RequestBody RuleEntity ruleEntity) { ruleEntity.updateSearchIndex(); rulesService.save(ruleEntity); return new ResponseEntity<>(HttpStatus.CREATED); }
@ApiOperation( value = "Read smartanalytics configuration state", authorizations = { @Authorization(value = "multibanking_auth", scopes = { @AuthorizationScope(scope = "openid", description = "") })}) @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) public Resource<ConfigStatus> status() { return new Resource(statusService.getStatus()); }